Errors, bugs, questions - page 2747

 

Good afternoon, the MT5 log shows this message: 2020.05.21 05:49:44.364 Virtual Hosting failed to get list of virtual hosts (www.mql5.com:443 send request failed [12002])

Can you people please tell me what it means and what to do about it?

Thank you!

 
fxsaber:
time of [Bench1()] = 1483377
100000000
time of [Bench2()] = 1725035
100000000
time of [Bench1()] = 1523441
100000000
time of [Bench2()] = 1712777
100000000
time of [Bench1()] = 1416779
100000000
time of [Bench2()] = 1452093
100000000
time of [Bench1()] = 1399366
100000000
time of [Bench2()] = 1449939
 
Mihail Matkovskij:

My debugger refuses to work in one of my projects. Moreover, its behaviour is difficult to predict. Sometimes it just refuses to enter breakpoints. It also refuses to enter some functions. At first I thought the reason was updates (maybe something went wrong with debugging). But in other simpler programs everything seems to work. I haven't checked it much, though, because I'm working on my main project. It is quite complex and includes 15 modules only of my own design (I have not counted the number of standard modules). The main module contains up to 2000 lines. I thought maybe it's all about the complexity of the project... Also, in some places I use macros for repetitive code snippets. Also I use standard UI elements, such as CAppDialog, CCheckGroup, CComboBox, CButton etc. that I rewrote to the functionality of my program. Maybe debugging doesn't work because of them... For example, the CCheckGroup::itemCheckState(const string item) method I specifically wrote doesn't debug. The method finds item of check box and checks whether it's selected (its State):

This is what kind of UI I ended up with:

Some of the UI elements are temporarily classified. And here is a branch where I described how I overrode Show() and Hide() methods of CAppDialog element:https://www.mql5.com/ru/forum/338301 The compiler complained at that moment and a critical error occurred.

In the end the project compiles normally, the compiler doesn't generate any errors. But debugging fails and just doesn't show execution of some code fragments, functions, methods and so on.

As far as I understand, there may be several reasons for that.

  1. Complicated code of the project, use of macros
  2. Complicated code using standard UI elements, such as CAppDialog, CCheckGroup, CComboBox, CButton (for which I also wrote new methods and redefined some of existing ones)
  3. Debugger bug related to the new build (possible, unlikely).

Build and system info:

Who has had similar problems with the debugger and what might be the cause?

https://www.mql5.com/ru/forum/1111/page2746#comment_16481481

