Access to Timeseries and Indicator Data
These are functions for working with timeseries and indicators. A timeseries differs from the usual data array by its reverse ordering - elements of timeseries are indexed from the end of an array to its begin (from the most recent data to the oldest ones). To copy the time-series values and indicator data, it's recommended to use dynamic arrays only, because copying functions are designed to allocate the necessary size of arrays that receive values.

It is historically accepted that an access to the price data in an array is performed from the end of the data. Physically, the new data are always written at the array end, but the index of the array is always equal to zero. The 0 index in the timeseries array denotes data of the current bar, i.e. the bar that corresponds to the unfinished time interval in this timeframe.
A timeframe is the time period, during which a single price bar is formed. There are 21 predefined standard timeframes.
The Organizing Data Access section describes details of receiving, storing and requesting price data in the MetaTrader 5 client terminal.
Function |
Action |
Returns information about the state of historical data. |
|
Returns the number of bars the history for a specified symbol and period. |
|
Returns the number of calculated data in an indicator buffer or -1 in the case of error (data hasn't been calculated yet). |
|
Remove the indicator handle and release the calculation block of the indicator, if it no one else enjoys. |
|
Returns the handle to the specified technical indicator created by an array of type parameters MqlParam. |
|
Gets data of a specified buffer from a specified indicator into an array. |
|
Gets history data of the Rates structure for a specified symbol and period into an array. |
|
Gets history data on bar opening time for a specified symbol and period into an array. |
|
Gets history data on bar opening price for a specified symbol and period into an array. |
|
Gets history data on maximal bar price for a specified symbol and period into an array. |
|
Gets history data on minimal bar price for a specified symbol and period into an array. |
|
Gets history data on bar closing price for a specified symbol and period into an array. |
|
Gets history data on tick volumes for a specified symbol and period into an array. |
|
Gets history data on trade volumes for a specified symbol and period into an array. |
|
Gets history data on spreads for a specified symbol and period into an array. |
Despite the fact that by using the ArraySetAsSeries() function it is possible to set up in arrays access to elements like that in timeseries, it should be remembered that the array elements are physically stored in one and the same order - only indexing direction changes. To demonstrate this fact let's perform an example:
datetime TimeAsSeries[]; |
As a result we will get the output like this:
TimeCurrent = 2009.06.11 14:16:23 |
As we see from the output, as the index of TimeAsSeries array increases, the time value of the index decreases, i.e. we move from the present to the past. For the common array ArrayNotSeries the result is different - as index grows, we move from past to present.
See Also
ArrayIsDynamic, ArrayGetAsSeries, ArraySetAsSeries, ArrayIsSeries
© 2000-2010, MetaQuotes Software Corp.
