Add Alert Feature: //@version=5 indicator("Candles Not Touching EMA 5 with Arrows",…
- User
Add Alert Feature: //@version=5 indicator("Candles Not Touching EMA 5 with Arrows", overlay=true)
// Calculate EMA 5 ema5 = ta.ema(close, 5)
// Identify candles that do not touch EMA 5 // A candle does not touch EMA 5 if: // - The entire candle is above the EMA (low > ema5), or // - The entire candle is below the EMA (high < ema5) not_touching = (low > ema5) or (high < ema5)
// Plot EMA 5 for reference plot(ema5, color=color.orange, linewidth=2, title="EMA 5")
// Plot arrows to highlight candles not touching EMA 5 // Arrow Up for candles entirely above EMA 5 plotshape(not_touching and close > ema5, title="Above EMA", style=shape.arrowdown, location=location.abovebar, color=color.green, size=size.tiny, offset=0)
// Arrow Down for candles entirely below EMA 5 plotshape(not_touching and close < ema5, title="Below EMA", style=shape.arrowup, location=location.belowbar, color=color.red, size=size.tiny, offset=0)
- Assistant