In CCheckGroup::itemCheckState method (into which the debugger can't get) I put something like this:

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CCheckGroup::itemCheckState(const string item) {
  int total = m_strings.Total();
  
  if(total != m_states.Total())
    return -1;
    
  int i = 0;
  for(; i < total; i++) {
    if(m_strings.At(i) == item) {
      Alert(__FUNCTION__ + " item: " + item  + " state: " + (string)m_states.At(i));
      return m_states.At(i);
    }
  }
  
  return -1;
}

And got the following message:

2020.05.21 13:20:44.229 CCheckGroup::itemCheckState item: 39 state: 32

It turns out that the method works fine, but the debugger stops seeing it for some reason. Without proper work of the debugger, the work on the project may be delayed for a long time. I would like the Developers to pay attention to this bug, most likely related to the debugger.
Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2020.05.21
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 
Mihail Matkovskij:

https://www.mql5.com/ru/forum/1111/page2746#comment_16481481

It turns out that the method works properly, but the debugger stops seeing it for some reason.
Without the debugger working properly, the project may be delayed for a long time. I would like the Developers to pay attention to this bug most likely related to the debugger.

It's a lot of text, I haven't read all of it.
But if something works in debug version and doesn't work in release, or vice versa, check if all variables and fields, especially in class/structure, were initialized.

 
Mihail Matkovskij:
maybe the method is inline, then it's not the debugger's problem, but the debug-mode compiler's
 
TheXpert:
input int Range = 0;

double Res = 0;

#define  GETCURRENTTICK GetCurrentTick1(Tick)
//#define GETCURRENTTICK GetCurrentTick2(Tick, !i)
//#define GETCURRENTTICK GetCurrentTick3(Tick)

void OnTick()
{
  MqlTick Tick;
    
  for (int i = 0; i < 100; i++)
    if (GETCURRENTTICK)
      Res += Tick.bid;
}

double OnTester()
{
  return(Res);
}

bool GetCurrentTick1( MqlTick &Tick )
{
  return(SymbolInfoTick(_Symbol, Tick));
}

bool GetCurrentTick2( MqlTick &Tick, const bool NewTick = false )
{
  static MqlTick CurrentTick;
  
  if (NewTick)
    SymbolInfoTick(_Symbol, CurrentTick);
  
  Tick = CurrentTick;
  
  return(true);
}

bool GetCurrentTick3( MqlTick &Tick )
{
  static MqlTick _Tick; // Аналог Bid в MT4
  
  _Tick.bid += _Point;  // Хоть какой-то расход вычислительный ресурсов.
  
  Tick = _Tick;
  
  return(true);
}
#define  GETCURRENTTICK GetCurrentTick1(Tick)
#define  GETCURRENTTICK GetCurrentTick2(Tick, !i)
#define  GETCURRENTTICK GetCurrentTick3(Tick)
2020.05.21 14:19:52.450 Core 1  pass 0 returned result 693275970.165784 in 0:00:08.925
2020.05.21 14:19:59.980 Core 1  pass 1 returned result 693275970.165784 in 0:00:07.529
2020.05.21 14:20:07.370 Core 1  pass 2 returned result 693275970.165784 in 0:00:07.390
2020.05.21 14:20:14.694 Core 1  pass 3 returned result 693275970.165784 in 0:00:07.323
2020.05.21 14:20:21.688 Core 1  pass 4 returned result 693275970.165784 in 0:00:06.994
2020.05.21 14:20:29.114 Core 1  pass 5 returned result 693275970.165784 in 0:00:07.425
2020.05.21 14:20:36.133 Core 1  pass 6 returned result 693275970.165784 in 0:00:07.019
2020.05.21 14:20:43.557 Core 1  pass 7 returned result 693275970.165784 in 0:00:07.424
2020.05.21 14:20:49.580 Core 1  pass 8 returned result 693275970.165784 in 0:00:06.022
2020.05.21 14:20:57.273 Core 1  pass 9 returned result 693275970.165784 in 0:00:07.693
2020.05.21 14:21:03.993 Core 1  pass 10 returned result 693275970.165784 in 0:00:06.719
2020.05.21 14:21:03.993 Tester  optimization finished, total passes 11
2020.05.21 14:21:04.003 Statistics      optimization done in 1 minutes 22 seconds
2020.05.21 14:21:04.003 Statistics      shortest pass 0:00:06.022, longest pass 0:00:08.925, average pass 0:00:07.314
2020.05.21 14:21:04.003 Statistics      local 11 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)
2020.05.21 14:21:49.346 Core 1  pass 0 returned result 693275970.165784 in 0:00:03.050
2020.05.21 14:21:51.108 Core 1  pass 1 returned result 693275970.165784 in 0:00:01.761
2020.05.21 14:21:52.903 Core 1  pass 2 returned result 693275970.165784 in 0:00:01.795
2020.05.21 14:21:54.731 Core 1  pass 3 returned result 693275970.165784 in 0:00:01.827
2020.05.21 14:21:56.536 Core 1  pass 4 returned result 693275970.165784 in 0:00:01.803
2020.05.21 14:21:58.341 Core 1  pass 5 returned result 693275970.165784 in 0:00:01.805
2020.05.21 14:22:00.135 Core 1  pass 6 returned result 693275970.165784 in 0:00:01.793
2020.05.21 14:22:01.912 Core 1  pass 7 returned result 693275970.165784 in 0:00:01.777
2020.05.21 14:22:03.663 Core 1  pass 8 returned result 693275970.165784 in 0:00:01.750
2020.05.21 14:22:05.458 Core 1  pass 9 returned result 693275970.165784 in 0:00:01.794
2020.05.21 14:22:07.274 Core 1  pass 10 returned result 693275970.165784 in 0:00:01.815
2020.05.21 14:22:07.274 Tester  optimization finished, total passes 11
2020.05.21 14:22:07.284 Statistics      optimization done in 0 minutes 21 seconds
2020.05.21 14:22:07.284 Statistics      shortest pass 0:00:01.750, longest pass 0:00:03.050, average pass 0:00:01.906
2020.05.21 14:22:07.284 Statistics      local 11 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)
2020.05.21 14:23:00.873 Core 1  pass 0 returned result 661757660284.981689 in 0:00:02.859
2020.05.21 14:23:02.704 Core 1  pass 1 returned result 661757660284.981689 in 0:00:01.830
2020.05.21 14:23:04.488 Core 1  pass 2 returned result 661757660284.981689 in 0:00:01.783
2020.05.21 14:23:06.227 Core 1  pass 3 returned result 661757660284.981689 in 0:00:01.737
2020.05.21 14:23:07.778 Core 1  pass 4 returned result 661757660284.981689 in 0:00:01.550
2020.05.21 14:23:09.517 Core 1  pass 5 returned result 661757660284.981689 in 0:00:01.738
2020.05.21 14:23:11.288 Core 1  pass 6 returned result 661757660284.981689 in 0:00:01.771
2020.05.21 14:23:12.997 Core 1  pass 7 returned result 661757660284.981689 in 0:00:01.708
2020.05.21 14:23:14.815 Core 1  pass 8 returned result 661757660284.981689 in 0:00:01.817
2020.05.21 14:23:16.621 Core 1  pass 9 returned result 661757660284.981689 in 0:00:01.805
2020.05.21 14:23:18.313 Core 1  pass 10 returned result 661757660284.981689 in 0:00:01.691
2020.05.21 14:23:18.313 Tester  optimization finished, total passes 11
2020.05.21 14:23:18.323 Statistics      optimization done in 0 minutes 21 seconds
2020.05.21 14:23:18.323 Statistics      shortest pass 0:00:01.550, longest pass 0:00:02.859, average pass 0:00:01.844
2020.05.21 14:23:18.323 Statistics      local 11 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)

