Detected Country (United States) : English
Math Functions - codingforex.com

## Welcome to CodingForex.Com!

Knowledge portal where you can learn how to create forex indicators and robot.

Click button below to choose level that suite you:

### Math Functions

Level Active [2017-11-20 12:20:35] - by hillzx Metatrader has several math functions, complete list and full explanation can be opened at the official MQL link here. These functions include:

 Function Action MathAbs Returns absolute value (modulus) of the specified numeric value MathArccos Returns the arc cosine of x in radians MathArcsin Returns the arc sine of x in radians MathArctan Returns the arc tangent of x in radians MathCeil Returns integer numeric value closest from above MathCos Returns the cosine of a number MathExp Returns exponent of a number MathFloor Returns integer numeric value closest from below MathLog Returns natural logarithm MathLog10 Returns the logarithm of a number by base 10 MathMax Returns the maximal value of the two numeric values MathMin Returns the minimal value of the two numeric values MathMod Returns the real remainder after the division of two numbers MathPow Raises the base to the specified power MathRand Returns a pseudorandom value within the range of 0 to 32767 MathRound Rounds of a value to the nearest integer MathSin Returns the sine of a number MathSqrt Returns a square root MathSrand Sets the starting point for generating a series of pseudorandom integers MathTan Returns the tangent of a number MathIsValidNumber Checks the correctness of a real number The function marked yellow is a frequently used function, so you do not have to memorize all the formulas. Example of using the code:

``````//Mendapatkan nilai absolute
Print(MathAbs(-1));

//Pembulatan ke atas
Print(MathCeil(4.5432));

//Mencari nilai tertinggi
Print(MathMax(65,34));

//Mencari nilai terkecil
Print(MathMin(34,64));

//Membuat angka acak
int acak = MathRand();

//Pemangkatan
Print(MathPow(4,3));

//Pembulatan otomatis
Print(MathRound(43.4345));

//Akar
Print(MathSqrt(9));

//Pengecekan apakah angka valid
Print(MathIsValidNumber(53));``````