Libraries: MultiTester - page 56

 

Sometimes it is necessary to view some piece of price history in the form of a table. This can be done via CTRL+U, selecting the Bars/Ticks tab. Entering the necessary interval there by hand. It is tedious.


That is why I created an additional functionality, which is demonstrated by the following Expert Advisor.

#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/en/code/26132
#include <fxsaber\Keyboard\Keyboard.mqh> // https://www.mql5.com/en/code/48393

input bool inTicks = true; // true - Ticks, false - Bars
input int inBefore = -60; // Before in seconds
input int inAfter = 60;   // After in seconds
input ENUM_TIMEFRAMES inPeriod = PERIOD_CURRENT; // Period (Bars mode)

datetime GetTime( const int X )
{
  int Window;
  datetime Res;
  double Price;
    
  return(ChartXYToTimePrice(0, X, 0, Window, Res, Price) ? Res : 0);
}

void OnChartEvent( const int32_t id, const long &lparam, const double&, const string& )
{
  if ((id == CHARTEVENT_CLICK) && KEYBOARD::IsControl())
  {
    const datetime Time = GetTime((int)lparam);

    if (Time)
    {
      if (inTicks)
        MTTESTER::CopyTicks(_Symbol, Time + inBefore, Time + inAfter);
      else
        MTTESTER::CopyRates(_Symbol, inPeriod, Time + inBefore, Time + inAfter);      
    }    
  }
}


You click (with CTRL pressed) on the necessary place of the chart and automatically get the corresponding tabular data at once.

Selected functions simply fill in certain data fields and query them. Then through the GUI you see what you were interested in. Automation, in general.

 
Perhaps the idea of writing an EA tool that combines various handy features would be a good one.
 

5430 The windows still blink when preparing a task.

How do you fix this?

 
Aleksei Skrypnev #:

5430 Windows still blinks when preparing an assignment.

How do you fix this?

In this way.
Попробуйте загрузить все файлы в архиве.
Попробуйте загрузить все файлы в архиве.
  • 2025.12.22
  • www.mql5.com
если бы время файлов в архиве совпадало со временем модификации в кодобазе. Не соответствует времени изменения конкретного файла. Я вижу корректную структуру после разархивирования а ведь сам редактор позволяет загрузить все эти файлы именно так
 
fxsaber #:
Thus.

It's a great theme. But I downloaded before everything separately still blinks.

I saw that in the file MultiTester_Example.mq5

added lines to the MultiTester_Example.mq5 file.

#define  FAKE // Remove - bypass to place the code in the KB.

#ifdef  FAKE
  void OnStart() {}
#else // #ifdef FAKE
#endif // #ifdef FAKE #else

I have commented so or should I do it differently? Or can I delete all these 4 lines?

//#define FAKE // Remove - bypass to place code in the KB.

#ifdef FAKE// void OnStart() {}

#else // #ifdef FAKE

#endif // #ifdef FAKE #else


P.S. I saw that I took the old list of tasks without these lines and it flickered. With the new lines it doesn't blink.

But did I correctly comment out only 1 line?

 
Aleksei Skrypnev #:

It's a great theme. But I downloaded before that everything separately still blinks.

I saw that in the file MultiTester_Example.mq5

added lines

I have commented it this way or should I do it differently? Or can I delete all these 4 lines in general?


P.S. I saw that I took the old task list without these lines and it was blinking. With new lines it doesn't blink.

But have I commented only 1 line correctly?

Your understanding is correct: remove the comments or delete these 4 lines completely.
 
Good day, dear fxsaber! Please help me to solve a problem. My script has an archive function, which I developed with the help of the great MTTESTER library. It writes Settin to the Tester folder in the following line: if(!kernel32::CopyFileW(SrcPath,DstPath,false)) // Overwrite Settin from the Files sandbox to the Tester folder. We get a set with the name: "After archiving". But it is not suitable for further rework, apparently because of the encoding. However, if you manually write it to the robot in the Strategy Tester and then save it with the name "After manual writing to the robot and saving", this set is already suitable. And it's not just a matter of changing the header, but something else. I asked the ironmen (Qwen, Deep Seek) for help and they generated a script "ReloadSetsFromCommonFixed". It's got a lot of great features and it works, except for this line: if(!FileCopy(source_path, FILE_COMMON, dest_path, FILE_COMMON)) The set is copied, but then on verification printout the output is abracadabra, apparently due to encoding. Iron offered 4 solutions, but none of them worked (the text has all of them). My last hope is for leather ones. Is there any way to change this line in the archiving function: if(!kernel32::CopyFileW(SrcPath,DstPath,false)) to simulate also manual writing to the robot with subsequent saving in the required format "After manual writing to the robot and saving"? Regards, Alexander
 
klycko #:
Is there any way to change this line in the archiving function

I looked up here (in the opened window press ENTER in the address bar) the set record. Most likely these flags are needed.

FileOpen(FileName, FILE_WRITE | FILE_UNICODE | FILE_TXT);
 

These flags helped a lot and the archiving problem was solved. Now the result is in the right format.

Thank you very much!

But in my script Nocturne the command does not work correctly :

prWrite0 = MTTESTER::SetSettings2(Settings); // Write settings to the robot

Although prWrite0 = true after its execution.

Probably it's again a matter of flags when reading the Settings set from the folder.

This is done by the GetKthFileContent function, which has the line:

int handle = FileOpen(full_path, FILE_READ | FILE_WRITE | FILE_UNICODE | FILE_TXT | FILE_COMMON);

The variants of the line below don't work either:

// int handle = FileOpen(full_path, FILE_READ | FILE_TXT | FILE_COMMON); // Source variant line

// int handle = FileOpen(full_path, FILE_READ | FILE_UNICODE | FILE_TXT | FILE_COMMON);

Next command:

prRead0 = MTTESTER::GetSettings(Control); // Reads the robot settings that were just installed

works correctly and prRead0 = true after its execution.

But in the Control network prMFI=true, as it was originally loaded manually into the robot. This means that the write to the robot did not actually happen, even though the write sign prWrite0 = true.

In the original network, prHEX=true

In the robot's original network prMFI=true

The MTTESTER::SetSettings2(Settings) command works, but these settings do not appear in the robot.

What is the problem here?

Regards, Alexander

 
klycko #:

So what's the problem here?

I didn't bother with studying flags and decided to write a working code for saving and loading Tester set-files.

// Load/Save Tester's set-file.
#property script_show_inputs

input bool inLoad = true; // Settings Load/Save - true/false

#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/en/code/26132

void OnStart()
{
  const string FileName = __FILE__ + ".set";
  
  string Settings;
  ushort Words[];  
      
  if (inLoad) // Load settings.
  {
    Print("Load: " + (string)FileLoad(FileName, Words));
    Settings = ShortArrayToString(Words, 1); // 1 - Unicode
    
    Print(MTTESTER::SetSettings(Settings));
  
  }
  else if (MTTESTER::GetSettings(Settings)) // Save settings.
  {
    Words[ArrayResize(Words, 1) - 1] = 0xFEFF; // 1 - Unicode
    
    StringToShortArray(Settings, Words, ArraySize(Words));    
    Print("Save: " + (FileSave(FileName, Words) ? (string)ArraySize(Words) : "error"));
  }
}


You can save(inLoad = false) a set-file through the script, then change somethingin it by hand and load(inLoad = true) it into the Tester through the script.

If it works, take the corresponding pieces of the source for yourself.