On the subject of SymbolInfo functions being free.

 
TheXpert:
perhaps the method is inline, then it's not the debugger's problem, but the debug compiler's

Exactly, the project turned out to be overflowing with macros, both mine and those from standard modules. Maybe that's why the debugger doesn't always manage to match commands in *.ex5 debug file with lines in *.mq5 source file and other modules...

 
fxsaber:
The SymbolInfo functions are free.

so it's the cost of the function itself, not the cost of passing the string by value, not by reference!

Your version with the cache is quite a solution, if the execution of this function takes a significant percentage of the time of execution of the EA (which I don't really believe)

 
Mihail Matkovskij:

Exactly, the project turned out to be overflowing with macros, both mine and those from standard modules. Maybe that's why the debugger doesn't always manage to match commands in *.ex5 debug file with lines in *.mq5 source file and other modules...

perhaps your file structure is so complex that the debugger can't associate a breakpoint, then it's the debugger's problem.
 
TheXpert:

is the cost of the function itself, not the cost of passing the string by value, not by reference!

That's what I was initially led to.

Forum on trading, automated trading systems and strategy testing

Errors, bugs, questions

fxsaber, 2020.05.20 13:24

It's better to have

const MqlTick _Tick; // Текущий _Symbol-тик.

In the optimizer these functions are called tens of billions of times.


Moreover, your variant with the cache is quite a solution, if the execution of this function takes a significant percentage of the runtime of an EA (which I don't really believe)

At a certain stage, not only the relative part of time taken becomes important, but the absolute part as well.