Price problem using Tradestation & IBPlugin

IBPlugin is further development of TWSLink.It is focused for the useage with MetaTrader. But as it is a DLL, you can use it everywhere on Windows which supports DLL, e.g. in Trade Station or C++ applications or make wrapper for Perl, Python etc.

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
Post Reply
mdg
Posts: 13
Joined: Tue Oct 30, 2018 10:16 pm

Price problem using Tradestation & IBPlugin

Post by mdg »

Currently working on easylanguage in Tradestation and use IBPlugin to submit trades to IB-TWS. For the most part everything is working well except for stocks priced under $5.00. When I submit the orders using easylanguage, the order attribute string looks correct but when the order reaches IB TWS and I check the API log, for some stocks it has increased the price to 4 decimals from 2 decimals which causes the order to be rejected. Can you please advise how I can fix this. Here are some additional details:

Stock testing with is: RIOT


Order attribute strings from Tradestation Easylanguage Print statements:
<++>
Contracts Found= 1.00 SET=STK#CUR=USD#SBL=RIOT#EXC=NASDAQ
conid=292830677.00 is RIOT order type is STPLMT
--- place BUY STPLMT order
uid STPLMT ATTR=#1007=SMART#53=BUY#6=STPLMT#22=0#1=6400#2=4.24#3=4.22


IB-API LOG MESSAGES (Trimmed for clarity)
12:19:40:587 <- 3-45-1879048959-292830677-RIOT-STK--0---SMART-NASDAQ-USD-RIOT-SCM---BUY-6400-STPLMT-4.24-4.2199-GTC
12:19:40:613 -> ---`4-2-1879048959-110-The price does not conform to the minimum price variation for this contract.-


As you can see, the 4.24 price is honored but the 4.22 price gets changed to 4.2199 which causes the error.


Best Regards,

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Price problem using Tradestation & IBPlugin

Post by board_admin »

The RIOT contract receives a mintick of
0.0001
So
4.2199
is in line with that mintick.

However
4.22
should be aligned to
4.22
and not to
4.2199
even when mintick is 0.0001.

Rounding problem.

Solved in version 1515.
Just download from our public google folder.

https://drive.google.com/file/d/10oYHDP ... share_link

Before install, close all applications loading IBPlugin.
Run installation.
Try again.

mdg
Posts: 13
Joined: Tue Oct 30, 2018 10:16 pm

Re: Price problem using Tradestation & IBPlugin

Post by mdg »

Follow up to see if this link is still to the latest version. I have noticed that I still get the error from the API log with Interactive Brokers with low priced stocks that have a mintick of 0.0001 as follows:

The price does not conform to the minimum price variation for this contract.


The stock today (20230829) that was causing the issue is BTBT. Here is the print log from TS and showing the UID string I send to IBPlugin from TradeStation and the corresponding error from IB TWS API log file...

PRINT LOG from TS
Contracts Found= 1.00 SET=STK#CUR=USD#SBL=BTBT#EXC=NASDAQ
conid=450017186.00 is BTBT order type is STPLMT
--- place BUY STPLMT order
uid STPLMT=1962157028.00 ATTR=#1007=NASDAQ#53=BUY#6=STPLMT#22=0#1=7500#2=2.68#3=2.67#49=RadarTrade

IB TWS API Log File
12:01:59:871 <- 3-45-1879049133-450017186-BTBT-STK--0---ISLAND-NASDAQ-USD-BTBT-SCM---BUY-7500-STPLMT-2.68-2.6699-GTC---O-0-|0~1962157028|1~0|2~450017186|3~7500|4~ibg|6~RadarTrade-1-0-0-0-0-0-1-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0--1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-1.7976931348623157e+308-0----1.7976931348623157e+308-
12:01:59:872 -> ---`4-2-1879049133-110-The price does not conform to the minimum price variation for this contract.-

Please advise on this

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Price problem using Tradestation & IBPlugin

Post by board_admin »

Hi,
the problem is may related to a variable mintick based on prices which is not really supported by IBPlugin.

https://ndcdyn.interactivebrokers.com/A ... =1&site=IB

Perhaps you can set or overwrite the mintick using the admin tool and loading the symbol set of your setup.
The default setup is called "default".

Please let me know.

mdg
Posts: 13
Joined: Tue Oct 30, 2018 10:16 pm

Re: Price problem using Tradestation & IBPlugin

Post by mdg »

Hello,

Thank you for your reply and I will try this as a testing option next week when the markets are open again but it doesn't work in the process of using Tradestation with IBplugin to submit orders to TWS. I need to be able to type a symbol into either a radarscreen or chart which has the indicator with the ibplugin script applied to it and have that script do a ibgCONTRACT_QUERY to get the IB contract identifier so that I can then place an order. Generally the ibg command sequence I use is (Symbol and GetExchangeName are Tradestation provided values):


contract_attrib="SET=STK#CUR=USD#SBL=" & Symbol & "#EXC=" & GetExchangeName;
nbr_contracts=ibgCONTRACT_QUERY(contract_attrib,5000);
addid=ibgADD_CONTRACT_IDX(0,Symbol);
conid=ibgCONTRACT_INFO_INT(0,15);

This last variable conid is what I use to place the order with. Sometimes on less than $5.00 stocks it works fine but approximately 20% of the time I get the error and in the api log rather than the limit price being say 24.90 it shows a bad price like 24.89999999 instead.

This is similar to the earlier part of the thread when I was having happen in prior version of IBPlugin that was updated to try and fix this problem. For my day trading process the admin tool and database are overhead that I will not have time to manually try to update or maintain as my symbols change constantly throughout the day.

Thanks

Post Reply