I made this study for swing high and swing lows , I am a beginner i am looking to put a box in my watchlist column that turns red when a new SL is formed and Cyan when a new SH is formed , I know i need a label statement but Im at a loss of how to do it . Any help I would appreciate, Im surprised I was able to do this . My hat is off to the good script writers !! Amazing !
def swinghigh = if high > high and high > high and high > high[-1] and high > high[-2] then 1 else 0; plot sh = if swinghigh then high else Double.NaN; sh.SetStyle(Curve.POINTS); def swinglow = if low < low and low < low and low < low[-1] and low < low[-2] then 1 else 0; plot lw = if swinglow then low else Double.NaN; lw.SetStyle(Curve.POINTS);