Discussion of article "MQL5 Cookbook: Saving Optimization Results of an Expert Advisor Based on Specified Criteria"

 

New article MQL5 Cookbook: Saving Optimization Results of an Expert Advisor Based on Specified Criteria has been published:

We continue the series of articles on MQL5 programming. This time we will see how to get results of each optimization pass right during the Expert Advisor parameter optimization. The implementation will be done so as to ensure that if the conditions specified in the external parameters are met, the corresponding pass values will be written to a file. In addition to test values, we will also save the parameters that brought about such results.

MQL5 Cookbook: Saving Optimization Results of an Expert Advisor Based on Specified Criteria

To gain access to data in the course of optimization, you can use special MQL5 functions: OnTesterInit(), OnTester(), OnTesterPass() and OnTesterDeinit(). Let's have a quick look at each of them:

  • OnTesterInit() - this function is used to determine the optimization start.
  • OnTester() - this function is responsible for adding so-called frames after every optimization pass. The definition of frames will be given further below.
  • OnTesterPass() - this function gets frames after every optimization pass.
  • OnTesterDeinit() - this function generates the event of the end of the Expert Advisor parameter optimization.

Now we should define a frame. Frame is some sort of a data structure of a single optimization pass. During optimization, frames are saved to the *.mqd archive created in the MetaTrader 5/MQL5/Files/Tester folder. Data (frames) of this archive can be accessed both during the optimization "on the fly" and after its completion. For example, the article "Visualize a Strategy in the MetaTrader 5 Tester" illustrates how we can visualize the process of the optimization "on the fly" and then view the results following the optimization.

Author: Anatoli Kazharski

 
tyvm. Excellent article.
 
wow, its great
 
Please, Is it possible to save the equity curve for each parameter set? 
 

Is it possible to save only the used parameters for the top 10 passes from the optimization results?

With higher pass numbers the logged results file (starting from terminal) can be tens of gigabytes, which is unnecessary. So I was wondering if in the OnTesterDeinit() function, results can be accessed and only a small part of it saved into a file?

 
Thanks this article helped me to solve the issue I had with reports.
 
Great useful article on optimization reposts but, when compiled, there are a lot of errors and warnings displayed, maybe due to the changes made to the MQL5 syntax.
I fixed most of those errors and warnings, but the reports are not generated when an optimization is executed.
Reason: