trying to get the value of the previous highest high in pinescript, but this code gives me the previous bar of current highest high.
myper=input(50, "LENGTH")
y1 = highest(high,myper)
yy = valuewhen(high>y1[1],high,0)
plot(yy[1], linewidth=2, color=#00FF00, title="alt")
Can anyone help ?
Thats because you use the previous value (
[1]
) of theyy
series inplot()
function.