I am working with StopLimit orders having a limit below the stop (negative)
the order is accepted by the IB.
in some cases when the stop is triggered but the limit is not yet reached , I sometimes want to replace the order with a new one.
this is when the IB rejects the updated order.
I then trap the error in OnOrderUpdate and have this code :
if (entryOrder != null && entryOrder == order && order.OrderState == OrderState.Rejected) { // Rejection handling iPrint("REJECTED - Previous order was already triggered so we cancel and resubmit "); foreach (Order openorder in Orders) { Print(openorder.Name + " " + openorder.OrderState); CancelOrder(openorder); } EnterLongStopLimit(0 , true , OffsetTradeSize , LimitLevelforLONG , StopLevelforLONG , "FCMoveLong"); }
Comment