the following code creates an order that cannot be deleted when using simulation accounts.
void SubmitAnOrder90
{
Order stopOrder;
stopOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.StopMarket, OrderEntry.Automated, TimeInForce.Day, 1, 0, 1400, "myOCO", "stopOrder", Core.Globals.MaxDate, null);
if(TestSomeMarketCondition() == false)
{
myAccount.Cancel(new[] { stopOrder }); // with or without this, we end up with an orphaned order
// that cannot be deleted, canceled or removed from simulation accounts
return;
}
myAccount.Submit(new[] { stopOrder });
}

Comment