Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

IB-Interactive Brokers Daily Interruption

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

    IB-Interactive Brokers Daily Interruption

    I am trying to figure out how best to handle situations where Custom NinjaScript Strategies are cancelled due to disconnects from IB in the case where there exists open positions or orders.

    I currently maintain an array of Open Orders, Positions and iOrder objects; I would like to completely recover when restarting my Strategies.

    I thinking of maintaining a copy in a text file which I can input on startup.

    Does NT's database maintain/resync with IB at Connection time?

    If I reconstruct my array from the text file, will the original Tag names and recontructed iOrders be valid?

    Will I get Fill events for any executions that happened during the down time?

    Anything else I should consider?

    Thanks!

    #2
    SteveB,

    What you may want to use is the OnConnectionStatus() to handle the strategy when you lose connection. You could try using RealtimeErrorHandling set to TakeNoAction and then you will be able to manually handle everything within OnConnectionStatus(). Bear in mind there are huge implications with using RealtimeErrorHandling. You will be completely on your own and you should code for every case possible. If your strategy hits something unexpected NinjaTrader will not try to save you with conservative position management actions so use with caution.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Could you provide some details for "every case possible"?

      Thanks!

      Comment


        #4
        SteveB,

        I could not. There are just too many possibilities. You need to be aware of the dangers of using such a method. Everything from overfills to order rejections; you need to handle them in your code. This is why using such a method should only be used if you absolutely know what you are doing.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hello SteveB,

          If you want to go around the daily interruption, you could start TSW via IBController. This program will automatically update the reset time, so you are effectively never being reset.
          I start TWS with a batch file containing:
          java.exe -cp C:\JTS\jts.jar;C:\JTS\pluginsupport.jar;C:\JTS\jco mmon-1.0.0.jar;C:\JTS\jfreechart-1.0.0.jar;C:\JTS\riskfeed.jar;C:\JTS\jhall.jar;C:\ JTS\other.jar;C:\JTS\rss.jar;IBController.jar -Dsun.java2d.noddraw=true ibcontroller.IBController IBController.ini

          The ini file contains the account details.

          This will of course not prevent you from other interrupts.

          Hope this helps

          Comment


            #6
            Originally posted by NT_Rob View Post
            Hello SteveB,

            If you want to go around the daily interruption, you could start TSW via IBController. This program will automatically update the reset time, so you are effectively never being reset.
            I start TWS with a batch file containing:
            java.exe -cp C:\JTS\jts.jar;C:\JTS\pluginsupport.jar;C:\JTS\jco mmon-1.0.0.jar;C:\JTS\jfreechart-1.0.0.jar;C:\JTS\riskfeed.jar;C:\JTS\jhall.jar;C:\ JTS\other.jar;C:\JTS\rss.jar;IBController.jar -Dsun.java2d.noddraw=true ibcontroller.IBController IBController.ini

            The ini file contains the account details.

            This will of course not prevent you from other interrupts.

            Hope this helps
            I just installed this but I'm not sure how you run it. I run the exe but I get a gui app and I can't see how to start TWS. Can you please give me some more details?

            TWS resets on me all the time and often bombs ninjatrader. I was seriously considering switching to another broker because of it but it sounds like ibcontroller will solve my problem.

            Comment


              #7
              Originally posted by cunparis View Post
              I just installed this but I'm not sure how you run it. I run the exe but I get a gui app and I can't see how to start TWS. Can you please give me some more details?

              TWS resets on me all the time and often bombs ninjatrader. I was seriously considering switching to another broker because of it but it sounds like ibcontroller will solve my problem.
              Hello Cunparis,

              I followed the instructions in the readme file, and I cannot remember I had difficulties.

              So you need to update the following 2 fields in the ini-file
              IbLoginId=abcde123
              IbPassword=zz136>=?

              abcde123 is you ib account name (the one you enter when logging on)
              zz136>=? is a password. This is not the password you nomally use, but an encrypted password.

              To get this encryped password, you run the following (in a command box: run cmd)
              java -cp IBController.jar ibcontroller.IBController encrypt <password>
              where <password> is your real IB password.
              The output of this statement is the encrypted password.

              Then run the statement I mentioned in my previous post. Be sure that the ini filename is the same as the one you edited.
              The directory where IB controller sits is C:\IBController
              It expects by default that TWS is installed under C:\JTS
              (again, check the readme.txt that got installed in C:\IBController as well)

              Hope this helps.

              Rob
              Last edited by NT_Rob; 03-24-2009, 04:20 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pibrew, Today, 06:37 AM
              0 responses
              0 views
              0 likes
              Last Post pibrew
              by pibrew
               
              Started by rbeckmann05, Yesterday, 06:48 PM
              1 response
              12 views
              0 likes
              Last Post bltdavid  
              Started by llanqui, Today, 03:53 AM
              0 responses
              6 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              11 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              15 views
              0 likes
              Last Post AaronKoRn  
              Working...
              X