I have an error that I don't understand : Error on calling "SetState" method : exception has been thrown. Is it possible to have some helps ? Thanks

double Ouverture;
double Cloture;
private Series<double> Range2;
double bup;
double bdown;
double inter;
double sss;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "VariabiliteAlpha";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(new Stroke(Brushes.Orange), PlotStyle.Bar, "Plot1");
AddPlot(Brushes.Orange, "Plot2");
AddPlot(Brushes.Orange, "Plot3");
}
else if (State == State.Configure)
{
Range2 = new Series<double>(this, MaximumBarsLookBack.Infinite);
}
}
protected override void OnBarUpdate()
{
Cloture = Close[0];
Ouverture = Open[0];
Range2[0] = Cloture - Ouverture;
if(CurrentBar>50) {
bup = Bollinger(Range2, 2, 20).Lower[0];
bdown = Bollinger(Range2, 2, 20).Lower[0];
}
Values[0][0] = Range2[0];
}

Comment