When you define an objective function this way:
var objective(PERFORMANCE * perf)
it does NOT override the default objective since C makes a difference between functions of the same name, but different parameter types. It's better this way:
var objective()
{
PERFORMANCE* perf = &g->w;
...
}
Passing PERFORMANCE as a parameter is not really needed since it's also stored in the g struct.
Ups yes, I have the word carried from the previous explanation. Jcl, so what does Zorro do when you declare the user defined function
var objective(PERFORMANCE * perf)
?
Does Zorro use it and not the one in default.c? I ask you because in User Defined Functions in the help file of Zorro 1.42 it is defined as var objective(PERFORMANCE * perf)
Concerning what boatman said, I agree and I add that optimizing drawdown with sharpe ratio would be kinda redundant since the drawdowns would be correlated to the std of the returns I think. I have thougth of this super optimization metric,
return sharpe_ratio * (g->w->numWin + g->w->numLoss) / g->w->vUlcer
To optimize sharpe ratio and minimize ulcer and also penalize low trades, I am not sure if g->w->numWin is the number of CLOSED won trades or there can be open trades counted in that number, same with g->w->numLoss...