Libraries: MultiTester - page 34

 

Hi, @Stefan Marjoram

You can add this draft function for reading settings from file to string array.

#define  ARRAY_APPEND(array, value)                  \
   ArrayResize(array, ArraySize(array) + 1, 128);   \
   array[ArraySize(array) - 1] = value;

//+------------------------------------------------------------------+
//||
//+------------------------------------------------------------------+
void LoadSettings(string filename, string &settings[]) {
   int f = FileOpen(filename, FILE_READ | FILE_TXT | FILE_ANSI);

   if(f) {
      string setting = "";
      string s;
      while(!FileIsEnding(f)) {
         s = FileReadString(f);
         StringTrimRight(s);
         StringTrimLeft(s);
         if(s == "[Tester]") {
            if(setting != "") {
               ARRAY_APPEND(settings, setting);
               setting = "";
            }

         }
         if(s != "" && StringSubstr(s, 0, 2) != "//") {
            setting += s + "\n";            
         }
      }

      if(setting != "") {
         ARRAY_APPEND(settings, setting);
      }
      FileClose(f);
   } else {
      PrintFormat("Error open file: %s", filename);
   }
}

#undef  ARRAY_APPEND

And use it in OnInit() like this

int OnInit() {
   string Settings[];

   LoadSettings("MySettings.ini", Settings);

   /* For check reading
 for(int i = 0; i < ArraySize(Settings); i++) {
 PrintFormat("------------ Settings[%d]: --------------", i);
 Print(Settings[i]);
 }
 */

   for (uint i = ArraySize(Settings); (bool)i--;)
    Run(Settings[i]);

   return INIT_SUCCEEDED;
}
 
Stefan Marjoram #:

I need to add 20 set files

Forum on trading, automated trading systems and testing trading strategies

New version of MetaTrader 5 build 3550: improvements and fixes

fxsaber, 2023.05.23 00:58

Validate is able to run many ini orders sequentially

  1. Put necessary ini-files into Files\YourName folder.
  2. Start Validate in Terminal, where you specify the folder name - YourName.
The ini-tasks will be launched sequentially.

Create 20 required ini-files and do as described above.

 

bug

I'm getting allergy attacks in the middle of nowhere.

What could be the cause?

 
EgorKim #:

It's an allergy in the middle of nowhere.

What could be the cause?

Is the Start button pressed by hand?

 
fxsaber #:
Is the Start button hand-operated?

Yes.

I only use this code

   if(MTTESTER::IsReady())
     {
      Sleep(200);
     }

   if(MTTESTER::ClickStart())
     {
      Sleep(200);
     }
 
EgorKim #:

I only use this code

Updated.

 
MTTester has been updated.
 
fxsaber #:
MTTester has been updated.

Again.

 
MTTester.mqh updated.
 
EgorKim #:

It's an allergy in the middle of nowhere.

Thank you for your help in testing! Updated MTTester.mqh posted.