Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IB Gateway

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    IB Gateway

    I want to share my knowledge how to connect NT with Interactive Brokers "IB Gateway".
    It is not a "supported" way, but it works. The advantage is, that one don't get disconnected every 24 hours. IB Gateway runs leaner and more stable than TWS. That is important if you use NT to run autotrading strategies through IB.

    How to connect to "IB Gateway"

    1) Download and install TWSStart (http://twsstart.free.fr/) If you also use TWSStart to run and monitor TWS, create a new installation folder for TWSStart that runs IB Gateway (eg. "TWSStart - IB Gateway")
    2) In Ninjatrader set up a new connection called IB-Gateway. Use Interactive Brokers as Provider. Set the port to 4001 and use client id 1.
    3) In TWSStart go to "Startup Settings". Use "SDH Alternate 1" as data handling method and type in your user name and password.
    4) In TWSStart go to "Monitor Settings". Enable "Monitor Connection". Host 127.0.0.1 , Port 4001, Client ID 123 (or any other than the one you use in your NT connection)
    5) In TWSStart go to "Java Settings". Enable "Start IB Gateway".
    6) In TWSStart go to "External Programs". Configure the start of "IBGW4NT7.exe" from your TWSStart folder.You find the file in the TWSStart folder you created in step 1.
    7) Go to "Load TWS" in TWSStart and click on "Run".
    8) Start NinjaTrader and connect to "IB Gateway".

    #2
    Moon, Thanks a LOT.
    I was just about to ask the question of, if all we're need TWS is to connect to IB, what's the minimum to load instead of the bloated TWS'?

    You've saved my, and most likely many others' day!

    Comment


      #3
      Second User

      Additional tip: If you want to use IB-Gateway and TWS simultaneously, you need to create a second user in IB account management.

      Comment


        #4
        Thanks Moon.

        This link may also useful:
        This video shows how to start the Interactive Brokers IB Gateway using TWSSTART, "Auto Login" into IB Gateway, the automatic start of of Ninja Trader 7 after...

        Comment


          #5
          Originally posted by moon_121 View Post
          Additional tip: If you want to use IB-Gateway and TWS simultaneously, you need to create a second user in IB account management.
          It is too bad they make this so hard. I have gone in a different direction because I don't want to use yet another application. Instead I now run the IB gateway on a linux machine, and have my windows machine connect to the linux machine gateway. I don't need TWSStart to do this.

          I don't know why on Windows you have to either start TWS with the gateway or else use the TWSStart workaround. If they just didn't have TWS time out or if the gateway could be started independently, as it can on linux, then this would be much easier.

          Comment


            #6
            Program

            if the gateway could be started independently, as it can on linux, then this would be much easier.
            You should be able to start IB Gateway independently on a Windows machine. Here is the code how my IB-Gateway is started:
            Code:
            C:\Windows\System32\javaw.exe -cp jts.jar;hsqldb.jar;jcommon-1.0.12.jar;jhall.jar;other.jar;rss.jar -Dsun.java2d.noddraw=true -Xmx768M -XX:MaxPermSize=128M ibgateway.GWClient C:\Jts
            But anyhow, you would not be able to connect NT with the gateway, because it expect different window name for the program. Since it does not recognize the gateway window NT starts the TWS application.
            TWSstart simply changes the window name of IB-Gateway to fake NT into believing it connects to TWS instead of IB-Gateway.
            Ninjatrader should be able to fix this easy in an update. Frankly I am puzzled why this did not happen already.

            Comment


              #7
              My experience has been, use virtualbox to create a 1G (yes 1G) linux VM. Run IB on the VM takes less than 400M of ram and 10% of CPU. and It's always running, provided VM is also on of course.
              If you need UI access to IB account, run TWS on linux is also much resource-friendly.
              All you NT can now connect to either the IB or TWS.

              Comment


                #8
                Thanks for sharing all of your experiences and knowledge with everyone.

                I would just like to let everyone know that we have created a unique ID to track this suggestion to be able to connect IB TWS via the IB Gateway API and it is # 641.

                Happy to be of further assistance.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  what more to do to make it happen? NT 7 already support connections to IB gateway, just change the port #.
                  Otherwise there's no difference at all.

                  Comment


                    #10
                    Hello,

                    how can i connect my NT7 to IB gateway?
                    What portnumber do you use, has anyone all the exact settings? I'm trying to avoid the twsstart.

                    Regards,

                    Rob

                    Comment


                      #11
                      Ib gateway

                      moon_121. Thanks for this post.
                      i wonder when IB will wake up.

                      Comment


                        #12
                        I have setup TWS Start and just have a short question.

                        When setting up TWS Start in step 3, I need to provide an IB user and password. This is the same as the user and password for my IB-Gateway connection created in step 2 in NT. Right?

                        Thus, I am getting an error when doing step 8 - connecting to the IB Gateway connection from NT since it says that user and password are already connected,

                        Where did I go wrong?

                        Comment


                          #13
                          Originally posted by robje737 View Post
                          Hello,

                          how can i connect my NT7 to IB gateway?
                          What portnumber do you use, has anyone all the exact settings? I'm trying to avoid the twsstart.

                          Regards,

                          Rob
                          Hi Rob,

                          I am the author of TWSSTART and the tool IBGW4NT7 and I just registered to this forum. Your post is old, but I will answer anyway.

                          It's 3 years ago I have written this tool, but not for me. I dont use NT and dont have it anymore. I even can't say if it's still usefull or working.

                          But as I remember, you can use it without TWSSTART. Just start the IB Gateway, login as usual, than start the tool (source code is available if you dont trust the EXE and you want to check the source code and plan to build your own version).

                          All it does is to change the window title so that NT will recognize the Gateway as the Trader Workstation. After that, NT can connect to the IB Gateway.

                          Hope this helps.
                          BeeJay

                          Comment


                            #14
                            Originally posted by roland_nt View Post
                            i wonder when IB will wake up.
                            Why IB? NT7 has to be changed to work with IB Gateway.

                            Comment


                              #15
                              Originally posted by xraptorx View Post
                              I have setup TWS Start and just have a short question.

                              When setting up TWS Start in step 3, I need to provide an IB user and password. This is the same as the user and password for my IB-Gateway connection created in step 2 in NT. Right?

                              Thus, I am getting an error when doing step 8 - connecting to the IB Gateway connection from NT since it says that user and password are already connected,

                              Where did I go wrong?
                              I already answered your email.

                              But look also my answer for Rob. Maybe this is all you need.

                              BeeJay

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by geotrades1, Today, 10:02 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by ender_wiggum, Today, 09:50 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by rajendrasubedi2023, Today, 09:50 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by bmartz, Today, 09:30 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by geddyisodin, Today, 05:20 AM
                              3 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Working...
                              X