Download MetaTrader 5

ARRAYS HELP IN MQL4 PROGRAMMING

To add comments, please log in or register
Mohammad Soubra
30883
Mohammad Soubra  

Hello every one,

 

I find an example in mql developer book regarding the filing arrays as:

void OnStart() 
  { 
//--- declare dynamic array 
   int a[]; 
//--- set size 
   ArrayResize(a,10); 
//--- fill first 5 elements with 123 
   ArrayFill(a,0,5,123); 
//--- fill next 5 elements with 456 
   ArrayFill(a,5,5,456); 
//--- show values 
   for(int i=0;i<ArraySize(a);i++) printf("a[%d] = %d",i,a[i]); 
  }

 the above example will return the values:

1123

2123

3123

4123

5123

6456

7456

8456

9456

10456

as the ArrayFill():

//--- fill first 5 elements with 123 
   ArrayFill(a,0,5,123); 
//--- fill next 5 elements with 456 
   ArrayFill(a,5,5,456);

 but if I want to fill by different values

lets us say fibonacci lines or each tick get another values or history orders.... to fill all the array.. 

 

any help ? 

Mohamed Hamdy
1076
Mohamed Hamdy  
resize the array to the new data size that you want to enter , then fill your array
To add comments, please log in or register