protected override void OnExecution(IExecution execution)
{
if (execution.Order == null) {
Print("execution.Order is null for: " + execution.Name);
// My code here...
}
}
Most of the problem was "Exit on close" executions, so I manually ignore those in OnExecution. Maybe this info will help others that run into this:
protected override void OnExecution(IExecution execution)
{
if (execution.Order == null) {
if (execution.Name != "Exit on close") {
Print("execution.Order is null for: " + execution.Name);
// My code here...
}
}
}
But, I also see very rare cases of a null Order for the "Close position" execution name. Does anyone know why this might happen? TraceOrders reports:
3/27/2009 11:00:00 PM Entered internal PlaceOrder() method at 3/27/2009 11:00:00 PM: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='HighRangeExit' FromEntrySignal='HighRange'
execution.Order is null for: Close position
3/27/2009 11:00:00 PM Entered internal PlaceOrder() method at 3/27/2009 11:00:00 PM: Action=Buy OrderType=Market Quantity=100 LimitPrice=0 StopPrice=0 SignalName='LongBounce2' FromEntrySignal=''
It also happens after Buy actions, so it isn't specific to being after BuyToCover actions.

Comment