Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Performance Metrics

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom Performance Metrics

    I admit first time I had a look at http://www.ninjatrader.com/support/h...ncemetrics.htm
    I got a little , after all having the following to get the value of custom metrics is not the most intuitive:
    Code:
         // 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]);
              }
         }
    So my recommendation not to discourage users from utilizing this new addition is to give also LINQ alternative in help guide, eg:
    Code:
    PerformanceMetrics.SampleCumProfit myMetric = (PerformanceMetrics.SampleCumProfit)strategy.PerformanceMetrics.FirstOrDefault(p => p.Name == "SampleCumProfit");
    Print("Sample Cum Profit"+myMetric.Values[0]);
    Last edited by gregid; 05-18-2015, 04:32 PM.

    #2
    , for sure much friendlier. I'll take a look at changing. Earlier on in the documentation process we decided not to use LINQ since we didn't want to introduce the new concept but you for sure have a point in this specific example.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    672 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    577 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X