Login Page - Create Account

Support Board


Date/Time: Mon, 07 Oct 2024 09:20:03 +0000



InternalOrderID returns 0 when live trading with Interactive Brokers

View Count: 987

[2015-03-10 14:36:50]
User26860 - Posts: 14
Hi,

I just find out this the hard way when I go into live trading with IB (Interactive Brokers).
During simulation and backtesting it's all fine, but when I go live, all of sudden InternalOrderID and Stop1InternalOrderID start returning 0 after check for sc.BuyEntry(order) > 0.

Any hint what's happening?
[2015-03-10 15:32:09]
Sierra Chart Engineering - Posts: 104368
This does not make sense. If you see the order listed in the Trade >> Trade Activity Log, then there must be an internal order ID.

Check this again because this has 0% possibility of occurring.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-03-10 15:43:46]
User26860 - Posts: 14
0% possibility seems bit sketchy. Nevertheless, I checked the Orders tab within "Trade -> Trade Orders And Positions", the order is there, and my sc.BuyEntry(order) and sc.BuyExit(order) definitely returned positive as I placed a logging line within the if statement.

Please clarify.

Also I just came across ThreadID=3833 on the support board, please see if it may be related. (That user seems also getting 0 internalorderid after switching from test to live trading with LMAX)
[2015-03-10 16:01:58]
Sierra Chart Engineering - Posts: 104368
That thread was about getting an existing order and not submitting a new order.

We tested this, and we always got an Internal order ID submitting an accepted order to Interactive Brokers. This is when the return value is greater than 0.

0% means what you describe can not happen. This we are certain of. Carefully check your code and see where the problem is.

Is there anything unusual about the order. Is this in OCO order?
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-03-10 16:02:24
[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.
[2015-03-11 02:25:45]
Sierra Chart Engineering - Posts: 104368
We need a simple code example from you that we can test. It needs to be a simple code example and a complete study function.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account