OPEN-SOURCE SCRIPT

150 EMA Crossover with Confirmation Candle

131
//version=5
indicator("150 EMA Crossover with Confirmation Candle", overlay=true)

// Define EMAs
ema9 = ta.ema(close, 9)
ema150 = ta.ema(close, 150)

// Conditions
bullishCandle = close > open
bearishCandle = close < open

emaCrossUp = ta.crossover(ema9, ema150)
emaCrossDown = ta.crossunder(ema9, ema150)

// Buy Signal
buySignal = emaCrossUp and bullishCandle and close >= ema9

// Sell Signal
sellSignal = emaCrossDown and bearishCandle and close <= ema9

// Plot EMAs
plot(ema9, color=color.orange, title="EMA 9")
plot(ema150, color=color.blue, title="EMA 150")

// Plot signals
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.arrowup, size=size.small)
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.arrowdown, size=size.small)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.