Support Board
Date/Time: Mon, 30 Dec 2024 17:28:30 +0000
Post From: InternalOrderID returns 0 when live trading with Interactive Brokers
[2015-03-10 16:10:10] |
User26860 - Posts: 14 |
I used below code to enter a stop order when detecting there is open long position: s_SCNewOrder order; order.OrderQuantity = 1; order.OrderType = SCT_ORDERTYPE_STOP; order.Price1 = stop; if (sc.BuyExit(order) > 0) { SCString Buffer; Buffer.Format("Successfully submitted stop order %i", order.InternalOrderID); sc.AddMessageToLog(Buffer, 0); trailingStopOrderId = order.InternalOrderID; } And inside the log, it logged "Successfully submitted stop order 0". This confirms with the subgraph value which I set using trailingStopOrderId. As for OCO, I didn't do anything particular, so I'd assume it's not in OCO group. Also during the trigger of above if block, there is no open orders, only 1 open position. Another thought, can this be related to some flags I need to set when going from testing to live? The reason is the internalOrderID is not zero during backtesting. |