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

My server restarted and my strategy did not stop

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

    My server restarted and my strategy did not stop

    I am using strategy builder.

    My server decided to restart in the middle of the night and I had a strategy running. omg

    I restarted NT8 and connected the data, and realized an order was still open.
    I restarted the strategy, I waited 5 minutes and It did not close the order as it should.

    what can I do to prevent this?

    I can start NT8 on server restart and even connect the data feed

    but how can I restart the strategy?
    does it recalculate?

    how can I automatically close any open positions after my server restart?

    how can NinjaScript properties, On connection loss, help me?

    do you know how can have my server email me after a restart?

    #2
    Hello AaronKoRn,

    Thank you for the post.

    I restarted the strategy, I waited 5 minutes and It did not close the order as it should.
    what can I do to prevent this?
    What start behavior was being used? Without knowing what you made it would be difficult to say what should have happened in that situation. It is also possible that due to the shutdown that the strategy order was not saved or could not be seen as a previous strategy based order upon restarting.

    If the restart was unexpected it would generally be best to manually manage the account back to flat to ensure the next time you start the strategy it can begin working fresh.



    I can start NT8 on server restart and even connect the data feed

    but how can I restart the strategy?
    does it recalculate?
    A strategy cannot be auto started, NinjaScript strategies require manual starting.
    The platform also by nature does not have an auto start feature, it is intended to be manually started in the case of restarting the system. While you can use windows automation to auto start applications and NinjaTrader does have an auto connect feature there is no auto start strategy feature.

    how can I automatically close any open positions after my server restart?
    As mentioned there is no auto start/auto enable strategy features. Starting is intended to be a manual process and a point in time to manually manage the account as needed. To auto close positions on a restart would require custom scripting. An addon could be used to work with the account and close positions that are open. An addon can also be used for trading and would not necessarily need to be started like a strategy.



    how can NinjaScript properties, On connection loss, help me?
    The NinjaScript properties for connection loss are what happens during a connection event. These would not have been used in your current described case as the whole computer restarted. For general connection losses these properties delegate what is considered a connection loss and how strategies are either recalculated or not when that is detected. If recalculated the start behavior is run and based on the start behavior and how your script is programmed and open orders or positions may be resumed or cancelled/closed.

    do you know how can have my server email me after a restart?
    I don't know if your server can do that, you would need to reach out to your web host to see if that is a service they provide. You would otherwise need to write some kind of script to do that yourself and implement it as a startup item on your server. That would be outside of what our support can help with but you can likely use google to search for related topics. "server email on startup".

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      omg, I was afraid you would say that.

      A server restart is the worst thing that could happen.

      amazing answers, thank you so much

      Comment


        #4
        I am currently looking for a way to automatically restart a strategy after the CQG cuts on Fridays. I came across this issue and I think a functionality should be added to Ninjatrader that fixes this.

        VPS usually provide 99% uptime. But the resets for updates do happen. If they do it with an open position in a strategy, that position would be totally exposed if this does not happen:
        - Start Ninjatrader at windows startup
        - Restart strategy
        - Synchronize strategy

        So, I think there is a big missing in the point "restart strategy". I think it would be possible to get an auxiliary application where the "click" to start the strategy is automated. But this should be an established functionality in Ninjatrader. And by the way, schedule a strategy reboot every Sunday (to avoid CQG outages), I think I saw a vote on this issue somewhere.
        Last edited by rocker84; 10-28-2021, 08:43 AM.

        Comment


          #5
          Hello rocker84,

          Thank you for the post.

          I will add your vote for the ability to auto restart strategies

          Please let me know if I may be of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ScottWalsh, Today, 04:29 PM
          0 responses
          4 views
          0 likes
          Last Post ScottWalsh  
          Started by rtwave, 04-12-2024, 09:30 AM
          2 responses
          21 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by tsantospinto, 04-12-2024, 07:04 PM
          5 responses
          69 views
          0 likes
          Last Post tsantospinto  
          Started by cre8able, Today, 03:20 PM
          0 responses
          7 views
          0 likes
          Last Post cre8able  
          Started by Fran888, 02-16-2024, 10:48 AM
          3 responses
          49 views
          0 likes
          Last Post Sam2515
          by Sam2515
           
          Working...
          X