Download MetaTrader 5

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

To add comments, please log in or register
No time to learn MQL5? The source code library is at your service!
MetaQuotes Software Corp.
Moderator
181078
MetaQuotes Software Corp. 2013.10.15 16:34 

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

Benjamin Dixon
23156
Benjamin Dixon 2015.03.14 05:49  
tyvm. Excellent article.
100753105
5
100753105 2015.06.03 09:36  
wow, its great
To add comments, please log in or register