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.