What happened since Build 2755? (Chart freezing - bug not resolved since 2 years!)

 

Since two years we are facing the same bug in MT5 which wasn´t there before. 2755 was the last build which made no problems, all builds afterwards come with the same issue. There must have been a general change within the task management of MetaTrader 5, but we got no help from MetaQuotes to isolate and/or solve this bug. 

And yes, we provided source code, more than 20.000 lines of code, the bug was/is reproducible, but not with a few lines of code only. This bug occurs only, when there is an EA and an indicator on the same chart. When it occurs, this happens:


1. The chart is not updated anymore, bars don´t move/change

2. The EA gets no events anymore like OnTick() or OnTimer()

3. The indicator gets no events anymore like OnCalculate() or OnTimer()

4. All other indicators in other charts get no events anymore

5. MetaTrader is NOT frozen, the Market Watch is still updating, the chart can still be scrolled etc.

6. Chart-Refresh using the option in the context menu of the chart is not helping

7. After a while, roughly 1 minute, it all recovers and comes back to life again

8. It can be manually refreshed by toggling the Autotrading-Feature by clicking the button in the toolbar


This bug cannot be debugged, since there are simply no events anymore, this also excludes any problems in the code. It also does not appear on performant machines, but occurs on VPS, but also not with any. In general we can state: The weaker the machine and the higher the CPU usage, the sooner it occurs. 

Within these two years of searching the reason, we tried a lot of things. My first suspect was ChartEventCustom(), since I know from earlier tests that MT will crash sooner or later when you try to communicate between EA and indicator using ChartEventCustom(), but its not. The described behavior happens also when there is no connection at all between EA and indicator, they just have to be on the same chart. Both even don´t access mutual files, don´t access the chart objects of the other, just nothing. 

What concerns me the most is the fact, that in view of Windows-Thread-Management, the EA and the indicator even also don´t have a mutual thread, since EAs have their own thread and indicators are all in one. Furhermore: The chart itself gets no updates anymore, same time the symbol in the Market Watch is updated. This all makes no sense at all, but in fact it's a massive problem which costs us clients and a lot of money. 

It would be already helpful if we would know what exactly MetaQuotes changed since 2755, but no matter what it was: It is not working as it should and it is a bug within MT5 (since its only there after 2755) which we even cannot surround. We spent not only hours, we spent weeks and months to find the reason, to re-create the way of communication and handling events within EA and indicators, created debug apps, etc. since we assumed it could be caused by the code, but we kind of reached the end of any ideas. And MetaQuotes? No answer at all anymore since 2021. 

Many brokers, thousands of clients and some companies rely on our codes, the situation as it is, is a total disaster and we appreciate any ideas and help.

Thank you in advance for your ideas, guys. 

 

There is probably no other user that has ever created such an advanced MQL program as the one you developed. It is an exceptional project. You are probably in a unique position to have been the first and only one ever to take MetaTrader to its limits and be able to discover such a bug.

Given the quality of MetaQuotes code, both in MetaTrader and the website, I can certainly understand that they are having a tough time trying to understand what could cause it. If MetaQuotes were to be more open with you and allow you access to their code with a non-disclosure agreement, I am sure that together, the bug would have been identified and fixed. However, I don’t see them ever doing that.

So, given that the aim is stabilising your own project, assuming that they will never handle the bug, I suggest offloading some functionality. In order to reduce the load on MetaTrader and lower the probability of the bug surfacing, it may be best to offload as much of it as possible. That means the use of DLLs, which I know is not ideal, but may be the better option at this point. I know from our private talks that you have already started looking into using DLLs for certain specific requirements, so consider expanding that and offloading even more functionality into the C++/DLL realm.

It’s not ideal and fixing the bug would be best, but that is out of your control and direct influence. So, it's best to accept that reality and find other options even if they are not ideal. Knowing what I know about your project, I believe that offloading to C++/DLL is probably the better choice.

 

It's not that simple. This sounds like the software would consume a lot of performance - in fact it doesn´t. 

In general, the execution timings within OnTick(), OnTimer(), OnChartEvent() are almost never above 10ms each, usually below 1ms and even below 0,1 ms. 

As described, it ONLY happens, when both, EA and indicator are on the same chart. It does not happen, when they are on different charts - never. And on different charts, there is even more CPU/GPU performance needed.

On top: We also added functions to simply deactivate all events, so that NO code is executed at all anymore e.g. after all is initialized. It still happens, after a while - when both are on the same chart. This must be sth totally different what´s going on, coz that all makes no sense. 

But in general, yes, that should be the way of MetaQuotes and they should have an interest, that such a thing like ours runs without problems. 

 
Doerk Hilger #On top: We also added functions to simply deactivate all events, so that NO code is executed at all anymore e.g. after all is initialized. It still happens, after a while - when both are on the same chart.

If it's not about the code execution that is the problem, could it be about the memory allocation for the executable code that is the problem?

Could the large size of the code file be the problem? Since the ".ex?" files are encrypted, could the decryption process for such a large amount of code be the root of problem?

I don't know if the decryption process is on-the-fly, incremental or total, but maybe there is a memory leak in the process which slowly degrades until it freezes.

 
Doerk Hilger:

