I have a multi-instrument multi-time frame indicator. It is giving different results with historical vs real-time data.
Here is some output from an example indicator reproducing the issue. In this scenario, the indicator is running at 1 minute, the strategy at 2 minutes.
The strategy is just printing "S" + Time[0], the indicator "I" + Time[0].
Note: everything is using CalculateOnBarClose=true
I 1/28/2014 2:50:00 PM I 1/28/2014 2:51:00 PM S 1/28/2014 2:50:00 PM I 1/28/2014 2:52:00 PM I 1/28/2014 2:53:00 PM S 1/28/2014 2:52:00 PM I 1/28/2014 2:54:00 PM I 1/28/2014 2:55:00 PM S 1/28/2014 2:54:00 PM -- begin real-time S 1/28/2014 2:56:00 PM I 1/28/2014 2:56:00 PM I 1/28/2014 2:57:00 PM S 1/28/2014 2:58:00 PM I 1/28/2014 2:58:00 PM I 1/28/2014 2:59:00 PM I 1/28/2014 3:00:00 PM S 1/28/2014 3:00:00 PM I 1/28/2014 3:01:00 PM
It seems that either the indicator is lagging 2 minutes behind when running on realtime data, or it is peeking 2 minutes ahead when running on backtested data.
Can anyone shed some light on this and what I can do about it? (Note that in my actual strategy, the period types are different)
EDIT:
Additionally, and perhaps more disconcerting, the indicator's value doesn't seem to be populated either. So when I call MyIndicator()[0] from the strategy, I just get the last close of the primary sequence, not the latest value of the indicator (since it hasn't run yet). Everything is fine in historical/backtesting.
Comment