My strategy creates, at a certain time and for a certain stock, 2 opposite orders. It's a breakout strategy that work in both directions.
Both sides have 3 orders:
The Long Entry order (STP LMT).
+ Long Stop order (STP) bracketed to the Long Entry order
+ Long Target order (LMT) bracketed to the Long Entry order
The Short Entry order (STP LMT).
+ Short Stop order (STP) bracketed to the Short Entry order
+ Short Target order (LMT) bracketed to the Short Entry order
Both the long and short brackets work great on their own. They keep in sync with fills and cancel each other when needed.
My strategy doesn't permit to "reverse". Once a side is filled the opposite site is canceled.
Currently I do this in code. If the Long Entry order is filled (with at leased 1 share) then the Short order is canceled (the bracket orders get canceled automatically).
This works but it is a 'risk' factor. My application needs to be connected with TWS & TWS with the server @ IB). If I lose my connection or TWS or my app crashes or gets closed the orders don't get canceled.
I would like to cancel the opposite order in TWS (using order parameters).
But is this possible?
Both sides have 3 orders:
The Long Entry order (STP LMT).
+ Long Stop order (STP) bracketed to the Long Entry order
+ Long Target order (LMT) bracketed to the Long Entry order
The Short Entry order (STP LMT).
+ Short Stop order (STP) bracketed to the Short Entry order
+ Short Target order (LMT) bracketed to the Short Entry order
Both the long and short brackets work great on their own. They keep in sync with fills and cancel each other when needed.
My strategy doesn't permit to "reverse". Once a side is filled the opposite site is canceled.
Currently I do this in code. If the Long Entry order is filled (with at leased 1 share) then the Short order is canceled (the bracket orders get canceled automatically).
This works but it is a 'risk' factor. My application needs to be connected with TWS & TWS with the server @ IB). If I lose my connection or TWS or my app crashes or gets closed the orders don't get canceled.
I would like to cancel the opposite order in TWS (using order parameters).
But is this possible?