Hello,
I went live with a new strategy this morning. I then noticed that one of my orders was being canceled as soon as it was entered. The reason was "order price is outside price limits". Now, I have already entered the contract (GF- Feeder Cattle Futures) into the Markets/Symbols toolbox correctly. Previous iterations of these orders were entered correctly. But for whatever reason, this one is not.
Ironically, the price shown in the orders on IB is actually correct. When I manually enter this order it works. So I pulled up the audit trail for the order. In the order trail the price is entered with the decimal moved two places left. This is totally inexplicable to me, and I have no idea how to fix it. I am assuming there is some issue in communication between WL and IB via the API.
I tried restarting WL and got the same problem.
I have shown and highlighted all of this in the screenshot below.
I went live with a new strategy this morning. I then noticed that one of my orders was being canceled as soon as it was entered. The reason was "order price is outside price limits". Now, I have already entered the contract (GF- Feeder Cattle Futures) into the Markets/Symbols toolbox correctly. Previous iterations of these orders were entered correctly. But for whatever reason, this one is not.
Ironically, the price shown in the orders on IB is actually correct. When I manually enter this order it works. So I pulled up the audit trail for the order. In the order trail the price is entered with the decimal moved two places left. This is totally inexplicable to me, and I have no idea how to fix it. I am assuming there is some issue in communication between WL and IB via the API.
I tried restarting WL and got the same problem.
I have shown and highlighted all of this in the screenshot below.
Rename
QUOTE:Does this explain it?
This is totally inexplicable to me
In TWS, the order is accepted with the cents notation, i.e., 232.875.
The question is, does the API order need to put it in dollar notation? I'm not sure how we'd handle that automatically since all the contract specs are in cents, but you could divide the order prices by 100 simple enough.
Actually, I don't have any problem placing an order using WealthLab. I'll have to try from the sell side later using a paper trader.
But it seems like the order was submitted to IB at $2.32??
It could be that IB is showing the actual dollar price of the contract's order.
Or, dandude's Strategy converted it to that value.
Or, dandude's Strategy converted it to that value.
The thing is, all the other orders are entered and accepted correctly. This even included an order from the same strategy block prior to this trade!
That's why it is inexplicable. It seems to be a very specific and weird error.
That's why it is inexplicable. It seems to be a very specific and weird error.
I am examining the audit trail and it appears all of the prices are shown with the decimal moved to the left, even the ones I manually entered. In TWS however, the correct price was shown and the orders were filled at that price. Now I really don't know whats going on!
I can't even blame the strategy block or limit orders because they were entered and accepted only fifteen minutes before I ran into this problem!
I can't even blame the strategy block or limit orders because they were entered and accepted only fifteen minutes before I ran into this problem!
After the daily restart on IB, the order is submitting and being accepted normally... Hopefully I won't run into this problem again, especially when I am not looking at it...
I will say I am concerned because this was the first day of me trading with this strategy and on this ticker, so that is a high incidence rate albeit a small sample size.
I wonder if it is related to this particular contract, which only trades from 8:30 CST to 1pm CST and also has an odd multiplier. It looks like IB is translating into a different decimal level internally, while the contract value is multiplied by 100 on TWS. This results in the multiplier being "50000" but in practice and backtesting I had to set it to 500 because of this strange translation/conversion happening at the exchange.
It may be related to what Cone noted which is that the number of decimal places is too many for IB TWS to handle, so they had to multiply the price by 100.
This is all of course speculation. I don't really have any idea why this error occurred today. In the future I will try to fix it with an IB restart. I should also report it to IB, but their response time and competence is... less than... you guys here at WL lol.
I wonder if it is related to this particular contract, which only trades from 8:30 CST to 1pm CST and also has an odd multiplier. It looks like IB is translating into a different decimal level internally, while the contract value is multiplied by 100 on TWS. This results in the multiplier being "50000" but in practice and backtesting I had to set it to 500 because of this strange translation/conversion happening at the exchange.
It may be related to what Cone noted which is that the number of decimal places is too many for IB TWS to handle, so they had to multiply the price by 100.
This is all of course speculation. I don't really have any idea why this error occurred today. In the future I will try to fix it with an IB restart. I should also report it to IB, but their response time and competence is... less than... you guys here at WL lol.
You had to set the point value to 500 so that it matches the price quote in cents.
I'll have to change that for the ## Livestock ## section in IBFutures.txt. In any case, entering your own record in Markets & Symbols was the right thing to do.
I'll have to change that for the ## Livestock ## section in IBFutures.txt. In any case, entering your own record in Markets & Symbols was the right thing to do.
It turns out that, the contract specs in IBFutures.txt with the Point value for "dollar pricing" (50000) is required in order to properly identify the contract. You can even see in Post #1 that IB TWS still considers the Multiplier 50000 even though they're telling us that "Price quotes are displayed in cents.."
Consequently for the backtest to correctly calculate profit, it's required to create the symbol record in Market & Symbols for cents-priced Point Value (500). Also, you should clone and modify the CME market for those Livestock products too, since the trading hours are only 08:30 to 13:05 (CST).
Consequently for the backtest to correctly calculate profit, it's required to create the symbol record in Market & Symbols for cents-priced Point Value (500). Also, you should clone and modify the CME market for those Livestock products too, since the trading hours are only 08:30 to 13:05 (CST).
Thanks for that idea Cone. I did implement it.
Unfortunately, this morning when I went to check on the strategy before the market open it is giving me the same error. Even after a restart of both IB and WL and implementing a new "CME Livestock" market in the market/symbols menu. I should note that it is the same order, because the strategy is in the same trade.
Unfortunately, this morning when I went to check on the strategy before the market open it is giving me the same error. Even after a restart of both IB and WL and implementing a new "CME Livestock" market in the market/symbols menu. I should note that it is the same order, because the strategy is in the same trade.
For me it works without a hitch - just like any other contract.

Maybe you should talk to someone at IB about why, specifically, your orders are erroring out.
Maybe you should talk to someone at IB about why, specifically, your orders are erroring out.
Here we go.. IB is returning the price of the asset in dollars, so if you use this in your code, you need to multiply it by 100.

More specifically, you're getting the dollar pricing for Live Positions. So in that mode, you'll have to multiply the position.EntryPrice by 100 for use in calculations.
If you turn off Live Positions, then it's not required because you'll be using the Backtester's prices.
More specifically, you're getting the dollar pricing for Live Positions. So in that mode, you'll have to multiply the position.EntryPrice by 100 for use in calculations.
If you turn off Live Positions, then it's not required because you'll be using the Backtester's prices.
Right. I don't use live positions, and as I mentioned before, all my other orders for this contract are going through correctly. It is just this one limit sell order that is returning that error. I can email you the strategy and if you run it on the GFH24 on IB maybe you will get the same error, but other than that I don't know how we can troubleshoot this. I will try IB although I hate dealing with their customer service.
fwiw, my test strategy just bought at the Low of the previous bar, and sold at the last High. No hiccups.
The strategy is in a new trade, a short trade, and of course the limit buy take profit order is failing to make it through the exchange.
Cone, perhapse the one variable that you haven't looked at is the OCO. For this order, it is a OCO stop loss/limit order PT combination.
Cone, perhapse the one variable that you haven't looked at is the OCO. For this order, it is a OCO stop loss/limit order PT combination.
Ok, so I just manually entered at OCO on TWS and it failed to enter the limit order. I think this is an IB issue.
You got it. Definitely an IB bug with OCO and cents pricing.
Your Response
Post
Edit Post
Login is required