The error was inside the ServerTimeToGMTTime finction. Problem solved
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I am trying to update a CSV file with live rates. For this I am using CopyRates function.
I came across this problem while using this function. In brief, the error is CopyRates function's datetime and the rates does not match when the market is closed.
For an example let's say now GMT time is - 2016.06.04 14:03 which means now the market is closed.
If I make a request now using the above code this is the output I get from the CopyRates
rates[0] -> time= 2016.06.04 14:02:47 | open= 1.13659 which is the open time for the market closed minute 2016.06.03 23:59rates[1] -> time= 2016.06.04 14:01:47 | open= 1.1367 which is the open time for the (market closed minute - 1) 2016.06.03 23:58
So as you can see price for the time 2016.06.03 23:58 comes for 2016.06.04 14:01
Any idea what I'm doing wrong here?
Thanks in advance...