Libraries: MultiTester - page 48

 
 

//#include "..\utils\fxsaber\MultiTester\MTTester.mqh" // https://www.mql5.com/en/code/26132
#include <fxsaber\MultiTester\MTTester.mqh>
input group "MTTester"
sinput int inA = 22;
sinput int inB = 33;
sinput bool inC = false;

void OnInit()
{
  const bool IsTester = MQLInfoInteger(MQL_TESTER);

  if (!IsTester)
  {
    string Settings;
    bool ok1 = MTTESTER::GetSettings2(Settings);
    Print(ok1, " ", Settings);
  }  
}  

I've tried and can't seem to get the tester parameters.

Do I have to press Ctrl+C to copy the text once?


 
hini #:

I've tried it and can't seem to get the tester parameters.

See _LastError.

Do I have to press Ctrl+C to copy the text once?

No.

 
fxsaber #:
Check out _LastError.

4009 ERR_NOTINITIALISED_STRING

 
hini #:

4009 ERR_NOTINITIALIZED_STRING

Not reproduced.

2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) true [Tester]
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) Expert=Examples\MACD\MACD Sample.ex5
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) Symbol=EURUSD
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) Period=M1
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) Optimization=1
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) Model=3
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) [TesterInputs]
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) ; MTTester
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) inA=22
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) inB=33
2025.06.28 20:28:31.981 MACD Sample (EURUSD,M1) inC=false
 
fxsaber #:

It's not playing.

I assume this is a terminal version issue - build 5120 fails to reproduce tester input.

#include <fxsaber\MultiTester\MTTester.mqh>
input group "MTTester"
sinput int inA = 22;
sinput int inB = 33;
sinput bool inC = false;

void OnInit()
{
  const bool IsTester = MQLInfoInteger(MQL_TESTER);
  ResetLastError();
  if (!IsTester)
  {
    string Settings = "";
    bool ok1 = MTTESTER::GetSettings2(Settings);
    Print(ok1, " error=", _LastError," BUILD:", __MQL5BUILD__, " ", Settings);
  }  
}

 
hini #:

I suspect it's a terminal version issue, it's not reproducible on the 5120.

Everything works on b4885 as well.

 
fxsaber #:

Everything works on the b4885 as well.

Got it

 
hini #:
I assume this is a terminal version issue - build 5120 fails to reproduce tester input.

  static long GetHandle( const int &ControlID[] )
  {
    long Handle = MTTESTER::GetTerminalHandle();
    const int Size = ::ArraySize(ControlID);

    for (int i = 0; i < Size; i++) {
      Handle = user32::GetDlgItem(Handle, ControlID[i]);
      if (Handle != 0) return Handle;
    }

    return(Handle);
  }

The problem with getting tester input in version b5120 has been fixed. During debugging it was found that for the array static const int ControlID[] = {0xE81E, 0x804E} the second element (0x804E) returns Handle equal to 0, while the first element (0xE81E) returns valid Handle. When using this Handle, receiving the tester input data works correctly.

Testing has shown that this method works in the b4879 version as well, and presumably there should be no problems in b4885 as well.

static const int ControlID[] = {0x804E, 0xE81E}; //{0xE81E, 0x804E};

Perhaps the easiest thing to do is to change the order

 
hini #:

Fixed a problem with getting tester input data in b5120 version. During debugging it was found that for the array static const int ControlID[] = {0xE81E, 0x804E} the second element (0x804E) returns Handle equal to 0, while the first element (0xE81E) returns valid Handle. When using this Handle, receiving the tester input data works correctly.

Testing has shown that this method works in the b4879 version as well, and presumably there should be no problems in b4885 as well.

Perhaps the easiest thing to do is to change the order

Are you sure you are using the current version of MTTester.mqh? The following code is there.

  static long GetHandle( const int &ControlID[] )
  {
    static const bool MT5_b5050 = (::TerminalInfoInteger(TERMINAL_BUILD) > 5000);

    long Handle = MTTESTER::GetTerminalHandle();
    const int Size = ::ArraySize(ControlID);

    for (int i = 0; i < Size; i++)
      if (!MT5_b5050 || (ControlID[i] != 0xE81E))
        Handle = user32::GetDlgItem(Handle, ControlID[i]);

    return(Handle);
  }