IB conditional orders in baskets?

Discussion in 'Automated Trading' started by fildi101, Apr 29, 2006.

  1. fildi101


    Hi guys,

    New to the board (though lurking for a while), I;m hoping someone will be able to point be in the right direction..

    I'm running a non-descretionary trading system, using IB. (swing trading, using EOD data only)

    I currently us IB's bracket orders. Each day I calculate buy(or sell) points, stoplosses and price targets, and enter them into TWS as GTC orders before the market opens.

    For each stock I'll want to enter something like this..

    "BUY 100 XYZ at 56.20, with a stoploss at 55.10 and sell limit at 60 (GTC)"

    I enter my entry limit order (long or short), select "attach bracket orders", and enter the stop and limit prices.

    If it doesn't execute that day, I'll often want to keep the order on, but change the prices levels a little for the next day... or sometimes I'll take the order off completely.

    What I'd really like to do is produce a list of these bracket orders and enter them automatically to IB. Since I'm entering orders before the open, which only execute during market hours, I could produce fresh DAY order each day if neccessary, rather than modify GTC orders, if that makes it simpler to implement.

    The problem is, when I look at the basket order page, it doesn't seem to let me enter or modify bracket orders.

    When I save out a page of bracket orders as a basket and reload them the link between the stop/target orders and the parent order are gone. (i.e. they are no longer brackets, so the stop-loss order could execute without ever having taken the postion in the first place...bad)

    Is there a way round this? I'm no programmer, but I could learn if neccessary if the API's could support something like this? Or are there any other IB front-ends that can help me?

    It seems so simple. automatically entering a list of bracket orders each day..... but I can't figure it out..am I missing something obvious? :confused:
  2. ddunbar

    ddunbar Guest

    I don't have access to TWS due to the fact that's it's a weekend, but I believe that instead of using a Bracket order, create an OCA (One Cancels All) group.

    Look at pages 69 and 70 of the following TWS manual:


    The OCA group should save and load where as the basket doesn't.
  3. fildi101


    Cheers for the reply...The OCA group only partially does what I need though.

    It will cancel my target order if I'm stopped out (or vice versa), but it doesn't deal with the issue of only entering the stop/targets to the market AFTER the initial has been filled.

    In TWS I could use conditional order, combined with OCA groups to acheive this, but the basket page doesn't support conditionals either..

    shame about TWS inaccessible at the weekend too. I'd love to be able to enter orders for monday today.
  4. fildi101


    Ah Ahh!!

    Looks like I can do it in Excel, via the DDE. It does support conditional orders! Interstingly the FIX system does too, and also bracket orders, so if I make enough money to pay a programmer, I'll be able to go the sleek route.. :) nice.

    Time to go look at some webinars I think :)

    bless this internet..:cool:
  5. ddunbar

    ddunbar Guest

    Ok,ok, share with the rest of the class.

    How is it done with Excel? :)
  6. fildi101


    Well.. it's not ideal since it Excel needs to be running, to constantly check if the condition has been met, but it's all here..


    I guess I could work it for now by entering my opening orders, and the entering an OCA pair of stop/limit orders once the price of the intial order has been met...

    bit risky, since it won't be checking for execution... then again.. the condition could be more than just a price level.. it could be conditional on a cell in the exectutions report.. hmm.. thinking out loud here, but I guess it could be done..

    I'm pretty new to excel as well I'm afraid( don't laugh, I'm more of a an arty type.. much more familiar with photoshop, so I'm a LONG way from giving a class... :)

    The fact the the FIX system supports genuine bracket orders is appeallng. That's definitely the long term route so I might as well look into that route..I'm actually more familar with C++ form a college course than I am with Excel..

    If I figure it out, I'll keep the thread updated..
  7. ddunbar

    ddunbar Guest

    Awesome. Nice find. I'm going to look into doing something with Excel.
  8. fildi101


    More Ah Ahh!..


    it seems you CAN use the regular APIs as well. The java/C++ and activeX ones include the ParentID parameter in the order function... which should (I think) allow the order to be entered to IB but delayed front he market until the first order fills.... nice!

    Soo... Looks like it can be done on Java.. which is nice. If I spec it right I might be able to get it programmed by some guy in Siberia for $50 off rentacoder.com... neat.

    It's just a real shame the basket orders don't seem to have the same parameter. anyone from IB reading this? :)
  9. mss


    Does anybody use the conditional order feature of TWSDDE.XLS to monitor large numbers of orders?

    If so, does it work well? Do you have to change any of the macros to get the system to work? Are you aware of any alternatives for monitoring several hundred orders at a time and submitting or canceling some based on various conditions? The publicly available API's and order management systems do not seem to have a feature like this. Would it be possible to monitor several hundred orders in Wealth-lab or Amibroker and submit or cancel orders based on several conditions other than just submitting orders when a certain price is reached?