What is wrong with this code?

 

Hi,

I need help with this code:

double v[5] = {iRSI(NULL,240,14,0,0), iRSI(NULL,60,14,0,0),iRSI(NULL,15,14,0,0),iMA(NULL,60,14,8,MODE_SMMA,PRICE_MEDIAN,0),iClose(NULL,15,0)};

I got the following errors:

'240' - variable expected

')' - unbalanced right parenthesis

Can anybody tell me why?

thanks

 
Hi,

you cannot use function calls in the initializationof arrays.
From the manual (https://docs.mql4.com/basis/variables/initialization):

"All arrays, including those declared in the local scope, can be initialized with constants only."

Cheers!

Max
 
MaxPayne:
Hi,

you cannot use function calls in the initializationof arrays.
From the manual (https://docs.mql4.com/basis/variables/initialization):

"All arrays, including those declared in the local scope, can be initialized with constants only."

Cheers!

Max

Thanks a lot.