Click or drag to resize

Strategy Constructor (String, MZpackStrategyBase)

Initializes a new instance of the Strategy class

Namespace:  MZpack.NT8.Algo
Assembly:  MZpack.NT8.Pro (in MZpack.NT8.Pro.dll) Version: 3.18.1.0 (3.18.1.0)
Syntax
C#
public Strategy(
	string name,
	MZpackStrategyBase MZpackStrategy
)

Parameters

name
Type: SystemString
Name of the strategy.
MZpackStrategy
Type: MZpack.NT8.AlgoMZpackStrategyBase
Instance of native NinjaTrader strategy.
Examples
Creates a strategy
C#
public class MZpackAlgoStrategy0 : MZpackStrategyBase
{

    public MZpackAlgoStrategy0() : base()
    {
        // Create MZpack algo strategy object to use built-in pattern and position management
        OnCreateAlgoStrategy = new OnCreateAlgoStrategyDelegate(CreateAlgoStrategy);

        // Set OnCreateIndicators delegate
        OnCreateIndicators = new OnCreateIndicatorsDelegate(CreateIndicators);
    }

    // Create MZpack Algo Strategy object to support pattern and trade management (ATM).
    protected MZpack.NT8.Algo.Strategy CreateAlgoStrategy()
    {
        return new MZpack.NT8.Algo.Strategy(@"MyStrategy v1.0", this)
        {
            OppositePatternAction = OppositePatternAction.Reverse, // Reverse position on validated opposite pattern
            LogLevel = LogLevel, // Set log level of algo from strategy UI
            LogTarget = LogTarget, // Set log target of algo from strategy UI
            LogTime = LogTime
        };
    }
See Also