MQL4 Reference Array Functions ArrayCopyRates
ArrayCopyRatesCopies rates data to the array and returns the amount of bars copied. There are 2 variants of the function:
Copies rates data to the RateInfo[][6] two-dimensional array of double type and returns the amount of bars copied.
Parameters rates_array[] [out] Destination array of MqlRates type. dest_array[] [out] Two-dimensional destination array of double type. symbol=NULL [in] Symbol name. timeframe=0 [in] Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe. Returned value The function returns copied bars amount, or -1 if failed. If data (symbol name and/or timeframe differ from the current ones) are requested from another chart, the situation is possible that the corresponding chart was not opened in the client terminal and the necessary data must be requested from the server. In this case, error ERR_HISTORY_WILL_UPDATED (4066 - the requested history data are under updating) will be placed in the last_error variable, and one will has to re-request (see example of ArrayCopySeries()). Note This rates array is normally used to pass data to a DLL function. In the first variant of the function it performs the virtual data copying to the array of MqlRates type. It means that if timeseries data has been updated, rates_array[] array always will refer to the actual data. In the second variant it performs the real data copying to dest_array[][] array. The destination array will be resized to the size of the timeseries (even if the destination array has been declared as static). First dimension of RateInfo array contains bars amount, second dimension has 6 elements: 0 - time, Example:
|