question: is it possible to add a criterion to the optimiser?

KjLNi  

Hello, this is about using the optimiser function. There is a number of parameters by which the optimisation can be done. 

I have seen that there is also the "custom max" criterion. But my interpretation of this is, that is just another way of how to combine the other parameters.

My intention is to set up my own KPI as part of the optimisation. In particular I would like to see the "win rate". So I could count the number of trades and the number of winning trades.

My question here is if something like this is possible at all, or is it not foreseen in the framework?

Thanks a lot for your advice.

Tobias Johannes Zimmer  
Use the search function. Search for custom criterion in articles. There is some code at the end of the article.
Fernando Carreiro  
KjLNi: Hello, this is about using the optimiser function. There is a number of parameters by which the optimisation can be done. I have seen that there is also the "custom max" criterion. But my interpretation of this is, that is just another way of how to combine the other parameters. My intention is to set up my own KPI as part of the optimisation. In particular I would like to see the "win rate". So I could count the number of trades and the number of winning trades. My question here is if something like this is possible at all, or is it not foreseen in the framework? Thanks a lot for your advice.

Yes, but only if you have the source code for the EA. You would then code your own criterion and return the value via the the OnTester() function ...

Return Value

Value of the custom criterion optimization for assessing test results.  

Note

The OnTester() function can be used only when testing EAs and is intended primarily for the calculation of a value that is used as a 'Custom max' criterion when optimizing input parameters.

During the genetic optimization, sorting results within one generation is performed in descending order. This means that the results with the highest value are deemed the best from the optimization criterion point of view. The worst values ​​for such sorting are placed at the end and are subsequently discarded. Therefore, they do not take part in forming the next generation.

Thus, the OnTester() function allows you not only to create and save your own test results reports, but also control the optimization process to find the best parameters of the trading strategy.

Documentation on MQL5: Event Handling / OnTester
Documentation on MQL5: Event Handling / OnTester
  • www.mql5.com
OnTester - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
KjLNi  
Fernando Carreiro #:

Yes, but only if you have the source code for the EA. You would then code your own criterion and return the value via the the OnTester() function ...

Return Value

Value of the custom criterion optimization for assessing test results.  

Note

The OnTester() function can be used only when testing EAs and is intended primarily for the calculation of a value that is used as a 'Custom max' criterion when optimizing input parameters.

During the genetic optimization, sorting results within one generation is performed in descending order. This means that the results with the highest value are deemed the best from the optimization criterion point of view. The worst values ​​for such sorting are placed at the end and are subsequently discarded. Therefore, they do not take part in forming the next generation.

Thus, the OnTester() function allows you not only to create and save your own test results reports, but also control the optimization process to find the best parameters of the trading strategy.

Hello and thanks,

yes, it is my own EA, so - I have the source code ...

I would know how to calculate my own KPI and do this in the "OnTester" function.

Question: what is the specific "command" that makes this appear in the optimiser?

is there some example code?

I did see example code in an article, but in this case it referred to other Parameters, which are already used in Optimisation.

In my example, I would like to use other parameters, which are not yet part of the optimiser.

Thanks in advance.

Fernando Carreiro  
KjLNi #: Question: what is the specific "command" that makes this appear in the optimiser? is there some example code?

I already gave you the answer and even highlighted it for you in the previous post (please read the OnTester() documentation) ...

  • The OnTester() function can be used only when testing EAs and is intended primarily for the calculation of a value that is used as a 'Custom max' criterion when optimizing input parameters.


Documentation on MQL5: Event Handling / OnTester
Documentation on MQL5: Event Handling / OnTester
  • www.mql5.com
OnTester - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
KjLNi  
Fernando Carreiro #:

I already gave you the answer and even highlighted it for you in the previous post (please read the OnTester() documentation) ...

  • The OnTester() function can be used only when testing EAs and is intended primarily for the calculation of a value that is used as a 'Custom max' criterion when optimizing input parameters.


okay, thanks, I will read it!!

Reason: