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.
MqlRates mostRecent = rates;
MqlRates secondMostRecent = rates;
Print("time= "+ServerTimeToGMTTime(mostRecent.time)+" | open= "+mostRecent.open);
Print("time= "+ServerTimeToGMTTime(secondMostRecent.time)+" | open= "+secondMostRecent.open);
If I make a request now using the above code this is the output I get from the CopyRates
rates -> 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...