Math
math.abs
math.abs
Definition: The absolute value of number
is number
if number
>= 0, or -number
otherwise.
Syntax:
Returns:
Arguments:
number
simple int/float
The number for which to calculate the absolute value.
math.acos
math.acos
Definition: The acos function returns the arccosine (in radians) of number such that cos(acos(y)) = y for y in range [-1, 1].
Syntax:
Returns:
Arguments:
angle
simple float
The angle in radians for which to calculate the arccosine.
math.asin
math.asin
Definition: The asin function returns the arcsine (in radians) of number such that sin(asin(y)) = y for y in range [-1, 1].
Syntax:
Returns:
Arguments:
angle
simple float
The angle in radians for which to calculate the arcsine.
math.atan
math.atan
Definition: The atan function returns the arctangent (in radians) of number such that tan(atan(y)) = y for any y.
Syntax:
Returns:
Arguments:
angle
simple float
The angle in radians for which to calculate the arctangent.
math.avg
math.avg
Definition: Calculates the average of all given series (elementwise).
Syntax:
Returns:
Arguments:
number0, number1, ...
series float
The series of numbers to calculate the average of. Multiple series can be provided.
math.ceil
math.ceil
Definition: Returns the smallest integer greater than or equal to the argument.
Syntax:
Returns:
Arguments:
number
series float
The number to ceil.
math.cos
math.cos
Definition: Returns the trigonometric cosine of an angle.
Syntax:
Returns:
Arguments:
angle
series float
The angle in radians.
math.exp
math.exp
Definition: Returns the value of Euler's number raised to the power of the given number.
Syntax:
Returns:
Arguments:
number
series float
The number for which to calculate the exponent.
math.floor
math.floor
Definition: Returns the largest integer less than or equal to the given number.
Syntax:
Returns:
Arguments:
number
series int
The number for which to calculate the floor value.
math.log
math.log
Definition: Returns the natural logarithm of any number greater than 0.
Syntax:
Returns:
Arguments:
number
series float
The number for which to calculate the natural logarithm.
math.log10
math.log10
Definition: Returns the base 10 logarithm of a number.
Syntax:
Returns:
Arguments:
number
series float
The number for which to calculate the base 10 logarithm.
math.max
math.max
Definition: Returns the greatest of multiple values.
Syntax:
Returns:
Arguments:
number0, number1, ...
series int/float
The values to compare and find the greatest among them.
math.min
math.min
Definition: Returns the smallest of multiple values.
Syntax:
Returns:
Arguments:
number0, number1, ...
series int/float
The values to compare and find the smallest among them.
math.pow
math.pow
Definition: Mathematical power function.
Syntax:
Returns:
Arguments:
base
series int/float
Specify the base to use.
exponent
series int/float
Specifies the exponent.
math.random
math.random
Definition: Returns a pseudo-random value. The function will generate a different sequence of values for each script execution. Using the same value for the optional seed argument will produce a repeatable sequence.
Syntax:
Arguments:
min
series int/float
The lower bound of the range of random values. The value is not included in the range. The default is 0.
max
series int/float
The upper bound of the range of random values. The value is not included in the range. The default is 1.
seed
series int
Optional argument. When the same seed is used, allows successive calls to the function to produce a repeatable set of values.
Returns:
math.round
math.round
Definition: Returns the value of number
rounded to the nearest integer, with ties rounding up. If the precision
parameter is used, returns a float value rounded to that amount of decimal places.
Syntax:
Returns:
Arguments:
number
series int/float
The value to be rounded.
precision
series int
Optional argument. Decimal places to which number
will be rounded. When no argument is supplied, rounding is to the nearest integer.
math.sign
math.sign
Definition: Sign (signum) of number
is zero if number
is zero, 1.0 if number
is greater than zero, -1.0 if number
is less than zero.
Syntax:
Returns:
Arguments:
number
series int/float
The number for which to determine the sign.
math.sin
math.sin
Definition: The sin function returns the trigonometric sine of an angle.
Syntax:
Returns:
Arguments:
angle
series int/float
Angle, in radians.
math.sqrt
math.sqrt
Definition: Square root of any number
>= 0 is the unique y >= 0 such that y^2 = number
.
Syntax:
Returns:
Arguments:
number
series int/float
The number to calculate the square root of. It must be greater than or equal to 0.
math.sum
math.sum
Definition: The sum function returns the sliding sum of last y values of x.
Syntax:
Arguments:
source
series int/float
Series of values to process.
length
series int
Number of bars (length).
Returns:
math.tan
math.tan
Definition: The tan function returns the trigonometric tangent of an angle.
Syntax:
Returns:
Arguments:
angle
series int/float
Angle, in radians.
math.todegrees
math.todegrees
Definition: Returns an approximately equivalent angle in degrees from an angle measured in radians.
Syntax:
Arguments:
radians
series int/float
Angle in radians.
Returns:
math.toradians
math.toradians
Definition: Returns an approximately equivalent angle in radians from an angle measured in degrees.
Syntax:
Arguments:
degrees
series int/float
Angle in degrees.
Returns:
Last updated