I would like to have different sets of parameters that I can preselect via a string input for multiple instruments. Here is an example of what I am trying to do:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Strategy Name";
Name = "Name";
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TradeInstrument = "SPY";
if (TradeInstrument == "SPY")
{
Parameter1 = 10;
Parameter2 = 100;
Parameter3 = 200;
}
if (TradeInstrument == "IVV")
{
Parameter1 = 20;
Parameter2 = 50;
Parameter3 = 200;
}
#region Properties
[NinjaScriptProperty]
[Display(Name="TradeInstrument", Description="Enter Instrument Ticker To Trade", GroupName="NinjaScriptParameters", Order = 1)]
public string TradeInstrument
{ get; set; }
The problem is I cannot get it to change from the default that is set. So if I have it set to say SPY, even changing the input does not change to the other set of parameters. Is there a way to do this? Any help would be greatly appreciated.
Thank you,
Lee
Comment