hey guys im trying to get all time high and all time low, but the second one return always a zero? why? is based on low. i leave a pic of the code
Welcome to the BEST forum for traders
Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".
hey guys im trying to get all time high and all time low, but the second one return always a zero? why? is based on low. i leave a pic of the code
Not sure why either
Try this way
// function to get all-time high
get_all_time_high() =>
h = 0.0
h := barstate.isfirst ? high : high > h[1] ? high : h[1]
h
// function to get all-time low
get_all_time_low() =>
l = 0.0
l := barstate.isfirst ? low : low < l[1] ? low : l[1]
l
// getting all-time high/low
h0 = security(syminfo.tickerid, 'M', get_all_time_high())
l0 = security(syminfo.tickerid, 'M', get_all_time_low())
// plotting
plot(h0, offset=-9999999, color = color.blue, trackprice=true, linewidth=3)
plot(l0, offset=-9999999, color = color.blue, trackprice=true, linewidth=3)