Since two years we are facing the same bug in MT5 which wasn´t there before. 2755 was the last build which made no problems, all builds afterwards come with the same issue. There must have been a general change within the task management of MetaTrader 5, but we got no help from MetaQuotes to isolate and/or solve this bug. 

And yes, we provided source code, more than 20.000 lines of code, the bug was/is reproducible, but not with a few lines of code only. This bug occurs only, when there is an EA and an indicator on the same chart. When it occurs, this happens:


1. The chart is not updated anymore, bars don´t move/change

2. The EA gets no events anymore like OnTick() or OnTimer()

3. The indicator gets no events anymore like OnCalculate() or OnTimer()

4. All other indicators in other charts get no events anymore

5. MetaTrader is NOT frozen, the Market Watch is still updating, the chart can still be scrolled etc.

6. Chart-Refresh using the option in the context menu of the chart is not helping

7. After a while, roughly 1 minute, it all recovers and comes back to life again

8. It can be manually refreshed by toggling the Autotrading-Feature by clicking the button in the toolbar


This bug cannot be debugged, since there are simply no events anymore, this also excludes any problems in the code. It also does not appear on performant machines, but occurs on VPS, but also not with any. In general we can state: The weaker the machine and the higher the CPU usage, the sooner it occurs. 

Within these two years of searching the reason, we tried a lot of things. My first suspect was ChartEventCustom(), since I know from earlier tests that MT will crash sooner or later when you try to communicate between EA and indicator using ChartEventCustom(), but its not. The described behavior happens also when there is no connection at all between EA and indicator, they just have to be on the same chart. Both even don´t access mutual files, don´t access the chart objects of the other, just nothing. 

What concerns me the most is the fact, that in view of Windows-Thread-Management, the EA and the indicator even also don´t have a mutual thread, since EAs have their own thread and indicators are all in one. Furhermore: The chart itself gets no updates anymore, same time the symbol in the Market Watch is updated. This all makes no sense at all, but in fact it's a massive problem which costs us clients and a lot of money. 

It would be already helpful if we would know what exactly MetaQuotes changed since 2755, but no matter what it was: It is not working as it should and it is a bug within MT5 (since its only there after 2755) which we even cannot surround. We spent not only hours, we spent weeks and months to find the reason, to re-create the way of communication and handling events within EA and indicators, created debug apps, etc. since we assumed it could be caused by the code, but we kind of reached the end of any ideas. And MetaQuotes? No answer at all anymore since 2021. 

Many brokers, thousands of clients and some companies rely on our codes, the situation as it is, is a total disaster and we appreciate any ideas and help.

Thank you in advance for your ideas, guys. 


i am having the same problem, and it is taking my time
hopefully it really gets resolved

 
Doerk Hilger:

Since two years we are facing the same bug in MT5 which wasn´t there before. 2755 was the last build which made no problems, all builds afterwards come with the same issue. There must have been a general change within the task management of MetaTrader 5, but we got no help from MetaQuotes to isolate and/or solve this bug. 

And yes, we provided source code, more than 20.000 lines of code, the bug was/is reproducible, but not with a few lines of code only. This bug occurs only, when there is an EA and an indicator on the same chart. When it occurs, this happens:


1. The chart is not updated anymore, bars don´t move/change

2. The EA gets no events anymore like OnTick() or OnTimer()

3. The indicator gets no events anymore like OnCalculate() or OnTimer()

4. All other indicators in other charts get no events anymore

5. MetaTrader is NOT frozen, the Market Watch is still updating, the chart can still be scrolled etc.

6. Chart-Refresh using the option in the context menu of the chart is not helping

7. After a while, roughly 1 minute, it all recovers and comes back to life again

8. It can be manually refreshed by toggling the Autotrading-Feature by clicking the button in the toolbar


This bug cannot be debugged, since there are simply no events anymore, this also excludes any problems in the code. It also does not appear on performant machines, but occurs on VPS, but also not with any. In general we can state: The weaker the machine and the higher the CPU usage, the sooner it occurs. 

Within these two years of searching the reason, we tried a lot of things. My first suspect was ChartEventCustom(), since I know from earlier tests that MT will crash sooner or later when you try to communicate between EA and indicator using ChartEventCustom(), but its not. The described behavior happens also when there is no connection at all between EA and indicator, they just have to be on the same chart. Both even don´t access mutual files, don´t access the chart objects of the other, just nothing. 

What concerns me the most is the fact, that in view of Windows-Thread-Management, the EA and the indicator even also don´t have a mutual thread, since EAs have their own thread and indicators are all in one. Furhermore: The chart itself gets no updates anymore, same time the symbol in the Market Watch is updated. This all makes no sense at all, but in fact it's a massive problem which costs us clients and a lot of money. 

It would be already helpful if we would know what exactly MetaQuotes changed since 2755, but no matter what it was: It is not working as it should and it is a bug within MT5 (since its only there after 2755) which we even cannot surround. We spent not only hours, we spent weeks and months to find the reason, to re-create the way of communication and handling events within EA and indicators, created debug apps, etc. since we assumed it could be caused by the code, but we kind of reached the end of any ideas. And MetaQuotes? No answer at all anymore since 2021. 

Many brokers, thousands of clients and some companies rely on our codes, the situation as it is, is a total disaster and we appreciate any ideas and help.

Thank you in advance for your ideas, guys. 

To whom was sent the source code ?
Reason: