I have a problem with starting my two strategies which are 15 minutes bars, updated on close of bar, based on European (Dutch) index futures (08:00-22:00 GMT+1). One strategy for buy's and one for sell's. The session template is set on Default 24/7.
When the day starts at 08:00 sometimes orders are still executed immediately while I have all settings placed not do do so (wait until flat, sync false if there are no positions). Furthermore I have a statement in my code that there may be no trading activity at the first bar of a session (Bars.FirstBarOfSession == false) as well a extra safety that orders are not placed based on the close of the last bar of the previous session by setting that orders are only placed after the first bar and before the last of a session (Bars.BarsSinceSession > 1 and Bars.BarsSinceSession < 55).
This problem keeps popping up everytime I start (enable) the strategies before 08:00. If I wait untill the first tick, then everyting seems to work fine, but only if there are no open positions. In the latter case it even executes orders also when I wait for the first ticks after the opening at 08:00, while I have adjusted the wait untill flat into 'immediate' and set the account syncing to true. In that case proper running orders are cancelled sometimes by placing a sell against a proper buy (remember it are two seperate strategies, but the settings rule out that two positions are activated simultaniously).
As an example it occured right this morning and it is driving me nuts. I had no positions open and enabled the strategies at 07:58. The first tick popped up at 08:00, slightly higher than the previous night close and the strategy had no trigger on the last bar close (last bar of previous session, on which it is not allowed to trade anyway) but an sell order was executed immediately. A few secons later is was closed again, indeed on one of the exit parameters.
This also happens when I want to sync a buy position (overnight) and start/ enable the sell strategy also. It closes the proper buy positions by entering a sell, which flattens my overall position.
The only thing I can think of after all I've done is that the strategy 'looks' ate the previous day close of the index itself at 17:30 GMT+1 instead of the close of the index futures at 22:00, although the session template is set to default 24/7. Does this makes sense?
Please give me your thoughts, as this just doesn't work properly and I have done everything I can come up with.
Regards,
Francis
Comment