Hi

No response on the Zorro Scripts forum, so would very much appreciate your help.

Trying to optimise on a different measure of P/L from the default.

In run() I calculate my P/L and place the running total in a file-scope variable (I've checked it holds the correct value).

In the same file I've placed an objective() function that simply returns the P/L value in the file-scope variable.

But the optimiser doesn't seem to be using this value, and the red Objective bar in the result charts is blank. Printing to the console seems to be disabled during backtesting so it's hard to figure out the issue.

Schematically, my code looks like this:

Code:
var pl;

run(){
   ... calculate pl
   pl += myVal;
}

var objective(){
   return pl;
}




The docs are a bit vague. What am I overlooking?

Quote:

The performance is calculated in the objective function in include\default.c. This function can be replaced by any user provided function in the script that is named objective. This way, other performance values can be used for optimizing parameters, for instance the profit/drawdown ratio, or the gross profit, or the Sharpe ratio