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

Why disconnects occur and how a strategy should manage them

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

    Why disconnects occur and how a strategy should manage them

    Hello.

    I have been developing strategies using Market Replay for more than a year and everything works as I wish.

    But when I put them to work in real time with a simulated account, various disconnection problems began to appear that I had obviously not encountered until then.

    These problems have sometimes restarted my strategies (which is already a problem for me) and sometimes they have disconnected my connection and it has stay disconnected until I have noticed it and had to restart it manually, which is already a disaster .

    I attach screenshot of each of the different cases of disconnection suffered and I beg you to provide me with both an explanation for each of them and the way in which my strategists should manage that disconnection so that they do not restart and that the connection does not stay disconnected:

    Type 1 disconnection (2 examples): Strategies are deactivated (apparently because the primary connection is lost) and restarted when that primary connection recovers.

    Type 2 disconnection (2 examples): The primary connection disconnects causing a logoff and remains disconnected for life until it is manually started again.

    I have already looked at several forums before writing this Post, and I anticipate telling you several things:

    1.- The computer that runs Ninja Trader is a virtualized machine in the cloud with a professional provider that guarantees that it is turned on 24 hours / day and with an uninterrupted internet connection. I mean therefore that it is not a problem of the ISP, neither of the firewall nor of the IP, since that computer has a static IP.

    2.- In the network adapter of that machine, the option "Allow the computer to turn off this device to save power" was NOT disabled. Obviously I have already activated it to work from now on, but in principle it is difficult for me to think that this is the cause, since for said device to be turned off by Windows, the traffic must be null for too long, which is highly unlikely on a card network.

    3.- Control Center's Tools> Options> Strategies menu is "Recalculate" and NOT "Keep Running" and "Disconnect Delay Seconds" is set to 10. I understand that it would be advisable both to increase this time and to set the management to "Keep Running", but I would like you explain to me well how both these options and the other two relating to "Number of starts attempted" and "Restart in x minutes" works to acquire a complete knowledge of disconnection management.

    Finally, I would like you to explain to me how I can avoid the following behavior:

    1.- A strategy is started
    2.- This strategy launches 3 orders: 1 to set a Stop Loss, another to set a Profit Target and another to make a purchase.
    3.- Strategy is deactivated (manually or due to the aforementioned connection losses)
    4.- The strategy is activated again (manually or automatically after recovering the connection)
    5.- The buy order is kept as there are open positions BUT THE STOPLOSS AND PROFIT TARGET ORDERS ARE AUTOMATICALLY CANCELED by Ninja Trader, which is a disaster for me.

    How can I make sure that such orders are not canceled?

    Note: I am using Ninja Trader 8 version 8.0.24.2 64-bit.

    Thanks in advance.

    Attached Files

    #2
    Originally posted by JoseFRS View Post
    Hello.

    I have been developing strategies using Market Replay for more than a year and everything works as I wish.

    But when I put them to work in real time with a simulated account, various disconnection problems began to appear that I had obviously not encountered until then.

    These problems have sometimes restarted my strategies (which is already a problem for me) and sometimes they have disconnected my connection and it has stay disconnected until I have noticed it and had to restart it manually, which is already a disaster .

    I attach screenshot of each of the different cases of disconnection suffered and I beg you to provide me with both an explanation for each of them and the way in which my strategists should manage that disconnection so that they do not restart and that the connection does not stay disconnected:

    Type 1 disconnection (2 examples): Strategies are deactivated (apparently because the primary connection is lost) and restarted when that primary connection recovers.

    Type 2 disconnection (2 examples): The primary connection disconnects causing a logoff and remains disconnected for life until it is manually started again.

    I have already looked at several forums before writing this Post, and I anticipate telling you several things:

    1.- The computer that runs Ninja Trader is a virtualized machine in the cloud with a professional provider that guarantees that it is turned on 24 hours / day and with an uninterrupted internet connection. I mean therefore that it is not a problem of the ISP, neither of the firewall nor of the IP, since that computer has a static IP.

    2.- In the network adapter of that machine, the option "Allow the computer to turn off this device to save power" was NOT disabled. Obviously I have already activated it to work from now on, but in principle it is difficult for me to think that this is the cause, since for said device to be turned off by Windows, the traffic must be null for too long, which is highly unlikely on a card network.

    3.- Control Center's Tools> Options> Strategies menu is "Recalculate" and NOT "Keep Running" and "Disconnect Delay Seconds" is set to 10. I understand that it would be advisable both to increase this time and to set the management to "Keep Running", but I would like you explain to me well how both these options and the other two relating to "Number of starts attempted" and "Restart in x minutes" works to acquire a complete knowledge of disconnection management.

    Finally, I would like you to explain to me how I can avoid the following behavior:

    1.- A strategy is started
    2.- This strategy launches 3 orders: 1 to set a Stop Loss, another to set a Profit Target and another to make a purchase.
    3.- Strategy is deactivated (manually or due to the aforementioned connection losses)
    4.- The strategy is activated again (manually or automatically after recovering the connection)
    5.- The buy order is kept as there are open positions BUT THE STOPLOSS AND PROFIT TARGET ORDERS ARE AUTOMATICALLY CANCELED by Ninja Trader, which is a disaster for me.

    How can I make sure that such orders are not canceled?

    Note: I am using Ninja Trader 8 version 8.0.24.2 64-bit.

    Thanks in advance.
    what start behavior are you using for the strategy?

    Comment


      #3
      Hello JoseFRS,

      Thank you for your post.

      Who is your broker/data provider?

      What is the Start Behavior in use for the strategy?

      Please send me your log and trace files so that I may look into what occurred. Please do not post these directly to the forum as they may contain personally identifiable information.

      You can do this by going to the Control Center-> Help-> Email Support

      Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

      Please reference the following ticket number in the body of the email: 3364482 ATTN Kate W.

      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #4
        I am having similar issues that when I connect to my active account feed, I get
        Connection Lost and maybe 18 seconds later Price feed = Connected.
        Another one the reconnect wad 25 seconds after the lost.

        I have a 900Mhz Comcast Internet feed and a fast computer.

        Comment


          #5
          Hello JGRtrader,

          Thank you for your note.

          The first thing I would recommend doing if you're experiencing connection issues is shutting down NinjaTrader and restarting your modem/router.

          If you have an antivirus/firewall installed you will want to add NinjaTrader to its exceptions list.

          We realize that lost connections can be frustrating. A connection state between NinjaTrader and your broker/market data vendor is not dictated by NinjaTrader. 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 API reports this to the NinjaTrader application which in turn reports this back to you. Once a loss of connection is reported, NinjaTrader or the underlying API will continuously try to re-establish a connection.

          Common reasons that contribute to connection stability are:
          • ISP issues
          • Using a wifi/3g/4g/5g connection rather than a wired connection directly to your modem/router
          • Hardware firewall changing IP addresses frequently
          • Dynamic IP addresses changing frequently intraday. This usually 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.
          • Broker/market data servers may be experiencing temporary downtime
          Please let us know if we may be of further assistance.

          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Thank you Kate,

            The instrument involved is MES, my broker is NinjaTrader and data feed is NinjaTrader Continuum (Live). I have been using the same setup for a long time and have only seen this recently. So I would not think it has anything to do with the firewall. I do use Ethernet cables from my Xfinity Modem to my Ubiquity Amplifi router (several years old) and then to the computer I run live trading on. I will check all of those things if this continues happening. The dropouts are logged so I can see when they occur. At this time I am not doing much live trading but using the Sim101 or Playback accounts. I don't use historical data, at this time anyway.

            The Xfinity internet can dropout. Last year they put in new infrastructure in my area and the raw feed is 900 Mbsbut my router is only good for 200 Mbs which is plenty. Sometimes there is a TV on but no streaming or game playing.

            Sometimes I also run IB TWS independently - no connection to NinjaTrader. It occasionally has dropouts on one of the several servers but a red alert banner from IB appears so those are on their end.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ghoul, Today, 06:02 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            44 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            20 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            179 views
            0 likes
            Last Post jeronymite  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Working...
            X