The code is simple:
if (High[0] > Trigger[0]) {
SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, 0, 0, "", LongTradeTag.ToString() + "OL"); // Unmanaged approach
}
Between historical and live there is a shift of the order of 1 bar. In live trading the order is executed 1 bar earlier than in backtesting (the orderprice is not the issue, because I can change that within the Fill-procedure). In the backtest I expected that the code is calculated on the close and that order is triggered on that bar, but it seems that the order is triggered on the next bar. (I know there is a way to use a OrderType.Stop on the previous bar, but there are several reason that I need a market order).
Is there a way to overcome this, so that in the backtest the order is also executed on the current bar? Look forward to your reply.
Kind regards,
Rene

Comment