MT5 incomplete chart data issue after switching symbol on weekend or closed market

 
I have a chart symbol changer indicator <Deleted> and a daily open line indicator (https://www.mql5.com/en/code/18523) that I put on a chart in MT5.

The problem is when market is closed (on weekend for forex especially) and if I switched the symbol with chart symbol changer indicator, the chart data often looks incomplete (see the attached "AUDCHFH1_1.png"). If I scroll the chart or click refresh, the complete chart data will be loaded (see the attached "AUDCHFH1_2.png"). The daily open lines on chart would show the difference easily.

This might be a minor issue, but I'm curious what happened here and how do I prevent this issue in the code? As this issue doesn't happen in MT4.
 

On the weekend, broker's servers shut down for maintenance/backup. How do you expect the terminal to update charts if it can't download from the server?

It does happen on MT4, you just didn't notice.

 
William Roeder #:

On the weekend, broker's servers shut down for maintenance/backup. How do you expect the terminal to update charts if it can't download from the server?

It does happen on MT4, you just didn't notice.

I never see that problem really happens in MT4. It seems the problem is how the chart data loading in closed market is handled differently between MT4 and MT5. In MT4, if I switch the chart to forex symbol that I rarely check (so the data will be out of sync for a long time) with chart symbol changer indicator in closed market condition, I can see the chart looks incomplete for a short moment and then it will get loaded properly (it's just like MT4 has auto load/refresh feature). But in MT5, it won't load the data automatically, you have to scroll the chart or click refresh or switch timeframe back and forth to trigger the chart data loading.

Is there a way to trigger the data load in MT5 by code? 

 
xtemer #: I never see that problem really happens in MT4. It seems the problem is how the chart data loading in closed market is handled differently between MT4 and MT5. In MT4, if I switch the chart to forex symbol that I rarely check (so the data will be out of sync for a long time) with chart symbol changer indicator in closed market condition, I can see the chart looks incomplete for a short moment and then it will get loaded properly (it's just like MT4 has auto refresh feature). But in MT5, it won't load the data automatically, you have to scroll the chart or click refresh or switch timeframe back and forth to trigger the chart data loading. Is there a way to trigger the data load in MT5 by code? 

MT4 and MT5 store the data differently. In MT4, it has a file for each time-frame (*.hst files), so when you switch the data is already cached for you.

On MT5, data is stored as M1 bars only (*.hcc files), and when you switch the data for that time-frame needs to be recalculated. However, sometimes, network delays or CPU load can affect it.

Having missing data in the middle of the chart, I have never seen happen to me, but some users have reported it, usually on weekends, so I suspect it has to do with network delays with the broker when they are under maintenance.

The usual solution has been to scroll the chart to the beginning ([Home] Key) and then to the end again ([End] key).