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 CarlTrading, Yesterday, 11:51 AM
    0 responses
    18 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, Yesterday, 11:48 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-25-2026, 09:53 PM
    0 responses
    27 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 03-25-2026, 09:51 PM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 03-23-2026, 11:13 AM
    0 responses
    22 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X