Writing Optimization Results into an external textfile

Back to topics list To post a new topic, please log in or register
avatar
315
sunshineh 2016.03.12 14:57
 

Hi,

I found this article in the codebase:

https://www.mql5.com/en/articles/1403 

"HOW TO EVALUATE THE EXPERT TESTING RESULTS"

It works fine for testing ONE run, but if I will do an optimization, than in the text-File shows only the last result (not for the different optimization values of an variable)  :-(

I've tried to put this part in the OnTester()-Function

 if(!IsOptimization())
     {
      if(!IsTesting()) ExtInitialDeposit=CalculateInitialDeposit();
      CalculateSummary(ExtInitialDeposit);
      WriteReport("MACD_Sample_Report+"+".txt");
      c++;
     }

 So how can I realize that after EACH automatical run of my EA the result will be written in an text-file?

 

avatar
2017
gooly 2016.03.12 19:00 #
 

Be careful with this idea!

If the tester is optimizing it will test and write according to your wish e.g. in genetic mode between 8'000 and 19'000 results.

~20'000 * 25 lines will create 500'000 lines - you can't manage this. Even editors will probably refuse to open such a file - toooo big!

Write only one line per pass into a csv-file. Use OnTester() for this.


avatar
315
sunshineh 2016.03.13 16:05 #
 

Thank you! 

I thought about this and in the first step I only write the values from the variables an the results in ONE file and for each result the summary, not each trade.

I also don't want to optimize more than about 100-200 results each time.

 

I insert a function to write into a text-file in the OnTester-Function but it never works whether on testing or on optimizing!? (But the same code works, if I put it into the init function.

avatar
2017
gooly 2016.03.13 18:24 #
 

To ad a line you have to do (without checking for errors - you'll find them in the journal tab anyway):

      string row = StringFormat("%.5f;...\n",var1,...);
      int fH = FileOpen(fName,FILE_READ|FILE_WRITE);
      FileSeek(fH,0,SEEK_END); 
      FileWriteString(fH, row, StringLen(row) );
      FileClose(fH);

Otherwise you have to create at every pass a new file name - not to overwrite the existing ones.

Back to topics list  

To add comments, please log in or register