I have put together an oscillator which compiled and is running just fine. On this oscillator, I have added 2 sets of lines, 1 set to mark the overbought/oversold areas, the other set to mark warning lines. The only issue I've seen so far is that indicator goes blank if I change the boolean (to show/hide overbought/oversold lines) to false from the indicators popup screen. I have another boolean that is setup the exact same way (toggles show/hide the warning lines) but it does not give any issues if I set it to false.
the output window says
Failed to call method 'Initialize' for indicator '': Index was outside the bounds of the array.
Here is the code I use for that in the initialize section
if (ShowOBLines==true) { Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "BullsExtended")); Plots[10].Pen.DashStyle = DashStyle.Dash; Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "BearsExtended")); Plots[11].Pen.DashStyle = DashStyle.Dash; } if (ShowWarningLines==true) { Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "BullsWarning")); Plots[12].Pen.DashStyle = DashStyle.Dash; Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "BearsWarning")); Plots[13].Pen.DashStyle = DashStyle.Dash; }
if (ShowOBLines==true) { BullsExtended.Set(OverBought); BearsExtended.Set(OverSold); } if (ShowWarningLines==true) { BullsWarning.Set(BullWarning); BearsWarning.Set(BearWarning); }
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries BullsExtended { get { return Values[10]; } } [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries BearsExtended { get { return Values[11]; } } [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries BullsWarning { get { return Values[12]; } } [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries BearsWarning { get { return Values[13]; } }
any ideas? Thank you!
Comment