Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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)

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?

question from:https://stackoverflow.com/questions/65853437/not-getting-proper-daily-high-and-low-on-historical-bars

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

This solved the problem

// Keep track of current day's high.

var dayHigh = 0.0 dayHigh := change(dayofweek) ? high : max(high, dayHigh)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...