I am new to pine script. I would like to have absolute pivot highs and lows shown on Tradingview.
I found the code by LonesomeTheBlue below that is close to what I am looking for.
//@version=4
study("Pivot High Low Points", overlay =true)
lb = input(defval = 1, title="Left Bars")
rb = input(defval = 1, title="Right Bars")
mb = lb + rb + 1
plotshape(iff(not na(high[mb]), iff(highestbars(mb) == -lb, high[lb], na), na), style = shape.triangledown, location = location.abovebar, color = color.lime, size = size.tiny, offset = -lb)
plotshape(iff(not na(low[mb]), iff(lowestbars(mb) == -lb, low[lb], na), na), style = shape.triangleup, location = location.belowbar, color = color.red, size = size.tiny, offset = -lb)
However, the candle is labeled even when it is at equal high/low with the adjacent (left/right) one. The triangle shape would not go away in this case.
I wanted to show only the candle with an absolute pivot high/low. I wonder how to do this? I greatly appreciate your help. Thank you.