GetRealtimeOrder() returns null for Market order with state Filled in transition from historical to market replay data.
I use unmanaged method to handle orders.
else if (State == State.Realtime)
{
positionA.Sync();
positionB.Sync();
}
...
// position class
public void Sync()
{
SyncOrders(entry);
SyncOrders(stoploss);
SyncOrders(takeprofit);
}
private void SyncOrders(Order[] orders)
{
for (int i = 0; i < orders.Count(); i++)
if (orders[i] != null)
{
orders[i] = Strategy.GetRealtimeOrder(orders[i]);
}
}
Comment