MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Array functions  ArraySort

 
int ArraySort( void array[], int count=WHOLE_ARRAY, int start=0, int sort_dir=MODE_ASCEND)
Sorts numeric arrays by first dimension. Series arrays cannot be sorted by ArraySort().
Parameters:
array[]   -   The numeric array to be sorted.
count   -   Count of elements to be sorted.
start   -   Starting index.
sort_dir   -   Array sorting direction. It can be any of the following values:
MODE_ASCEND - sort ascending,
MODE_DESCEND - sort descending.
Sample:
  double num_array[5]={4,1,6,3,9};
  // now array contains values 4,1,6,3,9
  ArraySort(num_array);
  // now array is sorted 1,3,4,6,9
  ArraySort(num_array,WHOLE_ARRAY,0,MODE_DESCEND);
  // now array is sorted 9,6,4,3,1