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

Strategy Disabled

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

    Strategy Disabled

    I see at times when there is an error on a running strategy it shuts itself down. And I am left with a double position. Is there a way in Ninja Trader to not let that happen? Like if there is an error and an order did go through maybe the strategy can just flatten the positions opened too before or just after disabling itself?

    And to restart you have to open the Strategies Box. Is there a way to right click and then go to Strategies and enable it that way too? Maybe a suggestion.

    Thank you.

    #2
    Hello Trader17,

    By default, NinjaTrader 8.0.21.1 will submit orders to exit any position opened by the strategy when disabled due to an error with the RealtimeErrorHandling.StopCancelClose option.


    You can submit orders to flatten the account in OnStateChange when State is State.Terminated.


    You can choose to keep a strategy running with RealtimeErrorHandling.IgnoreAllErrors.

    Strategies can be enabled by checking the Enabled checkbox in the strategy parameters when opening the Strategies window from a chart.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks. I am still on version 19.1 so need an update. So then maybe in the future a suggestion to re-enable the strategy by right clicking on the chart instead of opening the box and enabling from the box? Or maybe another quicker way? Where do you set the IgnoreAllErrors? In the script or there is a box to check in the Strategies Window?
      Thanks a lot.

      Comment


        #4
        Hello Trader17,

        The quickest way to enable or disable is to check the Enabled checkbox on the Strategies tab of the Control Center.

        RealtimeErrorHandling is set in the code in OnStateChange when State is SetDefaults or Configure.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello Trader17,

          By default, NinjaTrader 8.0.21.1 will submit orders to exit any position opened by the strategy when disabled due to an error with the RealtimeErrorHandling.StopCancelClose option.


          .
          Thanks. I downloaded version 8.0.21.1 just now. So when you say in that version by default it will submit orders to exit any position opened by the strategy just before being disabled, is this a setting I am supposed to set somewhere? I want to make sure if the last operation was an error for some reason the strategy corrects itself and then goes on to take the next setup.

          Thanks.

          Comment


            #6
            Hello Trader17,

            The close strategy position action is part of the RealtimeErrorHandling.StopCancelClose which is used by default.
            "Defines the behavior of a strategy when a strategy generated order is returned from the broker's server in a "Rejected" state. Default behavior is to stop the strategy, cancel any remaining working orders, and then close any open positions managed by the strategy by submitting one "Close" order for each unique position."
            https://ninjatrader.com/support/help...orhandling.htm

            If this is being changed, set it in State.Configure to ensure this is the setting on the current instance.

            Let me know if you find any issues with the strategy closing its opened positions.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thank you. I will keep an eye on it. Because sometimes the strategy disables itself but I am left with an open position usually twice of the contracts traded. I think I might need to name them individually too.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Haiasi, 04-25-2024, 06:53 PM
              2 responses
              17 views
              0 likes
              Last Post Massinisa  
              Started by Creamers, Today, 05:32 AM
              0 responses
              5 views
              0 likes
              Last Post Creamers  
              Started by Segwin, 05-07-2018, 02:15 PM
              12 responses
              1,786 views
              0 likes
              Last Post Leafcutter  
              Started by poplagelu, Today, 05:00 AM
              0 responses
              3 views
              0 likes
              Last Post poplagelu  
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,408 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Working...
              X