Errors, bugs, questions - page 1941

 

Can you tell me how MT5 can produce such results during optimisation, people in the know?

This is not an isolated case. Moreover, if you take any line and run a single test, the result will be completely different from the one in the table.

Moreover, a single test with and without visualization will give completely different test results.

Moreover, if you run the test several times, the results too can differ sometimes radically.

=====

This has started with the terminal for the last week. Before that it seemed to work adequately. Or maybe I haven't noticed anything wrong.

I had the same problem a year ago. There tester showed results with impossible EA settings too. For example, if Take Profit is disabled in an EA, it produced one test result, but if we set it to 10000000000 points (i.e., it can never be reached, so it is disabled), the tester produced completely different results.


How can I fight such bugs? Why this problem may arise? Maybe I'm doing something wrong?

Files:
ky1b.jpg  590 kb
 
Andrey Koldorkin:

Can you tell me how MT5 can produce such results during optimisation, people in the know?

This is not an isolated case. Moreover, if you take any line and run a single test, the result will be completely different from the one in the table.

Moreover, a single test with and without visualization will give completely different test results.

Moreover, if you run the test several times, the results too can differ sometimes radically.

=====

This has started with the terminal for the last week. Before that it seemed to work adequately. Or maybe I haven't noticed anything wrong.

I had the same problem a year ago. There tester showed results with impossible EA settings too. For example, if Take Profit is disabled in an EA, it produced one test result, but if we set it to 10000000000 points (i.e., it can never be reached, so it is disabled), the tester produced completely different results.


How can I fight such bugs? Why this problem may arise? Maybe I am doing something wrong?

Insert two lines at the beginning of your EA

#define  REPORT_TESTER // В тестере будут автоматически записываться отчеты
#include <Report.mqh> // https://www.mql5.com/ru/code/18801

This will force the tester to save a detailed report for each pass of the optimizer and for a single run.

Compare the resulting run report from the optimizer and its version of a single run.

 
MQL5-compiler is silent, and MQL4++ warns
m_pixels[y*m_width+x]=(r<<16|g<<8|b<<0|255<<24) &0xffffffff; // check operator precedence for possible error; use parentheses to clarify precedence

Who is right?

 
Compilation error (MT5b1641)
void NewFunc( int ) {}

#define  MACROS(A) New##A

void OnStart()
{  
  NewFunc(0);      // OK
  MACROS(Func(0)); // Error: 'NewFunc(0)' - undeclared identifier
}
 

Please include macros

__SCRIPT__ - the compiled mq5-file is a Script.

__INDICATOR__ - the compiled mq5-file is an Indicator.

__EXPERT__ - the compiled mq5-file is an Expert Advisor.

__SERVICE__ - the compiled .mq5 file is a Service.


Situation when MQLInfoInteger cannot be used

#ifdef __EXPERT__

void OnTick()
{
  static bool FirstRun = true;
  
  if (FirstRun)  
  {
    Print("FirstTick!");
    
    FirstRun = false;
  }
  
  OldOnTick();
}

#endif // __EXPERT__

#ifdef __SERVICE__

void OnTick( const string &Symb )
{
  static bool FirstRun = true;
  
  if (FirstRun)  
  {
    Print("FirstTick!");
    
    FirstRun = false;
  }
  
  OldOnTick(Symb);
}

#endif // __SERVICE__

#define OnTick OldOnTick

// Дальше код советника/сервиса.

 
How do I get a PR Agent through MQL? Measuring the speed of the Agent, I wanted to get a PR, but it's not here.
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
fxsaber:
How can I get a PR Agent through MQL? I'm measuring the speed of the Agent, I wanted to get PR, but there's no PR here.

What's the point? You can't choose agents anyway. You can cut off a task if it takes too long to complete, even without PR.

 
Stanislav Korotky:

What's the point? You can't choose agents anyway. It is possible to cut off a task if it takes too long to complete, even without PR.

The point is to be able to show inconsistency of PR-agent's actual performance. Or vice versa - to show adequacy of rating calculation.

 
Unable to open an MT4 demo account on MetaQuotes-Demo.
 

MT4 tester in "All ticks" mode makes trades on bars that are not in the history

Reason: