Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (MadJack, AndrewAMD, Quad), 540 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Cancel GTC OrderLimit trade with IB #481902
11/17/20 02:44
11/17/20 02:44
Joined: Oct 2020
Posts: 9
R
ruins Offline OP
Newbie
ruins  Offline OP
Newbie
R

Joined: Oct 2020
Posts: 9
Hi,

I am using a script to enter a GTC OrderLimit order with Interactive Brokers.

OrderLimit = roundto(0.999*priceClose(),PIP);
int GTCFlag = brokerCommand(SET_ORDERTYPE,2); //set order type to good till cancelled.
ThisTrade = enterLong();

I want a GTC order as I dont want the script to wait for the order to be filled before moving onto the next Asset.

If the GTC order in not filled within 1 hour, I want to cancel it, however exitLong() or exitTrade() dont appear to work as for some reason the Quantity associated with the trade is 0 - probably because it is unfilled.

From the API Log I see this:
12:30:00:098 <- 3-43-554732-0-RCL-STK--0---SMART--USD-----SELL-0-LMT-75.51--DAY--xxxxxxxxxx-O-0-Zorro-1-0-0-0-0-0-1-0--0-------0---1-0---0-0--1-1--0------0-----0-----------0---0-0---0--
12:30:00:098 -> 4-2-554732-321-Error validating request.-'bO' : cause - The size value cannot be zero:-

So I cant cancel the LimitOrder within IB from Zorro - however I can cancel it easily from within TWS.

Any ideas on how I can cancel the order from Zorro or achieve the same outcome with other strategies ?

Alternatively, there is a GTD (goodtilldate) option in the TWS API which might be useful however I cant see how that can be exercised from within Zorro.

Thanks.

Re: Cancel GTC OrderLimit trade with IB [Re: ruins] #481904
11/17/20 11:12
11/17/20 11:12
Joined: Oct 2020
Posts: 9
R
ruins Offline OP
Newbie
ruins  Offline OP
Newbie
R

Joined: Oct 2020
Posts: 9
I did find the following command:

"OrderDuration"
-GTC order duration in seconds.

This would appear to be the same as GTD.

However doesnt appear to cancel the GTC - with IB at least.

Code snippet:
Lots = 100;
OrderDuration = 30;
setf(TradeMode,TR_GTC);
OrderLimit = roundto(0.999*priceClose(),PIP);
ThisTrade = enterLong();

Last edited by ruins; 11/17/20 11:13.
Re: Cancel GTC OrderLimit trade with IB [Re: ruins] #481914
11/19/20 08:00
11/19/20 08:00
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
For cancelling the remainder of an unfilled order, select the trade and set TradeLots = TradeLotsTarget-TradeLots, then exit the trade. This should work at least in theory.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1