- ago

Find open orders for a symbol and close them using IB.
Is it possible to find open orders for a symbol and close them with IB? I may have more than one symbol with open orders.

My program uses limit order to enter open or short.
If order executes, then stop order is placed
stop order is adjusted base on algorithm
IB replaces existing stop order with new stop order (seems to work well)
stop order executes

I want to do

If order executes, the stop order is place plus a limited order based on custom ATR
both orders will be adjusted based on algorithm.
IB will need to replace both orders as algorithm adjust stop and limit price
If either order executes, then cancel the other open order

If it is not possible for this too happen, then I can use HasOpenPosition and if false, then send a cancel open orders for a symbol. I would probably want to do this anyway to ensure open order was cancelled and API or market timing did not leave in undesired state.

Given stop order works perfectly with IB, then I can have the program cancel a limit order and then place a new limit order if IB can not handle automatic replacements of limit orders.

I still need to be able to cancel open orders if no position is open. Ideally within 2 trading bars.
0
812
Solved
1 Replies

Reply

Bookmark

Sort
- ago
#1
One Cancels Other orders have been added in WL7 Build 18. Look for the option in Trading Preferences. It's covered in this build highlight video:
https://www.youtube.com/watch?v=mzHssTClrG8&t=610s
0
Best Answer

Reply

Bookmark

Sort