public static double AnnualReturns(double[] returns) { double num_years = returns.Length / 252.0; double cum_ret_final = (returns.Select(r => r + 1).Aggregate((a, b) => a * b)); return Math.Pow(cum_ret_final, 1.0 / num_years) - 1.0; } public static double Calmar(double[] returns) { double max_dd = MaxDrawdown(CumulativeReturns(returns)); if (max_dd < 0) { return AnnualReturns(returns) / Math.Abs(max_dd); } return double.NaN; }
How do I fold the code above into OnCalculatePerformanceValue()? I understand that I have to set the return Value but need a bit of help putting it together.
Thanks in advance.
Comment