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?.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Setting Strategy as Enabled by default
Collapse
X
-
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?.Tags: None
-
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>
-
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() { } } }
- Likes 1
Comment
-
Excellent! This worksOriginally posted by QuantKey_Bruce View PostI'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() { } } }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
72 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
39 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
63 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
63 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment