Новая версия платформы MetaTrader 5 build 1930: Плавающие окна графиков и .Net библиотеки в MQL5 - страница 87

 
Carl Schreiber:
I'll try - is there a way to get the actual number of the pass and/or the generation in order not to print> 10'000 lines?

See Reference  https://www.mql5.com/en/docs/optimization_frames/framenext


Documentation on MQL5: Working with Optimization Results / FrameNext
Documentation on MQL5: Working with Optimization Results / FrameNext
  • www.mql5.com
Working with Optimization Results / FrameNext - Reference on algorithmic/automated trading language for MetaTrader 5
 

Sigh!

  1. Print() doesn't work during the optimization - ok!
  2. So I want to use WinApi Print and failed: dll not alowed?
  3. I'd like to help you about the returns of OnTester() - if I only knew how!

This was my try:

double OnTester() {
   double dd = sqrt(TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          oD = (TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          pr = TesterStatistics(STAT_PROFIT);
   if (dd == 0.0) return(100.0*pr);
   if ( ((int)TimeLocal())%5000 == 0 ) {
      int wHdl = OpenExistingFileForReading("B:\\StratTester.txt",false,false); //my Windows function B: = ram disk
      int bRead[1];
      int szFile = GetFileSize(wHdl, bRead); //my Windows function
      CloseHandle(wHdl);
      if ( bRead[0] < 5000 )
         //my Windows function:
         AppendWriting(
            "B:\\StratTester.txt",
            StringFormat("%s  otgDD%% %s  sqrt(DD%%) &s  Profit %s  ret %s", 
                        _t2Sec(TimeLocal()),_d25(oD),_d25(dd),_d22(pr),_d23(pr/dd))
         );
   }
   return ( pr/dd );
}

I am not sure about FrameNext as the function "moves the pointer" and this might mess up the optimization?

 
Carl Schreiber:

I am not sure about FrameNext as the function "moves the pointer" and this might mess up the optimization?

FrameNext is intented to get data from Frame which are sending by tester agents by FrameAdd. It is like iterator for traversing all frames

See also sample in https://www.mql5.com/de/articles/403

Veranschaulichung einer Strategie im Prüfprogramm von MetaTrader 5
Veranschaulichung einer Strategie im Prüfprogramm von MetaTrader 5
  • www.mql5.com
Jeder kennt den Spruch: „Ein Bild sagt mehr als tausend Worte.“ Man kann zig Bücher über Paris oder Venedig lesen, aber die geistigen Vorstellungen vermitteln einem nie dasselbe Gefühl wie ein Spaziergang durch die abendlichen Straßen. Der Vorteil der Veranschaulichung oder der grafischen Darstellung lässt sich auf jeden beliebigen...
 
Rashid Umarov:

FrameNext is intented to get data from Frame which are sending by tester agents by FrameAdd. It is like iterator for traversing all frames

See also sample in https://www.mql5.com/de/articles/403


 

Ok - I tried this:

double OnTester() {
   double dd = sqrt(TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          oD = (TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          pr = TesterStatistics(STAT_PROFIT);
   if (dd == 0.0) return(100.0*pr);
   
   string name ="";  // Public name/frame label
   ulong  pass =0;   // Number of the optimization pass at which the frame is added
   long   id   =0;   // Public id of the frame
   double val  =0.0; // Single numerical value of the frame
   double stat_values[];
   FrameNext(pass,name,id,val,stat_values);
    
   if ( true ) { // pass%1 == 0 ) {
      PrintFormat("%s  pass %i  otgDD%% %s  sqrt(DD%%) &s  Profit %s  ret %s", 
                  TimeToString(TimeLocal(),TIME_SECOND),pass,DoubleToString(oD,5),DoubleToString(dd,5),DoubleToString(pr,3),DoubleToString(pr/dd,5) );
   }
   return ( pr/dd );
}

and failed as Print() (and I guess PrintFormat()) isn't available in the StrategyTester.

 
Carl Schreiber:

Sigh!

  1. Print() doesn't work during the optimization - ok!
  2. So I want to use WinApi Print and failed: dll not alowed?
  3. I'd like to help you about the returns of OnTester() - if I only knew how!

Check this option


 
Carl Schreiber:

Ok - I tried this:

and failed as Print() (and I guess PrintFormat()) isn't available in the StrategyTester.

Sure, it is written


 
Rashid Umarov:

Check this option


It is enabled, but despite that I thought that the tester agents (even the local ones as I don't use the cloud yet) don't accept dlls.

 
Carl Schreiber:

 I thought that the tester agents (even the local ones as I don't use the cloud yet) don't accept dlls.

Do you use remote agents in your home network?

 
Rashid Umarov:

Do you use remote agents in your home network?

No, even not the MetaTester Agents of the cloud on my pc. Just the one that has come with the terminal.