Message: 1 parameter for ArrayCopy function must be array

 

Hello,

I want to copy data, which was exported by a CSV file, and paste it in the EA. Then automatically re-arrange the data (one element at the time) in an new array. In such way that colums become rows and rows become colums. Then sort the data in het new array automatically. I wrote the following text:

for(int nCol=0; nCol<nNumCols; nCol++)
{
string ColumnArray = StringConcatenate (arrayEURUSD_Alpari_,nCol);
for(int nRow=0; nRow<nSizeArray; nRow=nRow+nNumCols)
{
string RowArray = StringConcatenate (arrayEURUSD_Alpari_,nRow);
int TempRowBuffer = nRow/nNumCols;

int TempElementBuffer = nRow+nNumCols;

ArrayCopy(RowArray, // destinationArray.
arrayEURUSD_Alpari, // sourceArray.
nRow,TempElementBuffer,1 ); // start of destination array, start of source array, 1 = number of elements to be copied
}

}

This produces the following message: 1 parameter for ArrayCopy function must be array.

Does anybody have an idea what i did wrong?

 

RowArray is not an array.

Naming it with "Array" at the end does nothing to make it one either.

 

Hello brewmanz,


Thanks for the reply. The problem seems to be that the string RowArray is not an Array, like you mentioned. This leaves me wit an other problem. Is it possible,in any way or form, with a for next loop to select different array's ? In example 1 there is obviously no problem, but I want it do it automatically, like in example 2. But example 2 doesn't work. Is there any other way?

//===============EXAMPLE 1=================+

double Array_X[5] = {6,7,8,9,10,};
double Array_0[1]; ArrayCopy(Array_0,Array_X,0,0,1);
double Array_1[1]; ArrayCopy(Array_1,Array_X,0,1,1);
double Array_2[1]; ArrayCopy(Array_2,Array_X,0,2,1);
double Array_3[1]; ArrayCopy(Array_3,Array_X,0,3,1);
double Array_4[1]; ArrayCopy(Array_4,Array_X,0,4,1);
//
for(int x=0;x<5;x++)
{
if(x == 0) Print(Array_0[0]);
if(x == 1) Print(Array_1[0]);
if(x == 2) Print(Array_2[0]);
if(x == 3) Print(Array_3[0]);
if(x == 4) Print(Array_4[0]);

}

//==============EXAMPLE 2===================+

string ArrayName;
string Array_;
for(int y=0;y<5;y++)
{
ArrayName = StringConcatenate(Array_,y);
Print(ArrayName,[0]);
}

 

A)

B) Yes. Use array of arrays. e.g.

double ArrOfArr[][10];
 

Thanks brewmanz!

Reason: