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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Tim-c, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by FrancisMorro, Today, 03:24 AM
    0 responses
    2 views
    0 likes
    Last Post FrancisMorro  
    Started by Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,771 views
    0 likes
    Last Post Leafcutter  
    Started by Rapine Heihei, 04-23-2024, 07:51 PM
    2 responses
    31 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    945 views
    0 likes
    Last Post spwizard  
    Working...
    X