I am experiencing random changes to the representation of Bollinger bands from a custom strategy. Sometimes they are colored correctly, other times they appear to be way off.
Here's the code I use to designate 3 Bollinger bands:
else if (State == State.DataLoaded) { Bollinger1 = Bollinger(Close, 2, 14); Bollinger2 = Bollinger(Close, 1, 14); Bollinger3 = Bollinger(Close, 3, 14); Bollinger1.Plots[0].Brush = Brushes.DarkOrange; Bollinger1.Plots[1].Brush = Brushes.Goldenrod; Bollinger1.Plots[2].Brush = Brushes.DarkOrange; Bollinger2.Plots[0].Brush = Brushes.LawnGreen; Bollinger2.Plots[1].Brush = Brushes.Goldenrod; Bollinger2.Plots[2].Brush = Brushes.LawnGreen; Bollinger3.Plots[0].Brush = Brushes.Goldenrod; Bollinger3.Plots[1].Brush = Brushes.Goldenrod; Bollinger3.Plots[2].Brush = Brushes.Goldenrod; AddChartIndicator(Bollinger1); AddChartIndicator(Bollinger2); AddChartIndicator(Bollinger3); VOLMA1 = VOLMA(Close, 14); VOLMA1.Plots[0].Brush = Brushes.Goldenrod; AddChartIndicator(VOLMA1); ATR1 = ATR(Close, 14); ATR1.Plots[0].Brush = Brushes.DarkCyan; AddChartIndicator(ATR1); //SetTrailStop(@"TrailstopTickVal", CalculationMode.Currency, 0, true); }
And if I change nothing in the code, but remove the strategy and reapply the strategy, then I get a totally different situation:
Is there a way to get reliable Bollinger calculations consistently represented on the chart?
Comment