Misterious random, general and persistent lag in real time account

 

Hi,

I'm here asking for help in trying to understand what could possibly be the cause of a curious lag problem I'm experiencing in the last weeks.

So some weeks ago, I opened my real time account of a certain Brazilian broker to trade in the futures market and noticed it was laggy: the chart wasn't updating as quick and frequent as it should be. I confirmed that by comparing the chart update to the same symbol in a demo account by another broker open in the same PC in a second MT5 installation. Assuming it could be my EA or one of my indicators, I unloaded everything, but the problem persisted. I closed the chart and the Terminal, reload them and it persisted. So I assumed it was a problem with the broker, failing to send me the chart data, and so I reported it and closed it till the next day. 24h later, when I opened the Terminal, everything was fine apparently confirming my hypothesis and I moved on.

But this problem appeared again in the following days at least another 3 times and I started to wonder if it was truly the broker's fault. So in the 4th occasion, with the chart lagging, I opened the same real time account in a 3rd MT5 installation in a second PC and, for my surprise, everything was fine there. I then supposed the problem wasn't with the broker, but in my MT5 installation that may have gone corrupt due to power shortages, BSODs, etc., so I made a new MT5 installation in my PC (the one with the lag problem), loaded the real time account and, guess what, it was 100% fine apparently confirming my hypothesis of corrupt installation. A couple of minutes later, though, and with some closing and reopening the recently installed Terminal, guess what: it became laggy too! Thus throwing away the corrupt files hypothesis. 

Since that day, I passed like 2 weeks without seeing this problem again until yesterday. One thing I noticed since then during my tests is that the lag seems to be related with the firing of events on the Terminal's part: once the lag starts, it's not like there is some code within OnTick that makes it very slow, is the chart update that doesn't occurr as frequent as it should coupled with lesser firing of OnTick. Moreover, the OnTimer event also gets laggy: in my EA, I have a decremental clock related to the OnTimer function and it also lags when the problem occurrs. And of course, as already reported, the lag doesn't go away after I unload all EAs and indicators.

So, in summary: it can't be the broker since two separated installations connected to the same account don't show the lag at the same time. It can't be something with my EAs or indicators because unloading them, shutting down the Terminal and restarting my PC doesn't fix the problem. It's not a broken installation problem either. The problem goes away as misteriously as it comes with the only detail that it only goes away in the next day (if the lag occurs, during the whole day opening that Terminal will show the lag).

With all that in mind, I'm starting to think it's a problem in the latest MT5 version since I never experienced anything like that before in +5 years with MT5. Considering the possibility the problem may start with some faulting loading of my products, I note that the latest change I remember doing to my EA before the problem started to persist was some calls to the Terminal's Global Variables system using them as mutex to flag access to a SQLite database shared between mutiple instances of my EA, this is a context where this problem never occurred in my demo account, where only one of this EA is loaded, nor in the real time account before when I also used only one instance of my EA (now I have 4). So my current hypothesis is that maybe the Global Variables system is buggy and "activates" the bug when multiple charts try to use them at the same time, what could possibly explain why the problem continues even after restarting the PC with nothing loaded in the Terminal (since the GV system is thread-safe, I suppose it does stuff with the Windows's kernel).

Well, in case I wasn't clear enough, here is a video showing the problem:

  .

Further info:

2024.08.21 17:25:24.611 Terminal MetaTrader 5 x64 build 4410 started for MetaQuotes Software Corp.

2024.08.21 17:25:24.612 Terminal Windows 10 build 19045, 16 x AMD Ryzen 7 1800X Eight-Core, AVX2, 6 / 15 Gb memory, 57 / 231 Gb disk, UAC, GMT-3

Any help will be appreciated!

 
Hello friend, I have the exact same problem as you and I've tried everything and haven't seem to figure out a solution to it yet. 

My mt5 started lagging a couple of weeks ago, I am using blueberrymarkets as my broker and I've tried to contact them several times but they keep saying they can't see the problem.

So I don't think it is the broker's problem as you wrote aswell, I've tried to do everything google, reddit and other posts advise me to do to stop getting it to lag, but none of those things work and you're the first person I've seen that has the same problem as me.

I trade XAUUSD and it has been running smoothly with no lag for 6 months up until 2 weeks ago, then it started to lag and everything went slow and it's like my mt5 chart went from being 60FPS to like 15FPS if you know what I mean.

