Bracket order only with Stop
Rumen Nenov last edited by
I've got following problem: Stop order is supposed to get cancelled automatically if Limit order is executed (also known as OCO) and position closed. In my strategy I do not use Limit order as my profitable positions are closed by the strategy logic. However, I cannot leave a position without a stop order. If I attach a stop or trailing stop and my trade is closed by the logic of the strategy, the stop order remains active and gets executed later. I need some help. I can't implement this part of the code.
I seem some failing logic here.
- A half-bracket is applied (only main order and stop order)
- main order is executed and stop is activated
- trade opened by main order is closed by a non-related order
- the stop order remains (as expected and as it would happen in real-life) active
It seems pointless to use a half-bracket to open the stop if the functionality of the bracket is ignored.
In any case the bracket code gives you a reference to the orders which are created. When your foreign order closes the trade, you simply have to use the reference you have for the the stop order and call