Download MetaTrader 5

Issue with Passes on Optimization.

To add comments, please log in or register
Order a robot or an indicator for MetaTrader. The Freelance service will help you!
Nick Rios
199
Nick Rios 2015.04.22 00:55 

Hello, am experiencing a little bit of an issue, I was trying to create custom reports using the OnTesterPass, OnTesterInit and OnTesterDeinit functions as explained on this great article https://www.mql5.com/en/articles/746, but I noticed when I optimize my EA on SLOW COMPLETE ALGORITHM and using OPEN PRICES ONLY, and the Total Passes go around 9000, am not getting all the frames. So I thought this could be a problem with my EA so I used the Moving Average EA that comes with the MT5 installation and added the following code:


//Global Counter
int counterxp=0;
// Add a frame
double OnTester()
  {
   double stat_array[1];
   stat_array[0]=TesterStatistics(STAT_PROFIT);
   FrameAdd("Statistics",1,0,stat_array);
   return 0;
  }
//Increase Global counter
void OnTesterPass()
  {
   counterxp++;
  }
//Print when finished
void OnTesterDeinit()
  {
   Print("counterxp=",counterxp);
   ChartClose(0);
  }


When am printing counterxp every time I run the tester, I get a different number of frames, does anyone know why is this happening?


In case someone wants to reproduce am using MetaQuotes as a broker, with the following parameters, as you can see on the screenshot: 

Total Passes vs Frames Captured


Inputs Tab:


Inputs Tab

When I export to XML on Optimization Result Tab am getting all the Passes.

MQL5 Cookbook: Saving Optimization Results of an Expert Advisor Based on Specified Criteria
MQL5 Cookbook: Saving Optimization Results of an Expert Advisor Based on Specified Criteria
  • 2013.10.15
  • Anatoli Kazharski
  • www.mql5.com
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.
Files:
Example.zip 33 kb
To add comments, please log in or register