Download MetaTrader 5

ARRAYS HELP IN MQL4 PROGRAMMING

To add comments, please log in or register
Join MQL5 Cloud Network. Millions of traders are waiting for this!
Mohammad Soubra
25006
Mohammad Soubra 2016.06.28 17:00 

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
1015
Mohamed Hamdy 2016.06.29 08:12  
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