I am trying to implement program trading with EFS and Interactive Brokers.
Everything runs fine, except close-and-reverse orders. IB's TWS seems to have a problem when two orders are issued programmatically right one after another, which is exactly what happens with close-and-reverse orders: first, an existing position gets closed, then another trade follows to open a new position. TWS ignores (more often than not) the second order, i.e. it successfully closes an open position, but won't open a new one at the opposite side.
How can I work around this? I imagine, a programmatic delay might probably help. How can I program a delay with EFS?
Thanks in advance!
Everything runs fine, except close-and-reverse orders. IB's TWS seems to have a problem when two orders are issued programmatically right one after another, which is exactly what happens with close-and-reverse orders: first, an existing position gets closed, then another trade follows to open a new position. TWS ignores (more often than not) the second order, i.e. it successfully closes an open position, but won't open a new one at the opposite side.
How can I work around this? I imagine, a programmatic delay might probably help. How can I program a delay with EFS?
Thanks in advance!