• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disable Strategy

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

    Disable Strategy

    Hello

    On NT7 I could use the Disable() method in order to stop my strategy as if the 'Enabled' check box was checked off by the user. On NT8 that code was changed to SetState(State.Terminated).
    The problem with that is once this code is executed, the 'Enabled' check box is grayed out on the 'Strategies' tab so it cannot be re-enabled (at least when I use historical play back). Is there a way to change this behavior so the check box will still be available?

    Thanks.

    #2
    Hello kiss987,

    Thank you for your note.

    Setting a state to state.terminated is not supported nor recommended.

    I've attached a strategy which uses a public static bool to prevent a strategy from running that you could use as a framework for doing what you'd like to do. The attached file contains a addon which has a button that will stop a strategy from processing.

    Please let us know if you need further assistance.

    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply

      On your sample the strategy is still running, it's just doesn't do anything because stopRunningStrategyBool is set to true. I want the strategy to completely stopped as if the user unchecked the 'enable' check box

      Comment


        #4
        Is there any way to automatically "Check" / "Uncheck" the checkbox for particular strategy in "Strategies" tab? Maybe using some third party tools?

        Comment


          #5
          Hello kiss987,

          This would not be supported but I will add your vote to a feature request tracking this.

          Music_P13, this is not supported but I’ll add your vote to this as well.

          Please let us know if you need further assistance.

          Alan P.NinjaTrader Customer Service

          Comment


            #6
            HI

            is there a way of flatten everything by code instead?

            Comment


              #7
              Hello Kiss987,

              You could see the following methods for flattening everything,

              https://ninjatrader.com/support/help...s/?flatten.htm
              https://ninjatrader.com/support/help...en-us/?closest
              rategy.htm

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Dan_D_Trader, Today, 03:49 PM
              0 responses
              4 views
              0 likes
              Last Post Dan_D_Trader  
              Started by JohnAymin, Today, 02:38 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Tyler  
              Started by Rmos22, Today, 02:20 PM
              2 responses
              23 views
              0 likes
              Last Post Rmos22
              by Rmos22
               
              Started by sawtooth500, Today, 12:59 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Spencer  
              Started by Steve L, Yesterday, 09:36 PM
              1 response
              24 views
              0 likes
              Last Post NinjaTrader_Kate  
              Working...
              X