I'm trying to create an indicator which requires the use of True High and True Low of the previous day. True High is defined as the higher of yesterday's high and the close 2 days ago while true low is defined as the lower of yesterday's low and the close 2 days ago. Upon calculating that, I'd like to transpose that information (true high and true low) to today's intraday chart. Could someone please help?
Can you help answer these questions from other members on futures io?
Eloy, Thanks for that! I have a few questions though...
1) if DClose2 = DClose1 and Dclose1 = Close[1], then Dclose2 = Close[1], right? This would be the close of 1 bar ago, right?
2) would your script work if I were to use it on intraday charts?
DClose2 gets value DClose1 then DClose1 gets new value Close[1] and DClose2 <> Close[1], DClose2 still remain value of DClose1.
It use Bars.SessionBreak (This property returns true if the call to OnBarUpdate() is the first call of the session). So it is a new day and saved DayClose became DayClose 2 day ago. Because first bar of the session, Close[1] (close of 1 bar ago) = yesterday's Close.
So there was a mistake in DClose1 = Close[-1] should be DClose1 = Close[1] of course.
Yes. Just test it!
The following user says Thank You to Eloy for this post: