0% found this document useful (0 votes)
59 views1 page

File 1

Forex pdf

Uploaded by

suhailmughanni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views1 page

File 1

Forex pdf

Uploaded by

suhailmughanni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//@version=5

indicator("Bollinger Bands with Candlestick Patterns", overlay=true)

// Input parameters
length = input.int(20, title="Bollinger Bands Length")
src = input(close, title="Source")
mult = input.float(2.0, title="Bollinger Bands Multiplier")
showCandlestickPatterns = input.bool(true, title="Enable Candlestick Patterns")

// Bollinger Bands calculation


basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev

// Plot Bollinger Bands


plot(basis, color=color.blue, title="Basis")
p1 = plot(upper, color=color.green, title="Upper Band")
p2 = plot(lower, color=color.red, title="Lower Band")
fill(p1, p2, color=color.new(color.green, 90))

// Candlestick patterns
bullishEngulfing = ta.crossover(close, open[1]) and close > open and open <
close[1]
bearishEngulfing = ta.crossunder(close, open[1]) and close < open and open >
close[1]
doji = math.abs(open - close) / (high - low) < 0.1

// Buy and sell signals


buySignal = bullishEngulfing and close < lower
sellSignal = bearishEngulfing and close > upper

// Highlight candlestick patterns


if (showCandlestickPatterns)
bgcolor(bullishEngulfing ? color.new(color.green, 80) : na, title="Bullish
Engulfing Highlight")
bgcolor(bearishEngulfing ? color.new(color.red, 80) : na, title="Bearish
Engulfing Highlight")
bgcolor(doji ? color.new(color.orange, 80) : na, title="Doji Highlight")

// Plot buy and sell signals


plotshape(buySignal, style=shape.labelup, location=location.belowbar,
color=color.new(color.green, 0), size=size.small, title="Buy Signal", text="BUY")
plotshape(sellSignal, style=shape.labeldown, location=location.abovebar,
color=color.new(color.red, 0), size=size.small, title="Sell Signal", text="SELL")

You might also like