MQL4 Reference Math Functions

Mathematical Functions

A set of mathematical and trigonometric functions.

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

 

What's new in MQL5

Added hyperbolic trigonometric functions and the MathSwap function for changing the byte order in ushort, uint and ulong integer types. The need for such a transformation often arises when working with the Network functions.

The Mathematics section contains the ready-made libraries for working with random distributions, fuzzy logic and neural networks. It also contains functions for solving differential equations, clustering, statistical analysis and optimization tasks.