Adding input to indicator
I was searching for a simple way to add an input (bool,integer,double, string, etc…) programmatically into existing NT indicator or strategy, without need to re-create the script from the start using the wizard.
I’ve found this topic on NinjaTrader forum, so, fortunately, everything was easier. You simply do these steps:
1) Add the region block (You can copy existing one and modify it):
[Range(1, int.MaxValue)] //<------- only in case if you need it at all.
[NinjaScriptProperty]
[Display(Name="MyVariable", Order=2, GroupName="Parameters")]
public int MyVariable
{ get; set; }
2) put such variable in if (State == State.SetDefaults)
block :
MyVariable = 123;
3) Click COMPILE the script (F5) and it will automatically update the code (namespace blocks and etc..)