I have a strategy (attached) that uses ImmediatelySubmit to resume a position and their corresponding orders after disabling and re-enabling it.
The strategy is running with Calculate.OnEachTick, has a 1-tick data series added and tick replay enabled on the chart.
The long positions are opened with the second data series (1 tick granularity):
EnterLong(1,1,"Long");
I run the strategy on "MNQ MAR25" with Playback and this is what happens when a new position is opened as shown in the attached image Playback.jpg:
Position is opened at 21341.00 with Target at 21391.00 and stop at 21291.00
Now, I disable the strategy and I re-enable few seconds later and I get what is shown in Backtest.jpg (the open position now is calculated as it is an historical one):
Position is opened at 21340.50 with Target at 21390.50 and stop at 21290.50
The StartBehavior is ImmediatelySubmit which means that the matching orders "should" be resumed when the order action, order type, quantity, limit price, and stop price are exactly identical.
As reported above, the value for the open position in Backtest is obviously different from the one in Playback and this means that new target and stop values are computed (based on the strategy logic in the code).
Therefore, when the strategy is re-enabled with ImmediatelySubmit the previous orders are cancelled (see Cancelled_Orders.jpg), as expected, since they do not match the new computed ones.
The strategy has 1 tick granularity, tick replay enabled and running on each tick. I would not expect such a behavior.
Is there any way to match Playback and Backtest positions in order to resume the previous orders?
Thank you.

Comment