| int ArrayCopy( |
void dest[], object source[], int start_dest=0, int start_source=0, int count=WHOLE_ARRAY) |
Copies an array to another one. Arrays must be of the same type, but arrays with type double[],
int[], datetime[], color[], and bool[] can be copied as arrays of the same type.
Returns the amount of copied elements.
Parameters:
| dest[] |
- |
Destination array. |
| source[] |
- |
Source array. |
| start_dest |
- |
Starting index for the destination array. By default, start index is 0. |
| start_source |
- |
Starting index for the source array. By default, start index is 0. |
| count |
- |
The count of elements that should be copied. By default, it is WHOLE_ARRAY constant. |
Sample:
double array1[][6];
double array2[10][6];
// array2 is filled with some data
ArrayCopyRates(array1);
ArrayCopy(array2,array1,0,0,60);
// array2 is having the first 10 bars from the history now (first bar considered as bar with index [Bars-1])
ArrayCopy(array2,array1,0,Bars*6-60,60);
// array2 is having the last 10 bars from the history now (last bar considered as current bar, bar wit index [0])
|