Timeseries access and documentation confusion re: CopyXXX() functions... - page 3

 

Oh, and for anyone else reading these posts, I've also discovered that CopyXXX doesn't return a -1 if 'count' is greater than the terminals MAX_BARS as the documentation states. I've submitted a bug to this effect. The script below confirms this: 

void OnStart() {  
  
    string symbol1 = "USDDKK";
    int count = 100050;
    ENUM_TIMEFRAMES period = PERIOD_H1;
    
    datetime times[];
    ArraySetAsSeries(times, true);
    
    Print("Count: " + count +  "  MAXBARS: ", TerminalInfoInteger(TERMINAL_MAXBARS));

    ResetLastError();
    int numOfBars = CopyTime(symbol1, period, 0, count, times);
    Print("Err: ",GetLastError());
}     

 Which results with:

 ED 0 Test1 (CADCHF,H4) 10:24:10 Count: 100050  MAXBARS: 10000

FQ 0 Test1 (CADCHF,H4) 10:24:10 Err: 0


Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
 
cowil:

Hi,

Thanks again for your quick responses.

I've had the return codes you mentioned above occasionally, when no data for the Symbol has been downloaded yet and CopyXXX has timed out. However, if you're running an Expert, chances are that the bulk of the data is already downloaded - you only want to update the data. In THAT situation, CopyXXX doesn't give any indication as to whether the data in the array it returns is out of date or up to date. Oh, and I'm afraid I can't do your test with a slow data link as I can't slow my link down at all.

And thanks angevoyageur for your input as well. "SeriesInfoInteger(symbol,period,SERIES_SYNCHRONIZED)" definitely seems to do trick. 

Included in the two files are the results of the script phi.nuts provided for two Symbols. The first set of results (first iteration) shows that CopyXXX basically says "all is well", despite having provided out-of-date data in the array it returns. To generate the second set of results, I included the line:

 in the script. As can been seen, when the data has been properly updated, "SeriesInfoInteger(symbol1, period, SERIES_SYNCHRONIZED)" returns true. The other bizarre thing I noticed is that in the second set of results, the start and end dates of the second and third iteration are already correct but the number of bars (975) doesn't yet reflect the final number of bars (1184).

And in all cases, count == numOfBars...

A little remark only, data in the array are up-to-date in mentionned case. This is not "out-of-date" data but incomplete data.
 
angevoyageur:
A little remark only, data in the array are up-to-date in mentionned case. This is not "out-of-date" data but incomplete data.
Fair enough. :)
Reason: