Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Interactive Brokers API restart and NT8 autmated trading

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

    Interactive Brokers API restart and NT8 autmated trading

    Hi all,

    I've been using IB API and NT8 for automated intraday trading since April, and as we all know there are a few issues (which I will adress one by one in later posts)

    One issue is the daily restart of IB servers which ist between 05:45 and 06:45 here in europe. I've been struggling to find a way to find a workaround that really works.
    Usually, the strategies are terminating it selfs due to data feed outage between that time. So, what have I've done to work this out.
    1) I've implemented send email in case of data feed loss and also on strategy termination. Which helps to restart everything by hand.

    2) I messed around with the runtime setting:

    // Important automated strategy runtime settings if connection is lost
    RestartsWithinMinutes = 60;
    NumberRestartAttempts = 60;
    DisconnectDelaySeconds = 600;
    ConnectionLossHandling = ConnectionLossHandling.Recalculate;

    is that runtime setup right or could it be improved for the restart case?
    Goal is that the strategy does not terminate itself during IB restart hour

    3) I'e created a new trading hours template which excludes that hour. Therefore I've created 2 session per day. the 1st one is from (UTC-6) 17:00 until 22:45 EOD checkbox unchecked and 2nd one from 23:45 until 16 with EOD checkbox checked (that should cover the CME index futures like ES-mini).
    But in the backtest I can see that the strategy closes the position at the end of the 1st session and also at the end of the 2nd. But I would like to remain the a position open during that hour and only close at the real end of day. Any sugesstion here?

    I hope somebody can lead me in the right direction how to overcome that frustrating situation.
    Cheers




    #2
    Hello fernlicht,

    Thanks for your post.

    Are you having issues having the connection re-establish, or just with the strategy disabling?

    Can you confirm which version of TWS/IB Gateway you are using?

    The current version of NinjaTrader 8 is Release 23.2 and the version of TWS/IB Gateway we recommend is version 978.2c. This can can be downloaded from our Connection Guide, linked below.

    Connection Guide - https://ninjatrader.com/ConnectionGu...nnection-Guide

    Update NinjaTrader - https://ninjatrader.com/PlatformDirect

    I have run a test last night keeping NinjaTrader connected to IB Gateway, and I had my IB Gateway reset time set to 11:30PM MST.

    If you are having issues reconnecting to your IB account on the latest version of NinjaTrader 8 and with TWS/IB Gateway 978.2c, could you share your Lock and Exit Settings in TWS/IB Gateway? I may also ask that you email me at platformsupport [at] ninjatrader [dot] com with the text "Attn Jim 2909847" and a link to this thread. Please also have a look at your IB Gateway logs to look for server related messages like: "cdc1.ibllc.com = Chicago" which may indicate something specific involving one of IB's servers.

    As long as the connection can be maintained/reconnected, and we use Keep Running along with a large number for Disconnect Delay Seconds, the strategy will not disable and will resume its position after the connection is restored.

    We look forward to assisting.

    Comment


      #3
      I have the restart working well for one instance of Gateway, but the second Gateway connection restarts but the icon remains red for that particular connection. Any ideas why this might be?

      Comment


        #4
        Hello elliot5,

        It would be good to note if the server is different in the IB Gateway log for the connection that did not fully establish. I have seen one case where this was attributed to a Chicago server vs.a New Jersey server.

        Is this failed reconnection reproducible when you set your own restart time, or is this seen only seen when IB restarts their servers? (This would be set in IB Gateway under Lock And Exit)

        I would also like to have you test an internal build that has a change made to make reconnecting to Interactive Brokers smoother. Please reach out to me at platformsupport [at] ninjatrader [dot] com with the text "Attn Jim 2909847" and a link to this thread so we can test further with this build.

        I look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        77 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        45 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        27 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        62 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X