I am encountering an error while modifying live orders with interactive brokers. When I run the strategy in a backtest, or live in a simulated account, I do not generate any errors. But when I run live with my IB account, I get an unable to modify - order not found error with every single attempt to modify an order. I am placing the order with this code:
EnterLongLimit(0, true, CurrentShares, (MAX1[0] * (1 - ((NATR1[0] * LongEntryFx) / 100))), @"longOrder");
and I am modifying with this:
ChangeOrder(longOrder, CurrentShares, (MAX1[0] * (1 - ((NATR1[0] * LongEntryFx) / 100))), 0);
Any ideas?
Thanks!
Here is what shows in the log: (I redacted the account number)
U(acctnumber), Unable to modify order: Not found orderId='1610958443' account='U(acctnumber)' name='shortOrder' orderState=ChangePending instrument='FLT' orderAction=SellShort orderType='Limit' limitPrice=252.29 stopPrice=0 quantity=19 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=4032 time='2020-10-14 08:47:12' gtd='2099-12-01' statementDate='2020-10-14' affected Order: SellShort 19 Limit @ 252.29 |
Order='1610958443/U(acctnumber)' Name='shortOrder' New state='Working' Instrument='FLT' Action='Sell short' Limit price=252.29 Stop price=0 Quantity=19 Type='Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='Unable to change order' Native error='Unable to modify order: Not found orderId='1610958443' account='U(acctnumber)' name='shortOrder' orderState=ChangePending instrument='FLT' orderAction=SellShort orderType='Limit' limitPrice=252.29 stopPrice=0 quantity=19 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=4032 time='2020-10-14 08:47:12' gtd='2099-12-01' statementDate='2020-10-14'' |
Order='1610958443/U(acctnumber)' Name='shortOrder' New state='Accepted' Instrument='FLT' Action='Sell short' Limit price=252.29 Stop price=0 Quantity=19 Type='Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error='' |
Comment