MQL4 Timeseries and Indicator Data Access
Overview
Functions for accessing timeseries and indicator data. Timeseries arrays are indexed in reverse order: the most recent data (current bar) is at index 0, and older data follows.
Data Handling
OnTick() or OnCalculate()), use statically allocated arrays to avoid dynamic array memory allocation overhead.ArraySetAsSeries(array, true) to enable this behavior.Asynchronous Access
Copy...() functions return an error immediately.ERR_HISTORY_WILL_UPDATED (4066) may be returned, requiring a re-request.Key Functions
| Function | Action |
| -------------------- | ---------------------------------------------------------------------- |
| SeriesInfoInteger | Returns information about historical data state. |
| RefreshRates | Refreshes data in pre-defined variables and series arrays. |
| CopyRates | Gets Rates structure history data for a specified symbol and period. |
| CopyTime | Gets bar opening time history data. |
| CopyOpen | Gets bar opening price history data. |
| CopyHigh | Gets maximal bar price history data. |
| CopyLow | Gets minimal bar price history data. |
| CopyClose | Gets bar closing price history data. |
| CopyTickVolume | Gets tick volume history data. |
| Bars | Returns the total number of bars in history for a symbol/period. |
| iBars | Returns the number of bars on the specified chart. |
| iBarShift | Returns the index of the bar covering a specified time. |
| iClose | Returns Close price for a specified bar, symbol, and timeframe. |
| iHigh | Returns High price for a specified bar, symbol, and timeframe. |
| iHighest | Returns the shift of the maximum value over a specific number of bars. |
| iLow | Returns Low price for a specified bar, symbol, and timeframe. |
| iLowest | Returns the shift of the lowest value over a specific number of bars. |
| iOpen | Returns Open price for a specified bar, symbol, and timeframe. |
| iTime | Returns time value for a specified bar, symbol, and timeframe. |
| iVolume | Returns Tick Volume for a specified bar, symbol, and timeframe. |
Array Indexing
ArraySetAsSeries(array, true) sets an array to behave like a timeseries (reverse indexing).ArraySetAsSeries(array, false) sets an array to standard indexing (forward indexing).Related Functions
ArrayIsDynamic()ArrayGetAsSeries()ArraySetAsSeries()ArrayIsSeries()SymbolInfoSessionTrade()