1. In this case, time out expiration is related to Copy function, not downloading or something else.
2. Copy function knows how much data needed to be downloaded because MT5 knows the current server time and compared with last known of last bar time.
3. Yes, Copy function can simply return -1 in EA/Script. CheckLoadHistory() in mql5 documentation is a user defined function (that is created by programmer) and not an mql5 function.
4. Don't forget to check GetLastError().
Hi,
Firstly, thanks for the response.
Re: point 2, I can see how comparing the dates would provide the total amount of data accurately for larger time frames. However, on smaller time frames (especially 1m), there may be no quote over a 1m period. I know that in MT4, no bar would be created for that particular 1m period. Does MT5 guarantee that a bar will be created for every minute period, even if no quote is received over that time? If this is not the case, than the number of bars returned by CopyXXX would be incorrect if that data is not yet available locally?
Re: point 3. According to the documentation, a -1 is returned (if CopyXXX is called within an Expert) when the requested data falls either outside the database of the Trading Server or outside the MAX_BARS setting of the Terminal. If the data needs to be downloaded or "assembled" locally, the correct number of bars is returned by the function, even though THAT DATA MAY NOT YET BE AVAILABLE LOCALLY. My understanding of the documentation is that a user defined function such as CheckLoadHistory() is required to ensure that the required data has been downloaded and assembled, prior to the CopyXXX being called - otherwise CopyXXX may contain only some of the requested data. Please correct me if I'm wrong on this as I'd LOVE to not have to call CheckLoadHistory() before every CopyXXX() (makes optimising very sllloooowwwww).
Thanks again for your help on this.