MathRound "wrong parameters count"

 

Hi

This mql5 code gives the compile time error for MathRound "wrong parameters count", any idea why? 

Here is the link for the MathRound.

https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathround

Thank you

double arrayMode(double &arr[]){
  double  result=0;
  double  arrRounded[];
  ArrayResize(arrRounded, ArraySize(arr));
  MathRound(arr, 4, arrRounded);           //<<<<<<<<<<<<<<<"wrong parameters count"
  if(ArraySort(arrRounded)){
    int     rank  = 0;
    int     count = 1;
    int     size  = ArraySize(arrRounded);
    for(int i=0; i<size; i++){
      if(arrRounded[i] == arrRounded[i+1]){
        count++;
      } else if (rank < count){
        rank = count;
        count= 1;
        result = arrRounded[i];
      }
    }
  }
  return result;
}
Documentation on MQL5: Standard Library / Mathematics / Statistics / Subfunctions / MathRound
Documentation on MQL5: Standard Library / Mathematics / Statistics / Subfunctions / MathRound
  • www.mql5.com
Version for rounding an array of double-precision floating-point numbers to the specified number of decimal places. The results are output to a new array. Version for rounding an...
 
#include <Math/Stat/Math.mqh>

or

#include <Math/Stat/Stat.mqh>

The latter includes all math declarations in the Stat module.

 

Thanks @lippmaje. But besides that, it's better to go with NormalizeDouble.

Documentation on MQL5: Conversion Functions / NormalizeDouble
Documentation on MQL5: Conversion Functions / NormalizeDouble
  • www.mql5.com
NormalizeDouble - Conversion Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5