Page 1 of 1
IB Order type: bracket order ?
Posted: Wed Feb 07, 2018 1:30 am
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
Re: IB Order type: bracket order ?
Posted: Wed Feb 07, 2018 7:55 am
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)
Re: IB Order type: bracket order ?
Posted: Thu Feb 08, 2018 1:13 am
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?
Re: IB Order type: bracket order ?
Posted: Thu Feb 08, 2018 11:14 am
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.
Re: IB Order type: bracket order ?
Posted: Fri Feb 09, 2018 3:42 am
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
Re: IB Order type: bracket order ?
Posted: Fri Feb 09, 2018 9:39 am
by board_admin
Ah sorry yes,I stucked in the past. Forget the comment.
You can use it unlimited for free.