|
Alexander Horn
2014-06-29 16:43:04
0
|
|
Just reading this thread, maybe this easy workaround can help. I just add the other metrics as string after the Fitness "dot" separated by "00", then convert to double..
Example 38.120015009 means
fitness = 38, CAGR = 12, MaxDD = 15, Sharpe = 0.9;
Gives you an idea what is behind abstract fitness numbers when looking at report, and in excel "data in column" with separator "00" creates report. Note that ABS() figures are used. Based on Systemtra.de fitness script.
bool ok = true;
double[] parameters = {AnnualReturn, MaximumSystemDrawdownInpercentage, SharpeRatio * 10};
double[] weight = {10, 10, 5};
double[] worst_value = {0, -30, 0.5};
double[] best_value = {30, -10, 2};
string fitness = "";
double fit_param = 0;
double total_weight = 0;
if (ok)
{
for (int i = 0; i < parameters.Length; i++)
{
total_weight = total_weight + weight[i];
if (best_value[i] != worst_value[i])
fit_param = fit_param + weight[i] *
(Math.Max(Math.Min(parameters[i], best_value[i]), worst_value[i]) - worst_value[i]) /
(best_value[i] - worst_value[i]);
fitness = fitness + Math.Round(Math.Abs(parameters[i]),0)+"00";
}
if (total_weight != 0) Fitness = 100 * fit_param / total_weight; else Fitness = 0;
fitness = String.Concat(Math.Round(Fitness,0),".",fitness);
Fitness =Convert.ToDouble(fitness);
}
else
Fitness = 0;
|
|