# Complex Criterion Max formula

What is the actual formula used to calculate Complex Criterion Max?

thanks

Please check the documentation before posting.

Another option is to use "Complex Criterion max". This is an integral and complex measure of a test pass quality. It measures multiple parameters:

• Number of Deals
• Drawdown
• Recovery Factor
• Expected Payoff
• Sharpe Ratio
By using this criterion, you can see that the highest value of one parameter (for example the profit) is not always the best option in terms of the complex analysis. The complex criterion gradually selects the best passes: firstly, by the number of deals, then by the Expected Payoff, Recovery Factor, and so on. The new option allows reception of the best optimization passes according to all parameters. Furthermore, you can select the optimal pass based on the desired parameter, such as the highest profit.

Alain Verleyen #:

Please check the documentation before posting.

If someone wants to write this inside "custom max" what exactly would it look like?

Alain Verleyen #:

Please check the documentation before posting.

I know that page very well. That is NOT an OnTester () code. I am looking for the exact formula (i.e.  OnTester () code).

Alain Verleyen #:

Please check the documentation before posting.

None of the conventional documentation provide the formula.

We would like to know HOW it's calculated.

MetaTrader 5 build 2615: new properties of trading instruments and complex criterion in the Strategy Tester
• 2020.09.23
• MetaQuotes
MetaTrader 5 trading platform features improvements allowing traders to achieve better results: additional fundamental data directly in the platform search for the best combination of inputs using Complex Criterion max when optimizing EAs arrange financial instruments by sector, industry and country more efficient development of robots in the...

Farkas10d #:

I know that page very well. That is NOT an OnTester () code. I am looking for the exact formula (i.e.  OnTester () code).

You are free to write your own formula then you know exactly what is calculated.

Carl Schreiber #:
You are free to write your own formula then you know exactly what is calculated.
With all due respect, that was not the question.

Another option is to use "Complex Criterion max". This is an integral and complex measure of a test pass quality. It measures multiple parameters:

• Number of Deals
• Drawdown
• Recovery Factor
• Expected Payoff
• Sharpe Ratio
By using this criterion, you can see that the highest value of one parameter (for example the profit) is not always the best option in terms of the complex analysis. The complex criterion gradually selects the best passes: firstly, by the number of deals, then by the Expected Payoff, Recovery Factor, and so on. The new option allows reception of the best optimization passes according to all parameters. Furthermore, you can select the optimal pass based on the desired parameter, such as the highest profit.

The cryptic "complex criterion" gives some strange results.

All parameters are better in the second line, still the complex criterion value is better for a pass with a loss of -6000 !

Complex Criterion Max formula
• 2022.01.16
• www.mql5.com
What is the actual formula used to calculate Complex Criterion Max? thanks...

Alain Verleyen #:

The cryptic "complex criterion" gives some strange results.

All parameters are better in the second line, still the complex criterion value is better for a pass with a loss of -6000 !

So the actual formula used for the calculation is secret / unknown?

I use a custom forumla but it would be nice to know how the Custom Criteron Max forumla works, so one could make customisations to that. Such as adding profitable trade ratios, or exapanding the final value of the max fomula. You get a lot of 99.99 results and it can be quite hard to filter out the desired results from that without having to use excel to process everything again.

Alain Verleyen #:
All parameters are better in the second line, still the complex criterion value is better for a pass with a loss of -6000 !

From the screenshot you have provided, its suggested that the Complex Criterion is generation dependent. Good results popping up in the early generations carry more weight.

Alain Verleyen #:
The complex criterion gradually selects the best passes: firstly, by the number of deals, then by the Expected Payoff, Recovery Factor, and so on.

This cryptic text also suggests that it is timeline/generation dependent. Keywords here are "firstly" and "then".

On a side note, negative balance results aren't particularly bad for optimization, they play a crucial role in the future generation's judgement of bad from worst while genes are being crossed. So we should be careful when returning 0 as OnTester result if the trades are too little or if the balance is negative.

Reason: