Use MZpack 3 Pro API to build NinjaScript/C# Add-ons (indicators and strategies) for NinjaTrader 8. See details.
NinjaTrader 7
Use MZpack core to code indicators based on order flow/order book and market microstructure logic. Programming interfaces described in User Guide.
Typical indicator instantiate method looks like
public static mzBigtrade CreateInstance(NinjaTrader.Indicator.IndicatorCollection Indicators, IDataSeries input)
First of all add reference to MZpack dll file in your NinjaScript environment. Click right mouse button in NinjaScript editor and click References… Then click Add… button and select MZpack.NT7.dll file. Click Ok.
Then add MZpack.NT7 namespace in using section
using MZpack.NT7;
Declare MZpack indicator property inside custom indicator class and data series
public class MZpackBigDelta : Indicator
{
[Browsable(false)] [XmlIgnore()] public DataSeries SellDelta { get { return Values[0]; }}
[Browsable(false)] [XmlIgnore()] public DataSeries BuyDelta { get { return Values[1]; }}
//
private mzBigtrade indicator;
...
}
Set CaclulateOnBarClose = false to process tick-by-tick data
Place indicator logic in OnBarUpdate() method. Check if data is not Historical because MZpack works only with realtime data.
protected override void OnBarUpdate()
{
if (Historical)
return;
// Get last detected big trade
// AggregatedTrade - base class for not viewed trade data
AggregatedTrade bigTrade = (indicator.Draws.Count > 0) ? indicator.Draws[indicator.Draws.Count - 1] : null;
if (bigTrade != null && bigTrade.Id > lastTradeId) // avoid double processing by checking trade Id
{
if (bigTrade.Side() == TradeSide.Bid)
sellBarDelta += bigTrade.Volume;
...
}
}
Custom indicators samples
See available indicators sapmles to learn how to use MZpack core indicators in your project. To add this samples to NinjaTrader import MZpackInterfaceSamples.zip indicator from MZpack installation folder. MZpack 2.3.0 paid version or higer required to compile samples.