IB DDE Excel: is it now possible to automate trailing orders

Discussion in 'Interactive Brokers' started by allesim, Dec 10, 2001.

  1. allesim

    allesim

    I am a newbie at DDE Excel programming, but I see a lot of potential in this new possibility nicely provided from IB

    I apologize for my question if it sounds inappropriate, but is it now possible to automate trailing orders using DDE?

    (I know IB is reluctant to accept Trailing Stops...)

    I mean:
    suppose I am long 500 shares of MSFT which now trades at 65.
    Is it possible to create an order, residing on our excel system, which senses quotes (ASK) and periodically issues a racketing STOP order in this way:

    MSFT rises (on ASK) at 66: my Excel will issue (or prompt me to issue) a stop sell order 500 shares at 65.5 (trailing = .5)

    MSFT rises (on ASK) at 66.3: my predefined .3 set-theshold is reached: therefore I wish Excel to refresh my trailing stop:
    now my Excel engine will (automatically)
    - cancel previous stop order
    - issue a new trailing stop order (or prompt me to issue) to sell 500 shares at 65.8 (trailing = .5)

    Please apologize again if this all sounds silly.

    Thanks
     
  2. dozu888

    dozu888

    it sure can be done.

    and it's easier to modify the stop than to cancel old/ recreate new.
     
  3. docarzt

    docarzt Guest

    yes, it is possible.
    Right now I try to do this for trades on a daily basis. I use Visual Basic and Excel to control the trades/orders. At the moment it's just on an experimental basis, but it is possible.

    hopefully IB will add more features to DDE, until now it's not possible to send OCA-orders order GTC-orders. Having access to the accountsize or an option to get all open orders, or even better an option to cancel all open orders would be great.

    doc
     
  4. bennyo

    bennyo Guest

    Yes, it possible. Even from within other programs/languages.
    Just request a tws|ord!idXXX?place?BUY_1_XXXXX_FUT_XXXXX_GLOBEX_MKT_ DDE Field and read the status of tws|ord!id1?status and tws|ord!id1?filled fields.

    But...Does anybody know how to send the account number with the IB Excel DDE link ? When I enter an order IB is giving the following error. It worked before.

    "order cannot be transmitted without specifying the account number". (In TWS online demo version)

    I think they changed the tws program but didn't update the DDE
    documentation

    Greetings
    Benny,
     
  5. rickty

    rickty

    bennyo,
    "Yes, it possible. Even from within other programs/languages.
    Just request a tws|ord!idXXX?place?BUY_1_XXXXX_FUT_XXXXX_GLOBEX_MKT_ DDE Field and read the status of tws|ord!id1?status and tws|ord!id1?filled fields."

    To where does one make the request? That is, how do you
    commuicate with the DDE? Any help will be appreciated.

    Richard
     
  6. I'd like to do this, too. What's a good algorithm for ignoring erroneous spikes in the quotes?
     
  7. rickty

    rickty

    OK since no one is answering my question above, let me ask
    another question: can some one suggest a good reference
    to learn about DDE? My aim is to use VC++, rather than EXCEL,
    to affect data exchange.

    Of course, the best solution would be if IB could provide some
    basic routines in C/C++ which could be used with their DDE DLL.

    Richard
     
  8. The best place is http://msdn.microsoft.com. Go to the "Code Center" and do a search for DDE. Several good examples.
     
  9. MB1708

    MB1708

    bennyo -

    did you resolve the "cannot send order without an account number" problem?

    I get the same error message.

    Regards
    Michael.
     
  10. bennyo

    bennyo Guest

    >>> did you resolve the "cannot send order without an account number" problem?

    No, the problem is still there. When I ever find it, I''ll post it in this thread.

    Greetings
    Benny,
     
    #10     Dec 12, 2001