I then tried to go on another live account on another broker, then it was smooth for a week or so and then it became laggy aswell, very weird.

I then tried to load up a us30 chart yesterday, it was very smooth with no lag, then I reopen mt5 today and all of a sudden my us30 chart is also lagging now

You can see it here: (look closely) 

My live blueberrymarkets account:  <link from external source was deleted by moderator>

My other broker before the lag (this was 2 weeks before it started lagging aswell): <link from external source was deleted by moderator>

It is very annoying and I can't seem to find a solution to it, I dont use EA's and I only trade one pair (XAUUSD)

I hope we find a solution, I will keep you updated if I find one and I hope you won't forget to text me if you find a solution to it.

Thank you, best regard from Denmark
 
HanckFX #:
Hello friend, I have the exact same problem as you and I've tried everything and haven't seem to figure out a solution to it yet. 

My mt5 started lagging a couple of weeks ago, I am using blueberrymarkets as my broker and I've tried to contact them several times but they keep saying they can't see the problem.

So I don't think it is the broker's problem as you wrote aswell, I've tried to do everything google, reddit and other posts advise me to do to stop getting it to lag, but none of those things work and you're the first person I've seen that has the same problem as me.

I trade XAUUSD and it has been running smoothly with no lag for 6 months up until 2 weeks ago, then it started to lag and everything went slow and it's like my mt5 chart went from being 60FPS to like 15FPS if you know what I mean.

I then tried to go on another live account on another broker, then it was smooth for a week or so and then it became laggy aswell, very weird.

I then tried to load up a us30 chart yesterday, it was very smooth with no lag, then I reopen mt5 today and all of a sudden my us30 chart is also lagging now

You can see it here: (look closely) 

My live blueberrymarkets account:  <link from external source was deleted by moderator>

My other broker before the lag (this was 2 weeks before it started lagging aswell): <link from external source was deleted by moderator>

It is very annoying and I can't seem to find a solution to it, I dont use EA's and I only trade one pair (XAUUSD)

I hope we find a solution, I will keep you updated if I find one and I hope you won't forget to text me if you find a solution to it.

Thank you, best regard from Denmark

I reinstalled mt5 and deleted all personal data in mt5, installed it again trough my broker's mt5, XAUUSD is still lagging but now US30 is smooth again, very weird, but my US30 chart will probably start lagging again in the next following days, I will keep you updated, I really hope we can figure out a solution to this since it's very annoying and its affecting our live trading...

 
HanckFX #:

I reinstalled mt5 and deleted all personal data in mt5, installed it again trough my broker's mt5, XAUUSD is still lagging but now US30 is smooth again, very weird, but my US30 chart will probably start lagging again in the next following days, I will keep you updated, I really hope we can figure out a solution to this since it's very annoying and its affecting our live trading...

