How can I automatically setup IB Gateway with Ninjatrader 7

Discussion in 'Trading Software' started by warcious, Aug 10, 2015.

  1. warcious

    warcious

    Good day everyone,

    I have established an VPS online and would like to run Ninjatrader 7 together with IB Gateway (from Interactive Brokers), instead of using TWS (main IB trading platform).

    I have tried IBcontroller and TWSstart and I have not come very far to be honest.

    Ninjatrader 7 is setup to work with TWS only, so there is a workaround to first connect to your IB Gateway using your regular account, then connect through Ninjatrader to TWS using edemo acccount and then disconnecting TWS. This way Ninjatrader stays connected to IB through IB Gateway.

    TWSStart:
    I have not figured out how to setup the "External programs" so they are run automatically.

    IBcontroller:
    Ok, I have set it up to start up IB Gateway automatically, but how do I make Ninjatrader 7 connect to it in an automated fashion.

    Is there anyone out there that is using Ninjatrader 7 together with IB Gateway and has it setup so it starts automatically every time the boot up their machine?

    Sincerely,
    Warcious
     
  2. RedDuke

    RedDuke

    In gateway settings follow the same steps to enable API as if TWS. Then add your machine IP address into allowed IP address within gateway settings, and all will work. I have it running for a while this way.
     
    NGtrader likes this.
  3. warcious

    warcious

    Thanks for reply RedDuke.
    I added my machine IP to the API settings inside IB Gateway.
    Then i setup a new connection within NT for Interactivebrokers, only difference is that I am using port 4001 instead of 7496. But, NT still starts TWS instead of IB Gateway from inside NT.

    And I get error message,see picture below:
    Untitled.png

    How did you set it up?
    Do you use IBcontroller or TWSstart?
     
  4. RedDuke

    RedDuke

    You first need to open and login to gateway before launching NT IB connection.
     
    NGtrader likes this.
  5. warcious

    warcious

    RedDuke:

    1. I am starting IB Gateway first, I have added myip into the API settings for IB Gateway based on the IP adress I get online from: http://whatismyipaddress.com/
    2. I have configured the IB connection inside NT, with port 4001, same as IB Gateway are using.
    3. I start IB Gateway and then NT.

    Problem:
    NT still tries to start TWS when I try to start up the IB connection inside NT.
    WHY is NT trying to start TWS instead of just connecting through the already started IB Gateway?
    Do you use all this together with TWSstart or just IB Gateway and NT?
     
  6. RedDuke

    RedDuke

    upload_2015-8-17_10-40-9.png
     
    NGtrader likes this.
  7. RedDuke

    RedDuke

    upload_2015-8-17_10-40-53.png
     
    NGtrader likes this.
  8. RedDuke

    RedDuke

    These are how it needs to be configured.
     
  9. warcious

    warcious

    Now it finally worked, grateful to your help RedDuke. Many thanks!
     
  10. warcious

    warcious

    Final question:
    How do you automate this on a VPS if NT, IB Gateway or even the VPS crashes?
    DO you use any script or has it always worked well for you starting IB Gateway and NT manually?

    Can it be automated somehow?

    Maybe we need TWSstart for this automation?
     
    #10     Aug 17, 2015