Thanks for your post.
There are no supported methods or properties to check if a strategy is enabled within a NinjaScript strategy.
If you want to set a variable to 0, you could consider setting it to 0 in OnStateChange() when the State == State.Configure.
OnStateChange(): https://ninjatrader.com/support/help...ightsub=States
If you want to skip the historical processing of data when enabling the script so the strategy does not calculate historical (virtual) trades when it is enabled, you could add if (State == State.Historical) return; to the top of your OnBarUpdate() logic.
For example:
protected override void OnBarUpdate() { if (State == State.Historical) return; //rest of your OnBarUpdate() logic. }
Leave a comment: