I am using the following code to calculate Daily High and LowdayHigh = security(syminfo.tickerid, 'D', high, lookahead=barmerge.lookahead_off) dayLow = security(syminfo.tickerid, 'D', low, lookahead=barmerge.lookahead_off)
dayHigh = security(syminfo.tickerid, 'D', high, lookahead=barmerge.lookahead_off) dayLow = security(syminfo.tickerid, 'D', low, lookahead=barmerge.lookahead_off)
I am using on the 15 mins chart. In the live market it shows me the correct update values on the 15 minutes as the chart progresses, but when I try checking the H/L every bar in the history(i.e before today) it shows be the Daily High and Low which formed end of day but not the actual H/L which happened on that 15 min bar.I tried using barmerge.lookahead_on too, but the results were same
How to solve this?
This solved the problem
// Keep track of current day's high.
var dayHigh = 0.0 dayHigh := change(dayofweek) ? high : max(high, dayHigh)
2.1m questions
2.1m answers
60 comments
57.0k users