IB API Questions

Discussion in 'Automated Trading' started by jeffreykr, Nov 19, 2005.

  1. Choad

    Choad

    This YHOO group used to have free code files to help you get started:

    http://finance.groups.yahoo.com/group/TWSAPI/messages

    But if you don't need to, for example, calculate indicators intraday maybe you could use the TWS "conditional" orders based on price levels of other securities/indices, or whatever. I haven't experimented with that tho. If you only have a few setups to type in each day, then maybe you don't need API automation, considering the TWS system?
     
    #11     Nov 19, 2005
  2. TickJob

    TickJob

    Does the TWS "conditional" order allow something like this:
    1. enter market order, set Stop Loss(SL) at P1, set take profit(TP) at P2.
    2. if SL, enter market at P3, set SL at P4, set TP at P5.
    3. if TP, enter market at P6, set SL at P7, set TP at p8.
    repeat 2-3 for many many different price levels P9, P10, P11.......
     
    #12     Nov 19, 2005
  3. Choad

    Choad

    Hmmm, not sure if it will do what you want but it looks pretty powerful (user guide - Ordertypes--->Advanced Order Types):

    http://www.interactivebrokers.com/php/webhelp/webhelp.htm

    Order Ticket Window - Conditional

    A conditional order is an order that will automatically be submitted or cancelled ONLY IF specified criteria for one or more defined contracts are met. You can use stocks, options, futures or security indexes to trigger a conditional order.



    To create a conditional order

    Select an order management line.

    From the right-click menu, select Modify and then select Condition.

    From the Conditional tab on the order ticket click Add Condition.

    Enter contract information for the contingent asset in the Conditional Order box.

    Enter the trigger information for the contingent asset:

    Select the trigger method.

    Select whether the price of the contingent asset should be less than or equal to (<=) or greater than or equal to (>=) the trigger price.

    Enter the trigger price.

    NOTE: If you select the double bid/ask trigger method, the greater than or equal to operator (>=) will use the BID price and the less than or equal to operator (<=) will use the ASK price.

    Click OK. The condition appears in the Current Conditions list.

    To set multiple conditions, use the Add Condition button and click AND or OR in the Current Conditions area.

    Field/Button
    Description

    Add Condition
    Invokes the Conditional Order entry box.

    Delete
    Deletes the selected condition.

    Modify
    Opens the Conditional Order entry box for the selected condition to allow you to make changes.

    Allow condition to be satisfied...
    Lets the selected condition activate the order if it is satisfied outside of regular trading hours.

    Action to take...
    If selected conditional order is satisfied, you can elect to have the primary order submitted OR cancelled.
     
    #13     Nov 19, 2005