IB Bracket Order plus exit at close?

Discussion in 'Order Execution' started by LesterMoore, Apr 19, 2018.

  1. EOD system trader.

    I set up trades in the morning with entry on a stop, then a bracket order to stop out on loss or profit.

    Then I monitor at EOD and if the stops aren't hit, exit at the close or equivalent.

    Would like to get rid of this monitoring at EOD.
    Is it possible to set this additional exit on close as part of the mornings orders? Haven't been able to figure it out.

    I.E. so if the bracket orders are NOT hit, it will go ahead and exit at the close (or time equivalent)?
  2. This is a guess but take a look at the accumulate distribute also. There are position and time conditions that may work for you.
  3. lindq


    Yes, you can. Set your entry with your bracket order as usual. Then create a MARKET order to close the position. Right click on MKT (order type) and select MODIFY>CONDITION. A menu will appear. Click ADD, then select TIME>NEXT. You will then have an opportunity to select a time to trigger your trade. While you can't select Market-on-Close, you can, for example, elect to trigger the trade a moment, or even seconds, prior to the close. When completed, select ACCEPT, and return to TWS. Last step is important. You need to assign an OCA number to this order that matches OCA orders in your bracket order, so if either of your bracket orders fills, this order will be canceled.

    Thus, you will have three open orders, each with a matching OCA number.

    I regularly use a bracket with an additional conditional order, and I've found IB to be very good at filling it. But as with any order, there's always the possibility of some issue, so nothing is ever 100% certain.
    Shadetree42 likes this.
  4. southall


    I recommend creating the parent order, and the 3 child orders using the IB API, so much less error prone.
    I wouldn't want to be creating all those orders by hand, especially for multiple symbols.
  5. Many thanks, I will get into this tomorrow.
  6. Sounds good, but I'm not a programmer in that sense and 3 symbols max. Maybe I'll get some help with the API stuff at some point.
  7. southall


    Thing is if you forget to set the start time on the MKT order it will execute immediately and not at the close! if you do hundreds of these a years, at some point you will make a typo or forget, hopefully that will be on a losing trade and not a big winning one.

    Another way of doing it slightly easier than what linq suggested is as follows:

    After attaching the bracket order, you can attach another profit taking limit order to the parent order, by default TWS seems to give this additional child order the same oca number as the previous bracket order pair, you can then modify this LMT into a MKT order and set the start time field to 16:00:00 or 15:59:59.
    Last edited: Apr 19, 2018
    lindq likes this.
  8. southall


    I been using the start time field for almost 15 years. There was once a bug in a IB software update where the backend fired the MKT immediately and ignored the time i specified.
    Luckily i was watching the orders getting filled that day so i re opened the position manually.
    I reported the bug to IB and they fixed it pretty quick.
  9. lindq


    Yes, been there and done that!
  10. It's too bad US exchanges don't have a funari order type (limit order that automatically changes to a MOC order if unfilled). Would be very handy.
    #10     Apr 19, 2018