Doug Hayman Posted September 18, 2020 Report Posted September 18, 2020 I noticed this while trading live versus reviewing a trade of mine via Advanced Paintbars: When trading live, the PB Horizontal Line Intraday Values for "Today's High" and "Today's Low" display chart-wise and indicate value-wise the correct values to date. However, I noticed that after reloading my symbol data, my Paintbar results (which sometimes are predicated on Today's High/Low values), indicated different results from my Live trade. Upon examination, my historical paintbar used the High/Low values of the entire day in its calculation, as opposed to the what the actual High/Low value was at the time of my trade. I tried enabling the "Reg. Session Values Only" flag in the Parameter setting for these 2 Variable declarations, but that didn't change anything. Quote
Mike Medved Posted September 18, 2020 Report Posted September 18, 2020 That's correct - the Today's High and Today's Low are actual Today's high/low - right now, not at the time of the candle. If you wants a paintbar/scan to get the high and low for the day *at the time of the candle* you have to keep track of it yourself. It is pretty easy to do define double DayHigh, DayLow; int PrevDayNumber = -1; then, inside the paintbar, at start, do: var info = GetTradingSessionInfo(Timestamp); if (info.DayNumber!=PrevDayNumber) { DayHigh = High; DayLow=Low; PrevDayNumber=info.DayNumber; } else { DayHigh = Math.Max(DayHigh, High); DayLow = Math.Min(DayLow, Low); } There ya go. 1 Quote
Doug Hayman Posted September 18, 2020 Author Report Posted September 18, 2020 Excellent solution, Mike, thanks. You gave me a homework assignment. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.