Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error Live: unable to re-establish the connection (panic)

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

    Error Live: unable to re-establish the connection (panic)

    Hey All,

    So I am running 2 strategies on futures on 2 sub account.

    In code I literally have set: ConnectionLossHandling = ConnectionLossHandling.KeepRunning;

    I even tried: options -> strategies -> on connection loss -> handling -> recalculate -> number of attempts set to 1000.
    Click image for larger version

Name:	image.png
Views:	218
Size:	26.9 KB
ID:	1342784

    But still the following thing happens every bloody weekend with the "hard disconnect" from ninjatrader service.​

    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost order connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost order connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost order connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost order connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost price connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost price connection but will keep running.
    Strategy 'MWFuturesLiquidityScalper/356251754' lost order connection but will keep running.
    Strategy 'MWFuturesOpeningRangeGap/356251755' lost order connection but will keep running.
    Disabling NinjaScript strategy 'MWFuturesLiquidityScalper/356251754'
    Disabling NinjaScript strategy 'MWFuturesOpeningRangeGap/356251755'​
    Click image for larger version

Name:	image.png
Views:	248
Size:	3.3 KB
ID:	1342782
    Ninjatrader is the brokerage live connection.
    Question 1: How do I make sure I can keep this strategy running 24/7 and that it reconnects automatically again.
    Question 2: Is there a way I can test that it keeps running?

    I am going on Holiday and want to keep my strategy at my home pc on and am not in the mood to setup remote access when this should be working?

    In advanced, hopefully you can help me out, and thank you a lot!​
    Attached Files

    #2
    Hello mw_futures,

    Thanks for your message.



    First, ensure that ConnectionLossHandling = ConnectionLossHandling.KeepRunning; is being declared under State == State.SetDefaults.

    Also, it is important to understand that there's a difference between a connection loss and a full disconnect.

    If a connection loss occurs, NinjaTrader will attempt to automatically reconnect and resume the strategy based on your script parameters, depending on the connection loss handling settings.

    However, a full disconnection will not attempt to reconnect and will result in the strategy being disabled. Unfortunately, there is no workaround for this behavior.

    I do suggest you increase the 'Number of restart attempts' and 'Restarts within x minutes'.




    A connection state between NinjaTrader and your broker/market data vendor is not dictated by the NinjaTrader Desktop application. The NinjaTrader application only reports the connection state as it is reported by the API you are connected through.

    NinjaTrader behaves like a radio receiver in that it receives signals from the connected server. If the signals are not coming through, the underlying broker/market data vendor connection adapter reports this to the NinjaTrader application, which in turn reports this back to you. Once a loss of connection is reported, the connection adapter will continuously try to re-establish a connection.


    NinjaTrader is sensitive to latency. While other applications are able to connect to the internet, it is still possible to experience disconnections if the connection slows. Many other applications do not receive a steady stream of data and do not require a steady connection, and are not affected by latency.



    Common reasons that contribute to connection stability are:
    • Distance from local computer to the connection servers
    • Connection through a mobile hotspot (high latency)
    • Connecting through Wifi (connecting wirelessly contributes to latency)
    • Using a VPN (Virtual Private Networks may have a much lower bandwidth and will also contribute to latency)
    • ISP issues such as unstable latency
    • Hardware firewall changing IP addresses frequently
    • Dynamic IP addresses changing frequently intra-day.
    • (Usually this happens once a week but you may want to check with your ISP. If they do change daily, requesting a static IP address may help.)

    ​To troubleshoot this, I recommend the following steps:
    • Unplug your internet modem, and (if a separate device) router for at least 60 seconds, and also restart the Computer
    • Ensure exceptions have been added into any firewall/antivirus/backup programs for the (My) Documents/NinjaTrader 8 folder
    • Ensure you are using the latest release of NinjaTrader
    • https://account.ninjatrader.com/welcome-download
      • (Currently 8.1.4.2)
    • If you are not already and the option is available to you, I highly recommend connecting to the internet using an ethernet cable. Wireless connections are significantly more unreliable
    • Ensure that your computer is not allowed to sleep (enter standby) or hibernate
    • Ensure that your computer is not turning off your Network Adapter to conserve power:
      • Right-click on your Start button
      • Select 'Device Manager'
      • Expand 'Network Adapters'
      • Right-click on your Network Adapter and select Properties > Power Management
      • Uncheck 'Allow the computer to turn off this device to save power' option
      • Click 'OK' to save the changes
      • Do this for all Network Adapters
    • Disconnect from a VPN if connected (Virtual Private Network)
    • Clear your DNS
    • If the above steps do not help, contact your ISP and let them know you are experiencing a highly unstable connection. An issue of connectivity may exist on their end
    • If your ISP is unable to resolve the issue from there, consider looking into a Virtual Private Server (VPS) to run NinjaTrader on. This will provide a strong and uninterrupted connection to the appropriate data servers

    Feel free to reach out with any other questions or concerns.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    110 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    59 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    37 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    41 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    78 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X