AddPerformanceMetric()

View as Markdown

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)

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

Parameters

ParameterDescription
performanceMetricThe performance metric object to be added

Examples

1protected override void OnStateChange()
2{
3 if (State == State.Configure)
4 {
5 AddPerformanceMetric(new NinjaTrader.NinjaScript.PerformanceMetrics.SampleCumProfit());
6 }
7}