-1

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!

Ken White
  • 123,280
  • 14
  • 225
  • 444
KZZ
  • 1
  • 2

1 Answers1

0

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)
vgladkov
  • 346
  • 2
  • 6