Ordertransfer from Ensign to IB

Discussion in 'Trading Software' started by futbee, Feb 2, 2004.

  1. futbee

    futbee

    Hi,

    it is possible, to programm a DLL in Delphi, named ESPL.dll, and communicate from Ensign with ESPL to this dll.
    I will transfer a order from Ensign to IB.
    Is it possible, to connect from the dll to the IB-ActiveX element?
    I've no experience with Delphi and VB.Net will not work with standard-dll.
    Can anyone show an example how to include the IB-ActiveX into the Delphi-dll?

    Thanks
     
  2. croc1964

    croc1964

    Hi,

    you should do it the following way:
    Send the order to the ESPL.dll
    this ESPL.dll then uses the windows messaging system to transfer the order to a program of your choice, which has access to the free IB API.
    I have such a link working from Ensign to FuturesTrader, my IB Frontend (www.futures-trader.net) and it would b no problem to expand this existing link to send an order to FuturesTrader, which then get's executed.

    Contact me at croc1964@futures-trader.net if you are interested.

    Regards,

    Chris
     
  3. The simple interface that allows to send that via Dynaorder is here:
    http://www.dynaorder.com/3rdparties.asp

    It is created by our user for usage with Ensign and to execute the orders in IB (or any other compatible broker) via Dynaorder.
     
  4. rwk

    rwk

    I use Delphi with IB's TSWAPI, but use Ross Hemingway's socket component (http://www.hhssoftware.com/iabsocketapi/), not ActiveX. I have used ActiveX to access the TC2000 database. Accessing ActiveX in Delphi was a bit daunting at first, because it is not very well documented. It can be done, but I don't recommend it for TSWAPI, since there is a much better way.

    In answer to your original question: yes, I think so.

    [Richard]
     
  5. futbee

    futbee

    Thanks for the very important input. It shows several ways. I will test it, and when I have further questions, I'll come back.


    futbee
     
  6. futbee

    futbee

    I've tested the following in Delphi:
    library ESPL;
    uses
    TWSLib_TLB;

    function DLL(sTicker: shortstring; var dllfunction,nLast,nLastsize,nBid,nBidsize,nAsk,nAskSize,nVolume: variant): variant; stdcall;
    var
    tws: TTws;

    begin
    try
    tws.connect('',7496,3);
    DLL:=0;
    except
    DLL:=1;
    end;
    end;

    exports
    DLL;
    begin
    end.

    After compiling, I get the error: "tws might not have been initialized.
    Then I create an Application instead a DLL, it will work and connect to the TWS. How must I initialize this object in DLL's?

    Can anyone help?
     
  7. croc1964

    croc1964

    I have added a trading language extension in Ensign ESPL, which transmits orders generated in Ensign by Alerts or by your own ESPL procedures to FuturesTrader, my own IB frontend and Simulator, for execution. (www.futures-trader.net/Ensign.htm)

    Define your strategy in Ensign, define the entry points and (if you like) exit points or let FuturesTrader handle your exit.

    Then run playbacks to see whether you will be profitable or not.
    For me seeing the charts unfold in realtime, seeing where I'm in or out of the market, knowing exactly whether I would be able to handle a certain drawdown or not, is the only way to backtest a system, which is designed to trade futures.

    For Ensign IB users, who can only use ES, NQ and YM data for backtesting, as Ensign only has these for download, FuturesTrader is now writing the necessary Playbackfiles as well.

    Chris