I got a little , after all having the following to get the value of custom metrics is not the most intuitive:
// 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]); } }
PerformanceMetrics.SampleCumProfit myMetric = (PerformanceMetrics.SampleCumProfit)strategy.PerformanceMetrics.FirstOrDefault(p => p.Name == "SampleCumProfit"); Print("Sample Cum Profit"+myMetric.Values[0]);
Comment