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 trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    18 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Today, 09:46 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by wzgy0920, Today, 09:53 PM
    0 responses
    9 views
    0 likes
    Last Post wzgy0920  
    Started by Rapine Heihei, Today, 08:19 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 08:25 PM
    0 responses
    10 views
    0 likes
    Last Post Rapine Heihei  
    Working...
    X