Which optimization criterion to choose in MT5
Before optimizing, MT5 asks you for a criterion: what it should maximize. It looks like a detail, but it decides which passes you see at the top and, in a genetic optimization, which combinations get tested at all.
What the criterion does
It is the number MT5 uses to score each pass: it appears in the Result column and sets the order of the table. In a complete search it only changes the order, because everything is tested anyway. In a genetic search it also changes what gets tested, because the algorithm chases what scores high. And with Forward enabled, it decides which passes go to the forward: the best ones by that criterion.
The options
MT5 lets you maximize balance, profit factor, expected payoff, recovery factor or Sharpe ratio, minimize drawdown, use a custom criterion (whatever the EA's OnTester() function returns) or the complex criterion. Each one rewards something different, and each one has its blind spot.
Why maximum balance is dangerous
The pass with the most profit is usually the one that risks the most: big lots, distant stops or many trades at once. It can have a drawdown you would never sit through live. If you rank by balance, the top rows are precisely the ones most exposed to risk and to luck. Profit factor has the opposite blind spot: it can crown a pass with a handful of trades.
The complex criterion
It gives a score from 0 to 100 that combines several metrics, such as the number of trades, the expected payoff and the recovery factor, instead of looking at just one. It is a reasonable starting point if you have no clear preference. Its exact formula is not published, so treat it as a useful ordering, not as a quality measure you can interpret in detail.
The custom criterion
If you code your EA, the OnTester() function can return any score you like: for example, the recovery factor penalized when there are few trades. It is the most powerful option and the easiest to overfit: the more you tune the formula until the results look good, the more you are optimizing with your eyes on the result.
What to keep in mind
- No criterion prevents overfitting: all of them reward what did well in that period, luck included.
- Do not switch criteria until you get what you expected: it is another way of optimizing with your eyes on the result.
- Always look at several metrics, not just the Result column: a good pass is reasonable in all of them.
- Set minimums first (profit factor, drawdown, trades) and discard whatever does not meet them, whatever the criterion says.
Next step
Orometra does not use the Result column to decide: it measures quality with several metrics at once, requires your minimums before ranking anything and looks for stable zones instead of the top row. That way, the criterion you chose in MT5 weighs as little as possible on the recommendation.