Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Strategy as Enabled by default

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

    Setting Strategy as Enabled by default

    Hi,
    I'm developing a Support Strategy of my Main Strategy that would be invoked and used, my problem is that I don't have a way to Enable my Support strategy by code, I only can do it from the UI so far, is there a way I can do it as part of the Initialization of my main strategy?.

    #2
    Hello eramosr21,

    Thanks for your post.

    No, it is not possible to enable a NinjaScript strategy programmatically. You would need to manually enable to strategy from the UI in either a Chart window or in the Strategies tab of the Control Center.

    We are currently tracking interest for this feature in an internal ticket and I have added your vote.

    The internal tracking number for your feature request is SFT-2844. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

    When a feature request is implemented, you'll find a description of the new feature in the release notes:Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      I know this is an old post. Please add my up vote for this feature request.
      Thanks

      Comment


        #4
        Hola, como hago para votar a favor de dicha funcion SFT-2844. agreguen mi voto por favor. ya ha pasado algun tiempo, o ya la implemnetaron?

        Comment


          #5
          I'm surprised to hear all of this that it is impossible. It is a potential safety hazard, and arguably not a great idea, but you can set IsEnabled to true during State.Configure of a strategy if you wish and it will be enabled. I assume you could probably iterate the strategies on the chart and enable one from a different one - you should try this to see.

          Code:
          #region Using declarations
          using System;
          using System.Collections.Generic;
          using System.ComponentModel;
          using System.ComponentModel.DataAnnotations;
          using System.Linq;
          using System.Text;
          using System.Threading.Tasks;
          using System.Windows;
          using System.Windows.Input;
          using System.Windows.Media;
          using System.Xml.Serialization;
          using NinjaTrader.Cbi;
          using NinjaTrader.Gui;
          using NinjaTrader.Gui.Chart;
          using NinjaTrader.Gui.SuperDom;
          using NinjaTrader.Gui.Tools;
          using NinjaTrader.Data;
          using NinjaTrader.NinjaScript;
          using NinjaTrader.Core.FloatingPoint;
          using NinjaTrader.NinjaScript.Indicators;
          using NinjaTrader.NinjaScript.DrawingTools;
          #endregion
          
          //This namespace holds Strategies in this folder and is required. Do not change it.
          namespace NinjaTrader.NinjaScript.Strategies
          {
              public class TestEnablingByDefault : Strategy
              {
                  protected override void OnStateChange()
                  {
                      if (State == State.SetDefaults)
                      {
                          Name                                        = "TestEnablingByDefault";
                          Calculate                                    = Calculate.OnBarClose;
                      }
                      else if (State == State.Configure)
                      {
                          IsEnabled = true;
                      }
                  }
          
                  protected override void OnBarUpdate()
                  {
                  }
              }
          }
          ​
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            #6
            Originally posted by QuantKey_Bruce View Post
            I'm surprised to hear all of this that it is impossible. It is a potential safety hazard, and arguably not a great idea, but you can set IsEnabled to true during State.Configure of a strategy if you wish and it will be enabled. I assume you could probably iterate the strategies on the chart and enable one from a different one - you should try this to see.

            Code:
            #region Using declarations
            using System;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.ComponentModel.DataAnnotations;
            using System.Linq;
            using System.Text;
            using System.Threading.Tasks;
            using System.Windows;
            using System.Windows.Input;
            using System.Windows.Media;
            using System.Xml.Serialization;
            using NinjaTrader.Cbi;
            using NinjaTrader.Gui;
            using NinjaTrader.Gui.Chart;
            using NinjaTrader.Gui.SuperDom;
            using NinjaTrader.Gui.Tools;
            using NinjaTrader.Data;
            using NinjaTrader.NinjaScript;
            using NinjaTrader.Core.FloatingPoint;
            using NinjaTrader.NinjaScript.Indicators;
            using NinjaTrader.NinjaScript.DrawingTools;
            #endregion
            
            //This namespace holds Strategies in this folder and is required. Do not change it.
            namespace NinjaTrader.NinjaScript.Strategies
            {
            public class TestEnablingByDefault : Strategy
            {
            protected override void OnStateChange()
            {
            if (State == State.SetDefaults)
            {
            Name = "TestEnablingByDefault";
            Calculate = Calculate.OnBarClose;
            }
            else if (State == State.Configure)
            {
            IsEnabled = true;
            }
            }
            
            protected override void OnBarUpdate()
            {
            }
            }
            }
            ​
            Excellent! This works

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            48 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            66 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X