Skip to main content

Technical Indicators

MZpack provides wrapper classes around standard NinjaTrader technical indicators for use inside MZpack strategies. These wrappers extend StrategyPlotIndicator and integrate with the MZpack indicator lifecycle, chart rendering, and data export systems.

Namespace: MZpack.NT8.Algo.Indicators

tip

These indicators are wrappers for use inside MZpack strategies only. For chart-based indicators use NinjaTrader's built-in equivalents.

Base Classes

StrategyDataSeriesIndicator

Inheritance: StrategyDataSeriesIndicator : ExportedIndicator

Abstract base for data series indicators. Provides input/output series management and bar indexing.

Property / MethodTypeDescription
InputISeries<double>NinjaTrader input data series
MZpackInputSeries<double>Alternative MZpack input series
ValuesSeries<double>[]Output data series array (by index)
GetCurrentBar()intCurrent bar index adjusted for calculation mode
GetAgo(int)intBar-ago offset adjusted for calculation mode
GetInput(int)doubleInput value at ago offset

StrategyPlotIndicator

Inheritance: StrategyPlotIndicator : StrategyDataSeriesIndicator

Abstract base that adds chart rendering capabilities — can display as overlay on the price chart or on a separate panel.

PropertyTypeDefaultDescription
IsOnPanelboolfalseRender on a separate panel
IsUpperPanelboolfalsePanel above the chart (vs below)
PanelHeightfloat200Panel height in pixels
PanelMarginfloat0Margin between chart edge and panel
StrokesStroke[]Stroke styles for each plot line
PlotStylesPlotStyle[]Plot styles for each line
BackBrushBrushPanel background color
BackBrushOpacityint20Background opacity (1–100)

Built-in Indicators

All constructors follow the pattern:

new IndicatorName(MZpackStrategyBase strategy, ISeries<double> input, int period)

Output values are accessed via Values[0] (primary), Values[1], Values[2] for multi-output indicators.

Moving Averages

ClassNinjaTrader EquivalentPeriod DefaultDescription
EMAEMA14Exponential Moving Average
SMASMA14Simple Moving Average
WMAWMA14Weighted Moving Average
LinRegLinReg14Linear Regression

Oscillators & Momentum

ClassNinjaTrader EquivalentParametersDescription
CCICCIPeriod (14)Commodity Channel Index. Separate panel
MACDMACDFast (12), Slow (26), Smooth (9)Values[0] = MACD, Values[1] = Signal, Values[2] = Histogram. Separate panel
MomentumMomentumPeriod (14)Rate of change of price

Volatility & Channels

ClassNinjaTrader EquivalentPeriod DefaultDescription
ATRATR14Average True Range. Separate panel
DonchianChannelDonchianChannel14Values[0] = Mid, Values[1] = High, Values[2] = Low

Price Reference

ClassDescription
CurrentDayOHLValues[0] = Open, Values[1] = High, Values[2] = Low. Intraday bars only

Series Math

ClassNinjaTrader EquivalentDescription
MAXMAXMaximum of last N values
MINMINMinimum of last N values
SUMSUMSum of last N values

Example

// Inside OnCreateIndicators
var ema = new EMA(this, Close, 20);
var atr = new ATR(this, Close, 14);

// Access values in OnBarUpdate or signal logic
double currentEma = ema.Values[0].GetAgo(0);
double currentAtr = atr.Values[0].GetAgo(0);

See Also