Well that might sound evil of me, but I'm kinda happy I'm not the only one experiencing this problem hahaha I mean, it gives evidence it might be something on MT5's part, not mine/our fault. I'm already tired of looking into my code trying to see if it could be something on my part (and now that you said you don't even use EAs and have this problem, that gives me a relief).

For now, what I've done is having two installations dedicated to real time trading and when one is laggy, I close it and open the other hoping it's not also problematic and continue my life from there. And if this is indeed a problem of MT5, I suppose this will be the way until a fix is found :T Until then, let's see if other users report the same problem and come with some information that might help us.

 
Once checked the connectivity, it's always a custom code issue (from my experience reading all on this forum the last 12 years).
 
Alain Verleyen #:
Once checked the connectivity, it's always a custom code issue (from my experience reading all on this forum the last 12 years).
I am not sure it's the connection because I can clearly see when it's laggy and when it's smooth, for example to update what I wrote yesterday that my US30 chart was running smooth again and I was expecting it to go laggy in the next couple of days, yeah well the day after I wrote that it's now super laggy again, I can see both on my pc and on my iphone on mt5 both places when it's smooth vs laggy, yesterday everything was smooth on US30 both on my windows 11 pc and my iphone 11 pro, now it's laggy on both devices again... maybe it has something to do with something happening overnight, I am not sure, it is just very annoying. 

But yeah to sum it up, everything is lagging and running slow again... but i've been noticing something, when my spreads on XAUUSD were floating like jumping very quick between 15-25 (2 weeks ago prior to lag) it was running smooth and responding very fast like everything was fast, but now my spreads on XAUUSD is fixed to 10 all the time (even tho it's not true when there is volatility, then it's more like 30-40 but it still says fixed 10 spreads) and now XAUUSD is laggy + to add to that yesterday my spreads on US30 were fixed to 100 ticks on both my pc and phone and it was running smoothly, now today it's fixed to 130 ticks spreads (on both devices) and it's very laggy again... so maybe that has something to do with it, even tho i've texted the broker and they can't seem see the problem. (mind you this is at the same session with the same amount of volume in the markets) 

So in my case when my spreads on XAUUSD are fixed to 10 it is laggy, when my spreads on XAUUSD is floating it is smooth, and when my spreads on US30 is 130 it's laggy, when my spreads on US30 is 100 it's running smoothly, I am not sure why tho and if that even has something to do with it, it's just something iv'e noticed, that and also the overnight thing...

I hope we figure out a solution to this soon.
 
HanckFX #:
I am not sure it's the connection because I can clearly see when it's laggy and when it's smooth, for example to update what I wrote yesterday that my US30 chart was running smooth again and I was expecting it to go laggy in the next couple of days, yeah well the day after I wrote that it's now super laggy again, I can see both on my pc and on my iphone on mt5 both places when it's smooth vs laggy, yesterday everything was smooth on US30 both on my windows 11 pc and my iphone 11 pro, now it's laggy on both devices again... maybe it has something to do with something happening overnight, I am not sure, it is just very annoying. 

But yeah to sum it up, everything is lagging and running slow again... but i've been noticing something, when my spreads on XAUUSD were floating like jumping very quick between 15-25 (2 weeks ago prior to lag) it was running smooth and responding very fast like everything was fast, but now my spreads on XAUUSD is fixed to 10 all the time (even tho it's not true when there is volatility, then it's more like 30-40 but it still says fixed 10 spreads) and now XAUUSD is laggy + to add to that yesterday my spreads on US30 were fixed to 100 ticks on both my pc and phone and it was running smoothly, now today it's fixed to 130 ticks spreads (on both devices) and it's very laggy again... so maybe that has something to do with it, even tho i've texted the broker and they can't seem see the problem. (mind you this is at the same session with the same amount of volume in the markets) 

So in my case when my spreads on XAUUSD are fixed to 10 it is laggy, when my spreads on XAUUSD is floating it is smooth, and when my spreads on US30 is 130 it's laggy, when my spreads on US30 is 100 it's running smoothly, I am not sure why tho and if that even has something to do with it, it's just something iv'e noticed, that and also the overnight thing...

I hope we figure out a solution to this soon.

So you are saying you are not using any custom code ? No Ea, no script, no indicator, no services ? And also no custom symbol ? Please confirm.

Are you using a demo or real account ?

What are the ping to servers ? You can see it in the bottom right corner, something like this :


 
Alain Verleyen #:
Once checked the connectivity, it's always a custom code issue (from my experience reading all on this forum the last 12 years).

Well, I find it a little hard to believe it would be a custom code problem since, as stated, when the problem starts in some day, I unload every indicator, EA, close ever chart, close the terminal, restart the computer, open the terminal, load the WIN chart (thus completely naked) and the problem persists. I can't imagine how a custom code would still produce such lags after this routine :T 

About the connectivity hypothesis, I also can't see how that could be the case since, as stated, if the lag appears in one MT5 installation, I than open another with the same real life account and normally (all the cases till now) everything is running fine, with EAs and indicators and everything. In fact, since the day I wrote this post I got 3 days of consecutive lag in my installation 1 and today, once again 'out of nowhere', everything was fine and I traded normally in that Terminal. 

Regarding the list of access points, I never tried to change that when the lag occurs. Next time I'll try and provide the feedback, maybe it will give some light. 

And regarding the overnight hypothesis: since I never got the fixing of problem in the same day it occurs, only some day later (often the immediate next day, but this week only 3 days later), I think it has some merit.

 
Martin Bittencourt #:

Well, I find it a little hard to believe it would be a custom code problem since, as stated, when the problem starts in some day, I unload every indicator, EA, close ever chart, close the terminal, restart the computer, open the terminal, load the WIN chart (thus completely naked) and the problem persists. I can't imagine how a custom code would still produce such lags after this routine :T 

About the connectivity hypothesis, I also can't see how that could be the case since, as stated, if the lag appears in one MT5 installation, I than open another with the same real life account and normally (all the cases till now) everything is running fine, with EAs and indicators and everything. In fact, since the day I wrote this post I got 3 days of consecutive lag in my installation 1 and today, once again 'out of nowhere', everything was fine and I traded normally in that Terminal. 

Regarding the list of access points, I never tried to change that when the lag occurs. Next time I'll try and provide the feedback, maybe it will give some light. 

And regarding the overnight hypothesis: since I never got the fixing of problem in the same day it occurs, only some day later (often the immediate next day, but this week only 3 days later), I think it has some merit.

All this sounds a bit like a congested network connection, maybe some other device on the network, maybe even infected, using all available bandwidth.
 
Martin Bittencourt #:

Well, I find it a little hard to believe it would be a custom code problem since, as stated, when the problem starts in some day, I unload every indicator, EA, close ever chart, close the terminal, restart the computer, open the terminal, load the WIN chart (thus completely naked) and the problem persists. I can't imagine how a custom code would still produce such lags after this routine :T 

About the connectivity hypothesis, I also can't see how that could be the case since, as stated, if the lag appears in one MT5 installation, I than open another with the same real life account and normally (all the cases till now) everything is running fine, with EAs and indicators and everything. In fact, since the day I wrote this post I got 3 days of consecutive lag in my installation 1 and today, once again 'out of nowhere', everything was fine and I traded normally in that Terminal. 

Regarding the list of access points, I never tried to change that when the lag occurs. Next time I'll try and provide the feedback, maybe it will give some light. 

And regarding the overnight hypothesis: since I never got the fixing of problem in the same day it occurs, only some day later (often the immediate next day, but this week only 3 days later), I think it has some merit.

Can you run a fresh MT5 installation on your real account, without running anything additional ? Is it lagging ?

If it never lags you will have the confirmation that the hypothesis of "running custom code" is still on the table. The fact you don't see "how" or don't believe something, is not a scientific argument. You can't never exclude an hypothesis based on a belief.

"Considering the possibility the problem may start with some faulting loading of my products, I note that the latest change I remember doing to my EA before the problem started to persist was some calls to the Terminal's Global Variables system using them as mutex to flag access to a SQLite database shared between mutiple instances of my EA ". If you don't believe it comes from your code, why these statements ?


Other points : how much charts (symbols) are you running ? (sorry if you already said it, I will not read all the topic). Did you use the MT5 task manager (F2) to check if it gives any useful information ?

" I'm starting to think it's a problem in the latest MT5 version " : did you try with the previous release version ?

 
Alain Verleyen #:

Can you run a fresh MT5 installation on your real account, without running anything additional ? Is it lagging ?

If it never lags you will have the confirmation that the hypothesis of "running custom code" is still on the table. The fact you don't see "how" or don't believe something, is not a scientific argument. You can't never exclude an hypothesis based on a belief.

"Considering the possibility the problem may start with some faulting loading of my products, I note that the latest change I remember doing to my EA before the problem started to persist was some calls to the Terminal's Global Variables system using them as mutex to flag access to a SQLite database shared between mutiple instances of my EA ". If you don't believe it comes from your code, why these statements ?


Other points : how much charts (symbols) are you running ? (sorry if you already said it, I will not read all the topic). Did you use the MT5 task manager (F2) to check if it gives any useful information ?

" I'm starting to think it's a problem in the latest MT5 version " : did you try with the previous release version ?

I think it is an account problem, both my devices are laggy at the same time, both my iphone with mt5 and my pc with mt5, I've also tried different internet connections at different locations on different devices, still laggy, I've uninstalled, reinstalled and installed mt5 through both my brokers platform and mt5's own platform still laggy, but I can clearly see when it's smooth and when it's laggy on all my 3 devices incl my iphone's mt5, I noticed on friday that at 09:30 am est (market open) on US30 my spreads went from fixed 130 ticks to fixed 100 ticks, and if you have read my prev post about this i've noticed that all my devices are laggy when my spreads are fixed at 130 ticks on US30 and it's smooth when it's fixed at 100 ticks, on gold however it's always smooth when my spreads are floating and it's laggy when its fixed 10 points,I can clearly see this on my phone also as I have the spreads tab open I can see on the spreads before opening my chart if it's going to be laggy or smooth

My internet is fiber, something like 800/500 and I use an ethernet cable, i've tried both wired connection and wireless connection so it's 100% not an internet problem but an account problem

Not to mention some of my friends use the same broker with a live acc aswell, no lag for them... (I also run no EA's or indicators)