I have an indicator which does crossovers and cross unders. It's displayed as a background color. Currently it displays all crosses.
With what pinescript can I edit it, so it will only show the last one?
Thank you very much!
I have an indicator which does crossovers and cross unders. It's displayed as a background color. Currently it displays all crosses.
With what pinescript can I edit it, so it will only show the last one?
Thank you very much!
Use show_last
parameter:
//@version=5
indicator("My Script", overlay=true)
sma = ta.sma(close, 14)
cond = ta.cross(close, sma)
bgcolor(cond ? color.teal : na, show_last=1)