ArrayCopyRates() not working properly, error 4063 and wrong period

 

It seems that ArrayCopyRates() has a wrong behavior.

It returns an error which has no meaning for it 4063 (ERR_INTEGER_PARAMETER_EXPECTED)

What am I missing here??

Thanks

double data[][6];

string temp = "";


ArrayCopyRates(data, "EURUSD", "PERIOD_D1");

temp = temp + GetLastError()+"\n";

temp = temp + "D1 1st: "+TimeToStr(data[0][0])+" Open "+data[0][1]+"\n";

temp = temp + "D1 2nd: "+TimeToStr(data[1][0])+" Open "+data[1][1]+"\n\n";

Comment(temp);


The chart is set to M1, and it overrides the requested D1:

 
yair20m:

It seems that ArrayCopyRates() has a wrong behavior.

It returns an error which has no meaning for it 4063 (ERR_INTEGER_PARAMETER_EXPECTED)

What am I missing here??

Thanks

double data[][6];

string temp = "";


ArrayCopyRates(data, "EURUSD", "PERIOD_D1"); // "EURUSD" is a String, PERIOD_D1 is Integer not a String, "PERIOD_D1" is a String, Got it ?

temp = temp + GetLastError()+"\n";

temp = temp + "D1 1st: "+TimeToStr(data[0][0])+" Open "+data[0][1]+"\n";

temp = temp + "D1 2nd: "+TimeToStr(data[1][0])+" Open "+data[1][1]+"\n\n";

Comment(temp);


The chart is set to M1, and it overrides the requested D1:

Hi yair20m,

Look carefully, The third parameter of ArrayCopyRates() is Integer not a String, yet you wrote it with double quotes like a String. It should be PERIOD_D1 (without double quotes) and not "PERIOD_D1" (with double quotes). Look at example on a link.

Got it ?

:D

 

Oooops..

Sorry, a beginner error in MQL4. it should be:

ArrayCopyRates(data, "EURUSD", PERIOD_D1);

and NOT

ArrayCopyRates(data, "EURUSD", "PERIOD_D1");

Now it works fine :)