MQL4 - automated forex trading   /  

Forum

Set array element via variable

Back to topics list To post a new topic, please log in or register

avatar
78
billworld 2011.07.27 22:11 

I'm trying to set up an 18 element array of double values where the double values are previously set as variables. However, initializing an array as follows doesn't seem to work:


double Levels[18]={H1, HC1, M1, LC1, L1, O1, C1, P1, H2, HC2, M2, LC2, L2, H3, HC3, M3, LC3, L3};

How do I insert double values as variables into a double array?

Comparative Analysis of 30 Indicators and Oscillators

Comparative Analysis of 30 Indicators and Oscillators

The article describes an Expert Advisor that allows conducting the comparative analysis of 30 indicators and oscillators aiming at the formation of an effective package of indexes for trading.


avatar
78
billworld 2011.07.27 22:38 
double Levels[18]; Levels[0]=H1; Levels[1]=HC1; Levels[2]=M1; Levels[3]=LC1; Levels[4]=L1; Levels[5]=O1; Levels[6]=C1; Levels[7]=P1; Levels[8]=H2; Levels[9]=HC2; Levels[10]=M2; Levels[11]=LC2; Levels[12]=L2; Levels[13]=H3; Levels[14]=HC3; Levels[15]=M3; Levels[16]=LC3; Levels[17]=L3;  

avatar
4224
RaptorUK 2011.07.27 22:40 

double Levels[18];

Levels[0] = H1 ; Levels[1] = HC1,  . . . . , Levels[17] = L3


avatar
4328
WHRoeder 2011.07.27 23:07 
double Levels[18]={H1, HC1, M1, LC1, L1, O1, C1, P1, H2, HC2, M2, LC2, L2, H3, HC3, M3, LC3, L3};
This form can only be used with constants. The 18 is optional, if not specified defaults to number of items in the list.
Back to topics list  

To add comments, please log in or register