PerformanceMetrics

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy > TradeCollection > TradesPerformance >

PerformanceMetrics

Previous page Return to chapter overview Next page

Definition

Returns a collection of custom Performance Metrics. These need to have been enabled in Tools > Options > General to be able to use them.

 

Syntax
<TradeCollection>.TradesPerformance.PerformanceMetrics

 

 

Examples

ns

protected override void OnBarUpdate()
{
    // Print out the number of enabled custom Performance Metrics
    Print("Number of Performance Metrics: "
        + SystemPerformance.AllTrades.TradesPerformance.PerformanceMetrics.Length);
 
    // Find a the value of a specific custom Performance Metric named "MyPerformanceMetric"
    for (int i = 0; i < SystemPerformance.AllTrades.TradesPerformance.PerformanceMetrics.Length; i++)
    {
        if (SystemPerformance.AllTrades.TradesPerformance.PerformanceMetrics[i] is
              NinjaTrader.NinjaScript.PerformanceMetrics.MyPerformanceMetric)
        {
              Print((SystemPerformance.AllTrades.TradesPerformance.PerformanceMetrics[i] as
                  NinjaTrader.NinjaScript.PerformanceMetrics.MyPerformanceMetric).Values[0]);
        }
    }
}