Search code examples
viewpine-scripttrading

I want to color candle which is not touching 5EMA


I want to highlight candle which is not touching 5EMA in trading view. kindly help me with it


Solution

  • Try this:

    //@version=5
    indicator("My Script", overlay=true)
    
    EMA5 = ta.ema(close, 5)
    bgcolor(low > EMA5 or high < EMA5 ? color.new(color.green, 90) : na)