I have programmed my strategy which should check some conditions on bar closed (Minute). If they are verified, it should enter the market (EnterLong or EnterShort) at the first Tick of the new minute.
When I try the strategy on backtesting data everything works fine.
For example:
- Check conditions at the close of the minute: 04:57:59
- Enter to market (EnterLong): 04:58:00
- Exit to market (ExitLong): 04:59:00
When I try the strategy on realtime data ( or playback data), it is not good.
- Check conditions at the close of the minute: 04:57:59
- Enter to market (EnterLong): 04:58:01
- Exit to market (ExitLong): 04:59:01
I have read the guide on "Discrepancies: Real-Time vs Backtest" and I have tried to introduce bars of different granularity (Second or Tick), I have tried to calculate at each Tick, but nothing seems to work.
There is a solution so that I can enter/exit at market at the first available Tick of the first second of the new minute?
Thanks Albert
PS: I attach the program
Comment