AddPerformanceMetric()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy >

AddPerformanceMetric()

Previous page Return to chapter overview Next page

Definition

Adds an instance of custom Performance Metric to a strategy used in strategy calculations.

 

Method Return Value

This method does not return a value.

 

Syntax
AddPerformanceMetric(PerformanceMetricBase performanceMetric)

 

Warning:  This method should ONLY be called from the OnStateChange() method during State.Configure

 

 

Parameters

performanceMetric

The performance metric object to be added

 

 

 

Examples

ns

protected override void OnStateChange()
{
    if (State == State.Configure)
    {
        AddPerformanceMetric(new NinjaTrader.NinjaScript.PerformanceMetrics.SampleCumProfit());
    }
}