OPEN-SOURCE SCRIPT

9 EMA & 150 EMA Crossover Arrows

76
//version=5
indicator("9 EMA & 150 EMA Crossover Arrows", overlay=true)

// EMA definitions
ema9 = ta.ema(close, 9)
ema150 = ta.ema(close, 150)

// Candle conditions
isBullish = close > open
isBearish = close < open

// Crossover logic
bullishCross = ta.crossover(ema9, ema150)
bearishCross = ta.crossunder(ema9, ema150)

// Entry conditions
bullishSignal = bullishCross and isBullish and close >= ema9
bearishSignal = bearishCross and isBearish and close <= ema9

// Plot arrows
plotshape(bullishSignal, title="Bullish Entry", location=location.belowbar, color=color.green, style=shape.arrowup, size=size.small)
plotshape(bearishSignal, title="Bearish Entry", location=location.abovebar, color=color.red, style=shape.arrowdown, size=size.small)

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

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.