I read in values for different indicators from the excel file depending on the strategy chosen.
My input goes into an array called "descArray[]". The text in the array is the name of an indicator as shown below.
Each strategy uses a different combination of the 14 indicators listed below
index Indicator name
index: 0: OBV
index: 1: CMF
index: 2: OVB2Signal
index: 3: MOM
index: 4: Dad
index: 5: K
index: 6: D
index: 7: SF
index: 8: DCycleHL
index: 9: KCycleHL
index: 10: InsideLRC
index: 11: HA
index: 12: HAOpposing
index: 13: TREND
Since I don't use all 14 indicators for each strategy, I want to create my series and plots based only on the values read in from the excel file.
Is there a way to use the array value in place of hard coding the values in the series declaration?
For example in the 1st line below instead of hard coding OBV, can I use descArray[0] which contains the string "OBV"?
I know I can't directly do that, but is there a workaround for what I'm trying to accomplish? That turns my series declaration below into a for loop that only creates the series for indicators that are read from the excel file. And prevents me from having series (and plots) for indicators that aren't used with the current strategy
[Browsable(false)] [XmlIgnore] public Series<double> OBV { get { return Values[0]; } }
[Browsable(false)] [XmlIgnore] public Series<double> CMF { get { return Values[1]; } }
[Browsable(false)] [XmlIgnore] public Series<double> OBVSignal { get { return Values[2]; } }
[Browsable(false)] [XmlIgnore] public Series<double> MOM { get { return Values[3]; } }
[Browsable(false)] [XmlIgnore] public Series<double> Dad { get { return Values[4]; } }
[Browsable(false)] [XmlIgnore] public Series<double> K { get { return Values[5]; } }
[Browsable(false)] [XmlIgnore] public Series<double> D { get { return Values[6]; } }
[Browsable(false)] [XmlIgnore] public Series<double> SF { get { return Values[7]; } }
[Browsable(false)] [XmlIgnore] public Series<double> DCycleH { get { return Values[8]; } }
[Browsable(false)] [XmlIgnore] public Series<double> KCycleH { get { return Values[9]; } }
[Browsable(false)] [XmlIgnore] public Series<double> InsideLRC { get { return Values[10]; }}
[Browsable(false)] [XmlIgnore] public Series<double> HA { get { return Values[11]; }}
[Browsable(false)] [XmlIgnore] public Series<double> HAOpposing { get { return Values[12]; }}
[Browsable(false)] [XmlIgnore] public Series<double> Trend { get { return Values[13]; }}
any way to do this?

Comment