I get the error SetState
the code
private Series<double> Range2;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "VariabiliteAlphaTest";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
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;
}
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Minute 1);
Range2 = new Series<double>(this, MaximumBarsLookBack.Infinite);
}
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
return;
if (BarsInProgress == 1)
{
if (CurrentBar > 1)
{
if (Volume[0] >500) Range2[0] = Volume[0];
if (Range2[0] > MAX(Range2, 5)[1] * 2) //Check to see if Current Bar greater then 3 bars starting on the previous[1] bars)
{
Draw.Diamond(this, "Diamond" + CurrentBar, true, -1, (High[0] + Low[0]) / 2, Brushes.Blue);
Draw.Line(this, "Line4", false, -1, (High[0] + Low[0]) / 2, -100, (High[0] + Low[0]) / 2, Brushes.Blue, DashStyleHelper.Solid, 2);
}
}
}
}
}
}
if (Range2 [0]> MAX (Range2, 5) [1] * 2) // Check to see if Current Bar greater then 3 bars starting on the previous [1] bars)

Comment