Problems refreshing data: It seems as if RefreshRates was not working properly to refresh the arrays: Open, Close, Time, ...

 

Hello all
I am writing you because I have this problem: from time to time, my expert advisor does not get the most current data in the arrays Open[], Close[], Time[], etc. This problem happens randomly because it does not happen always, only sometimes. Firstly I thought that calling the RefreshRates() function before checking the arrays would solve my problem. However, altough I call this function more than once up to 50 times when I detect the problem, it continues withouth
updating the data I need.
For example, in a 15 minutes chart. Let's suppose that the current time is 15:51. Then the 15:45 bar is the last bar and it is being drawn right now:

a) Then if Open[0], Close[0] and Time[0] values are checked by the expert,
they do not contain the values they should, that is to say, those corresponding to the 15:45 minute bar which is the last bar still currently being drawn, but the values corresponding to the 15:30 period, that is to say, the previous bar to the last.

b) It happens as well some other times that Open[0], Close[0] and Time[0] contain values of previods which are
even previous to the period 15:30, like 15:15, 15:00, 14:45 or any other previous period.

I am still wondering why the RefreshRates() function does not work as it should. I think, there could be more people who had the same problem as me. I would appreciate any help you can provide me about this. I look forward to seeing your replies.

Thanks in advance for your time.

 

Did it happens on a Live Account, maybe you have a incorect brokerversion from metatrader. Have you trie to install new theterminal, maybe it helps.

 

Show your code...