I m writing a strategy in unmanaged mode where i m experiencing problems when i m in a position and i want to reverse.
e.g. if i m one contract short and I run the following code:
EnterLong(1);
I get the error:
Interactive Brokers. Order rejected - reason: no such order: order done (201) affected order: buyToCover 1 Stop
It looks to as if Ninja is sending IB an order to close my short position with a buyToCover order which IB does not understand.
Does anybody have an idea how to solve this using managed mode?
Thanks
Michael
This is the log in TWS: CA 10:14:50:260 JTS-CCPDispatcher-1268: Order Canceled - reason:
CA 10:14:50:260 JTS-ChartOrderProcessor-65: TRADER | WARNING | Completed time is not set on order | id=1591925640 mod=1 liq=false sym=CL side=BUY qty=1 tif=DAY orderType=STP lmtPrice=102.07 stopPrice=102.15 offsetAmt=102.15 originator=Socket orderRef=null ruleGroup=[] state=jfix.FixOrderState$CancelConfirmed acct=DU185578. faParams=null cum=0 conid=43635373 exch=NYMEX compExch=null best=null vwapTime=null goodTil=ExpireDateTime [null] secType=FUT ddeId=995 avpx=1.7976931348623157E308 cumFill=0 preserveDeactivate=false state=jfix.FixOrderState$CancelConfirmed chameleonParams=null adjustedAttribs=None 1.7976931348623157E308 1.7976931348623157E308 1.7976931348623157E308 1.7976931348623157E308 Attributes: BlockOrder=false TrailingUnit=amt StartingPrice=1.7976931348623157E308 ReferencePriceType=None OptOutSmartRouting=false DisplaySize=2147483647 Clearing=/IB OpenCloseAttrib=O AcceptLargeSize=false ReferenceContractId=2147483647 StockRangeLower=1.7976931348623157E308 Hidden=false SweepToFill=false FirmQuoteOnly=false StockRangeUpper=1.7976931348623157E308 OcaGroup=CL 06-14/0001f4e5.53729ce7.01.01-591 ReferenceContractExchange=null OutsideRth=true TwoSidedCrossOrderId=null StockRefPrice=1.7976931348623157E308 MinimumQuantity=2147483647 PercentOffset=1.7976931348623157E308 AllOrNone=false PeggedChangeAmount=1.7976931348623157E308 MarketCapPrice=1.7976931348623157E308 ReceiptTime=20140514-08:07:41 TriggerMethod=Default FacilitationPct=2147483647 ETradeOnly=false NbboPriceCap=1.7976931348623157E308 Delta=1.7976931348623157E308 TouchedTrigger=102.15 OrderCreationTime=20140514-08:07:41 ReferenceChangeAmount=1.7976931348623157E308 OptionAcctAttrib=c CrossQuantity=2147483647 AlgoAttribts: null CompletedAttribs: TrailingKeyAttrib=null
CA 10:14:50:260 JTS-CCPDispatcher-1268: Error: illegal onRejected for order id=1591925640 mod=1 liq=false from state jfix.FixOrderState$CancelConfirmed
CA 10:14:50:260 JTS-ChartOrderProcessor-65: TRADER | WARNING | Completed time is not set on order | id=1591925641 mod=1 liq=false sym=CL side=BUY qty=1 tif=DAY orderType=LMT lmtPrice=82.05 stopPrice=82.05 offsetAmt=0.0 originator=Socket orderRef=null ruleGroup=[] state=jfix.FixOrderState$CancelConfirmed acct=DU185578. faParams=null cum=0 conid=43635373 exch=NYMEX compExch=null best=NYMEX vwapTime=null goodTil=ExpireDateTime [null] secType=FUT ddeId=996 avpx=1.7976931348623157E308 cumFill=0 preserveDeactivate=false state=jfix.FixOrderState$CancelConfirmed chameleonParams=null adjustedAttribs=None 1.7976931348623157E308 1.7976931348623157E308 1.7976931348623157E308 1.7976931348623157E308 Attributes: BlockOrder=false CompletedOrderType:Cancelled by User TrailingUnit=amt StartingPrice=1.7976931348623157E308 ReferencePriceType=None OptOutSmartRouting=false DisplaySize=2147483647 Clearing=/IB OpenCloseAttrib=O AcceptLargeSize=false ReferenceContractId=2147483647 StockRangeLower=1.7976931348623157E308 Hidden=false SweepToFill=false FirmQuoteOnly=false StockRangeUpper=1.7976931348623157E308 CompletedOrderTime=20140514-08:14:50 OcaGroup=CL 06-14/0001f4e5.53729ce7.01.01-591 ReferenceContractExchange=null TwoSidedCrossOrderId=null StockRefPrice=1.7976931348623157E308 MinimumQuantity=2147483647 PercentOffset=1.7976931348623157E308 AllOrNone=false PeggedChangeAmount=1.7976931348623157E308 MarketCapPrice=1.7976931348623157E308 ReceiptTime=20140514-08:07:41 TriggerMethod=Default FacilitationPct=2147483647 ETradeOnly=false NbboPriceCap=1.7976931348623157E308 Delta=1.7976931348623157E308 TouchedTrigger=101.04 OrderCreationTime=20140514-08:07:41 ReferenceChangeAmount=1.7976931348623157E308 OptionAcctAttrib=c CrossQuantity=2147483647 AlgoAttribts: null CompletedAttribs: TrailingKeyAttrib=null
CA 10:14:50:260 JTS-CCPDispatcher-1268: Order Canceled - reason:
CA 10:14:50:360 AWT-EventQueue-0: EXEC Sorting now main model 30730826
CA 10:14:50:360 AWT-EventQueue-0: EXEC Sorting now main model 22269677
CA 10:14:50:360 AWT-EventQueue-0: EXEC Sorting now main model 10840492
CA 10:14:50:360 AWT-EventQueue-0: EXEC Sorting now main model 24800890
CA 10:14:50:370 AWT-EventQueue-0: No such order: order done
Comment