still trying to migrate the same 6.5 strat to 7
I've noticed IExecution.Order is sometimes null in the onExecution() method .
Actually it happens only with a Close Position IExecution.
This wasn't the case in 6.5, this is probably new normal behavior in 7
(as now i receive a separate Close Position order, then the Filled order).
But it is not mentionned in new Documentation.
also, what would be the recommended check ?
right now i've added if(execution.Order !=null) which seems the best check possible since checking on the execution.Name string is just "meh"
If needed, script to reproduce issue :
protected override void OnBarUpdate() { if(Position.MarketPosition == MarketPosition.Flat) EnterLong(1,"Enter"); if(ToTime(Time[0]) > 161400) { EnterShortLimit(Close[1]+5); } } protected override void OnExecution(IExecution execution) { if(execution.Order !=null) log(execution.Order.OrderState.ToString()); else log("order is null"); }
Comment