Interactive Brokers - bracket order problem in Java

Discussion in 'Automated Trading' started by elitetradesman, Sep 7, 2012.

  1. As far as I know, the only way to place a bracket order is by calling EClientSocket.placeOrder() with a parent order and then immediately calling the same method with a child order along with the parent order's ID.

    I noticed that if the parent order is immediately executed, the child order gets rejected for some reason. Is there any way to work around this?

    Thank you
  2. robbob


    The problem is that your parent order is getting executed before the child order makes it to TWS. To get around this set the "transmit" flag on the parent order to false. Also set this flag to false for your child orders, except for your last child order, which should be set to true. So for example if you are sending a market order to open a position and a stop loss and limit child orders, set the initial order to transmit=false, the stop loss order to transmit=false and the limit order to transmit=true. This will prevent the first 2 orders from being execute before the last order is submitted.