MQL4参考 数组函数 ArrayMinimum

ArrayMinimum

The function searches a minimal element in a one-dimension numeric array.

int  ArrayMinimum(
   const void&   array[],             // array for search
   int           count=WHOLE_ARRAY,   // number of checked elements
   int           start=0              // index to start checking with
   );

Parameters

array[]

[in]  A numeric array, in which search is made.

count=WHOLE_ARRAY

[in]  Number of elements for search. By default, searches in the entire array (count=WHOLE_ARRAY).

start=0

[in]  Index to start checking with.

Return Value

The function returns an index of a found element taking into account the array serial. In case of failure it returns -1.

Example:

void OnStart()
  {
//---
   double num_array[15]={4,1,6,3,19,4,2,6,3,9,4,5,6,3,9};
   int    minValueIdx=ArrayMinimum(num_array,WHOLE_ARRAY,0);
   Print("Min value = ",num_array[minValueIdx]," at index=",minValueIdx);
  }

See also

ArrayMaximum()