IB Order type: bracket order ?

Discuss, post your questions about TWSLink here.

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
Guillaume
Posts: 21
Joined: Mon Sep 04, 2017 5:40 pm

IB Order type: bracket order ?

Post by Guillaume »

Hi,
I've seen in the documentation a table showing some IB order type. Is the documentation up to date? I ask this question, because the number of types supported by TWSLINK is lower than the number of order types in IB. Actually, my question is: is it possible to place a bracket order (order with Stop Loss and Take Profit values) with TWSLING and command PLACE_ORDER?

Thanks
Guillaume

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

Re: IB Order type: bracket order ?

Post by board_admin »

Hello,
you miss some ordertypes because TWSLink is no longer developped.
It is only changed for bugfixing.
Nevertheless, you will certainly be able to use it for a while yet.

However, bracket orders are not an own ordertype.
You create a brackt order by creating a master order with transmit=0,
a target (LMT) with parentid= master id and with transmit=0
and a stoploss (STP) with parentid= master id and with transmit=1.

(If you like to have only target or stoploss, you place the 2nd order
with transmit=1.)

Example:

Code: Select all

uid_contract=REGISTER_CONTRACT("MSFT","STK","USD","SMART","","","",0,"",0,0)
CONNECT("",7496,1,1000)

// master order
uidmaster=PLACE_ORDER(uid_contract,0,"BUY","MKT",100,0,0.0,"GTC",0,0)
// take profit order
PLACE_ORDER(uid_contract,0,"SELL","LMT",100,50,0.0,"GTC",0,uidmaster)
// stop loss order
PLACE_ORDER(uid_contract,0,"SELL","STP",100,0,5,"GTC",1,uidmaster)

Guillaume
Posts: 21
Joined: Mon Sep 04, 2017 5:40 pm

Re: IB Order type: bracket order ?

Post by Guillaume »

Thanks for the code. I understand how orders work.

I didn't know that TWSLink was obsolete. I saw a recent update for Perl wrapper. Would you say the project is enough mature to use it?

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

Re: IB Order type: bracket order ?

Post by board_admin »

I didn't say obsolete. You still can use it and i am sure also in the coming years.
But it is not further developped. When IB adds a new features to their IB,
TWSLink is not adjusted.

The Perl wrapper was an exception.

Yes, it is matured. Since years. You can test it 3 weeks for free.

Guillaume
Posts: 21
Joined: Mon Sep 04, 2017 5:40 pm

Re: IB Order type: bracket order ?

Post by Guillaume »

OK, thanks for your answer.
I don't understand why you say I can use TWSLink during 3 weeks for free, because on your webpage you say that TWSLink is completely free without any limitation.

Guillaume

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

Re: IB Order type: bracket order ?

Post by board_admin »

Ah sorry yes,I stucked in the past. Forget the comment.
You can use it unlimited for free.

Post Reply