• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 03: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 sledge, Today, 06:11 PM
    1 response
    8 views
    0 likes
    Last Post sledge
    by sledge
     
    Started by Bionian, Today, 02:46 PM
    2 responses
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by rwilliam, Today, 01:54 PM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by franco12364, Today, 11:27 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by YevhenShynkarenko, Today, 11:48 AM
    4 responses
    27 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Working...
    X