Here's my OnStateChange() code:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "Test01";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DrawOnPricePanel = false;
IsSuspendedWhileInactive = true;
PaintPriceMarkers = false;
AddPlot(new Stroke(Brushes.Green, 2), PlotStyle.Line, "Macd");
AddPlot(new Stroke(Brushes.DarkViolet, 2), PlotStyle.Line, "Avg");
AddPlot(new Stroke(Brushes.DodgerBlue, 4), PlotStyle.Line, "Diff");
AddLine(Brushes.DarkGray,0, "Zeroline");
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
fastEma = new Series<double>(this);
slowEMA = new Series<double>(this);
diff = new Series<double>(this);
}
}

Comment