error when assigning array values

 

Hi, Could someone please help to explain why below array assignment is wrong

And what is the correct way of doing it

many thanks in advance.

double bandU    =iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 0);
double bandM    =iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_MAIN, 0);
double bandL    =iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 0);
        
double MA5      =iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 0);
double MA20     =iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0);
double MA120    =iMA(NULL, 0, 120, 0, MODE_EMA, PRICE_CLOSE, 0);
double MA200    =iMA(NULL, 0, 200, 0, MODE_EMA, PRICE_CLOSE, 0);

double arrayvalue[7]  ={bandU, bandN, bandL, MA5, MA20, MA120, MA200};
 
holdenmcgorin:

Hi, Could someone please help to explain why below array assignment is wrong

Welcome to the looking-glass world of MQL4, similar but subtly different to languages which I suspect you're used to writing in. You can't initialise arrays in MQL4 with variables, only with constants.
 

thank you jjc :)

Reason: