When testing this code, both under sim and playback accounts, I noticed the following:
Scenario 1: When this strategy is activated & set to calculate "on each tick": For the past/historical data, my code is returning the values correctly for current bar delta, previous bar delta, current bar delta percent and previous bar delta percent. However when running realtime, the same code is returning these four values for the previous respective bars instead (by shifting one bar to left, for example, takes the previous bar as the current bar etc).
Scenario 2: When this strategy is activated & set to calculate "on bar close": For the past/historical data, my code is returning the values correctly for current bar delta, previous bar delta, current bar delta percent and previous bar delta percent. However when running realtime, the same code is returning current bar delta as 0, and current bar's delta as previous bar delta etc.
In summary, I am getting the correct values returned when running this strategy on the historical data but not on realtime. Any idea what is causing this issue? Thanks!
Comment