I am using IB and trying to send a stop order with my market order, but have had no success so far, is it not implemented for options or am I doing something wrong?
Options are even explicitly referenced in the remarks of "TradeMode" and "Stop", which is why I think it should be supported.
I followed the instructions in the IB / TWS Bridge (https://manual.zorro-project.com/ib.htm
"Set TR_ENTRYSTOP for adding a stop order to a trade; this is for special purposes only since the stop order is not managed by Zorro either,..."
- TR_ENTRYSTOP: "Enter any trade with an additional stop order at distance Stop*StopFactor on NFA accounts, if supported by the broker API (see remarks). "
"So use this command in special cases only, for instance with option
contracts or when Zorro does not control the trade."
- Stop: "For options the prices are always distances, f.i. Stop = 0.7 * contractPrice(ThisContract) sets a stop limit at 70% loss."
- StopFactor: "At 0 the stop is only controlled by software; at 1 it is only controlled by the broker."
- SET_ORDERTYPE 2 - GTC (good-till-cancelled); order stays open until completely filled
+8 - STOP; add a stop order at distance Stop*StopFactor on NFA accounts (see remarks).
setf(TradeMode,TR_ENTRYSTOP); //also tried setf(TradeMode,TR_ENTRYSTOP|TR_GTC);
brokerCommand(SET_ORDERTYPE,8); //with brokerCommand(SET_ORDERTYPE,2+8);
Lots = 1;
StopFactor = 1;
Stop = 0.1 * contractPrice(ThisContract); //Stop limit at 10% loss
ThisTrade = enterLong(TMF_check_exit_conditions);
I have also tried every combination and sequence I can think of, but I can't get anywhere.
The only thing that happens is that an MKT order is sent with 1Day expiration (no matter if GTC is selected or not, but I believe the GTC is more on Zorro's side and not meant for IB).
If I also add an OrderLimit, when I buy I get a message from Zorro that 0%@ContractAsk was bought, do I get the message because the purchase was not completed on IBs site and only the order was sent to IB? Because normally for the 0% the Lots*Multiplier should be displayed, so it says 100@ContractAsk.
I have also tried to send an order using the brokerCommand(SET_ORDERTEXT ,"STP/"), but the problem is that I cannot send an additional stop value.