"def s2 = expAverage(close,6) - expAverage(close,9);"
private Series<Double> ema1;
private Series<Double> ema2;
private Series<Double> S2;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "EZTrend";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = false;
DrawVerticalGridLines = false;
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(Brushes.Gold, "S2");
AddLine(Brushes.PapayaWhip, 0, "ZeroLine");
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
ema1 = new Series<double>(this);
ema2 = new Series<double>(this);
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
double S2 = ema1[6] - ema2[9];

Comment