Can multiple strategy parameters go directly into the same array?

Is there any way I can have multiple parameters from the Strategy Analyzer or any other strategy configuration window input directly into the same array?

I realize I can put all the inputs into an array when beginning the strategy but for the sake of efficiency I was hoping I could go straight into the array without extra processing step.

Here is kind of what I was hoping to accomplish if you can follow:

      [NinjaScriptProperty]
[Range(0, int.MaxValue)]
[Display(Name="STRATEGY PARAMETER 01", Order=1, GroupName="Parameters")]
public bool[] USER_PARAMETER_ARRAY[0]
{ get; set; }

[NinjaScriptProperty]
[Range(0, int.MaxValue)]
[Display(Name="STRATEGY PARAMETER 02", Order=2, GroupName="Parameters")]
public bool[] USER_PARAMETER_ARRAY[1]
{ get; set; }

I ended up using the following code. I don’t know if it’s the best solution, but it seems fairly clean.

private bool[] USER_PARAMETER_ARRAY = new bool[2];  

[NinjaScriptProperty]
[Display(Name=“STRATEGY PARAMETER 01”, Order=1, GroupName=“Parameters”)]
public bool PARAMETER01
{
get { return USER_PARAMETER_ARRAY[0]; }
set { USER_PARAMETER_ARRAY[0] = value; }
}

[NinjaScriptProperty]
[Display(Name=“STRATEGY PARAMETER 02”, Order=2, GroupName=“Parameters”)]
public bool PARAMETER02
{
get { return USER_PARAMETER_ARRAY[1]; }
set { USER_PARAMETER_ARRAY[1] = value; }
}

3 Likes

Yes, that does look clean - I like it. I’m going to steal this. :laughing:
Thanks for sharing.

1 Like