Click or drag to resize

MZpackStrategyBase Class

Base abstract class for any MZpack API based strategy.
Inheritance Hierarchy
SystemObject
  NinjaScript
    NinjaScriptBase
      StrategyBase
        StrategyRenderBase
          MZpack.NT8MZpackStrategyBase
            More...

Namespace:  MZpack.NT8
Assembly:  MZpack.NT8.Pro (in MZpack.NT8.Pro.dll) Version: 3.14.21.0 (3.14.21.0)
Syntax
C#
public abstract class MZpackStrategyBase : StrategyRenderBase

The MZpackStrategyBase type exposes the following members.

Properties
  NameDescription
Public propertyIndicators
Public propertyCode exampleSync
Sync object
Examples
protected override void OnBarUpdate()
{
    base.OnBarUpdate();  // Base OnBarUpdate() call is required

    if (BarsInProgress == 0)
        lock (Sync) // Sync event handler
        { 
            // Place strategy logic here
        }
}
Top
Methods
  NameDescription
Public methodAddCustomDataSeries
Public methodCode exampleAddTickDataSeries
Adds 1 Tick data series to the strategy. If Tick replay is off AddTickDataSeries() is invoked internally during indicator initialization. This allows to use MZpack Indicators without Tick replay. Call it manually in OnStateChanged() to handle your OnEachTick strategy in Strategy Analyzer if Tick replay is on.
Examples
protected override void OnStateChange()
{
    base.OnStateChange(); // Base OnStateChange() call is required

    if (State == State.Configure)
    {
        AddTickDataSeries();
    }
}
Public methodControlMargin
Public methodCode exampleCreateIndicators
Implement this method to create set of Indicators for your custom strategy and return them in the list as a result.
Examples
public override List{TickIndicator} CreateIndicators()
{
    // Initialize new Indicators list
    List{TickIndicator} Indicators = new List TickIndicator>(); 

    // Create CustomVolumeProfileIndicator instance with default settings
    customVP = new CustomVolumeProfileIndicator(this)
    {
        // Override defaults if required
        ProfileCreation = ProfileCreation.Custom,
        ProfileMode = ProfileMode.BuySell
    };

    // Add indicator instance to the list
    Indicators.Add(customVP);  

    return Indicators;
}
Public methodGetNinjaScriptProperties
Public methodHandleThrowException
Logs and trows specified exception in Ninja's trace file.
Public methodLogException
Logs specified exception in Ninja's trace file.
Public methodOnRenderTargetChanged
Ninja's OnRenderTargetChanged() overridden method.
(Overrides StrategyRenderBase.OnRenderTargetChanged.)
Public methodRemoveIndicator
Removes an indicator from the Indicators list.
Public methodRoundToTickSize
Top
Fields
  NameDescription
Public fieldStatic memberATTEMPTS
Numbers of attempts to enter position after canceling/rejecting order.
Public fieldStatic memberVersion
Class version number.
Top
See Also
Inheritance Hierarchy
SystemObject
  NinjaScript
    NinjaScriptBase
      StrategyBase
        StrategyRenderBase
          MZpack.NT8MZpackStrategyBase
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy0
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy1
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy2
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy3
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy4
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy5
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy6
            NinjaTrader.NinjaScript.StrategiesMZpackCustomStrategy7