Those functions are for downloading OHLC rates data (bars), not tick data.
However, irrespective of tick or OHLC data, one should implement synchronisation in one's code to take into account delays when requesting older data that the terminal has not yet downloaded, and then has to collect from the trading server.
Please read the following ... Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
I made a typing mistake, sorry about that. The failing functions are CopyTicks() and CopyTIcksRange(). And it happens when there is a lot of tick data loaded for a specific symbol, example 5 years of XAUUSD ticks will recreated the issue.
Those functions are for downloading OHLC rates data (bars), not tick data.
However, irrespective of tick or OHLC data, one should implement synchronisation in one's code to take into account delays when requesting older data that the terminal has not yet downloaded, and then has to collect from the trading server.
Please read the following ... Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
One of my brokers offers more than 10 years of tick data for some of the major currency pais and I have no such issues.
The only thing to remember is that you should consider the time it takes to download the tick data when you first request it, but once it is fully downloaded then there are no delays.
Usually, I first use the Symbols (Ctrl-U) panel to initiate the data request, and then wait until it has finished downloading all the data in the background (I monitor the directory where it is stored to known when it is done).
However, even if I don't do that, the function will timeout (see documentation ...)
CopyTicks() can wait for the result for 45 seconds in Expert Advisors and scripts: as distinct from indicators, every Expert Advisor and script operate in a separate thread, and therefore can wait 45 seconds till the completion of synchronization. If the required amount of ticks fails to be synchronized during this time, CopyTicks() will return available ticks by timeout and will continue synchronization. OnTick() in Expert Advisor is not a handler of every tick, it only notifies an Expert Advisor about changes in the market. It can be a batch of changes: the terminal can simultaneously make a few ticks, but OnTick() will be called only once to notify the EA of the latest market state.
GetLastError() can return the following errors:
- ERR_HISTORY_TIMEOUT — timeout for tick synchronization has expired, the function has returned all it had.
- ERR_HISTORY_SMALL_BUFFER — static buffer is too small. Only the amount the array can store has been returned.
- ERR_NOT_ENOUGH_MEMORY — not enough memory to receive historical data from the specified range into a dynamic tick array. Failed to allocate enough memory for the tick array.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone, my first post here. I'm a C++ programmer and decided to dip in MQL5 programming the past few years but an important issue I noticed with Meta Trader 5 is that when there is a lot of tick data eg. more than the last 5 years of XAUUSD worth of ticks I'm seeing CopyRates and CopyRatesRange fail to copy any ticks while producing no error code on completion. This usually happens when copying ticks that are older than 5 years or if the historical data for the symbol exceeds 5-6 years of ticks. CopyRates work fine, but I need tick data precision not bars.
I'm seeing the same issue on Dukascopy and SEC Markets clients. Has anyone else noticed this? Maybe it's time to file a bug with the maintenance team.