Conditions are as follows:
1. Example discussed is for ES 12-18 10/26/2018 RTH session.
2. Swing(1) used for test example although strength does not matter.
3. Playback is begun at 9:30 AM or a little before but not within the prior session.
4. Swing low occurs on first bar of RTH session.
5. Swing low returned by calling: Swing(1).SwingLow[0]
6. Validity test must return a positive number: Swing(1).SwingLowBar(0,1,Bars.BarsSinceNewTradingD ay)
7. Result see output window in picture: At time 9:40 Swing(Strength).SwingLow[0] returns 2646 which is incorrect, even though the validity test returns the correct bar of the swing low as a positive number.
Note that if Playback is begun within the previous session then results are correct. The problem seems to occur when Playback is begun at the RTH session start ((9:30 AM).
Since the Swing strength condition is dependant upon the last bar of the previous session and the Playback begins after that bar, the Validity test should return -1
I have attached the test code and screen shot of results.
[ATTACH]n1037404[/ATTACH]
Comment