math
Python’s math, with the same names and errors, plus sign and round_to_tick.
As in Python, arguments are passed only by position: math.log(8, 2), not math.log(8, base=2). Functions on series are in ta.
math.piconstant
Pi, 3.14159…
math.econstant
Euler’s number, 2.71828…
math.nanconstant
The missing value: in a plot it leaves a gap.
math.infconstant
Positive infinity.
math.sqrt(x)
The square root. With a negative x it’s a ValueError.
math.exp(x)
e raised to x.
math.log(x, base)
The natural logarithm of x or, with base, in that base. x must be positive.
math.log10(x)
The base-10 logarithm.
math.sin(x)
The sine, with x in radians.
math.cos(x)
The cosine, with x in radians.
math.tan(x)
The tangent, with x in radians.
math.asin(x)
The arcsine in radians, with x between -1 and 1.
math.acos(x)
The arccosine in radians, with x between -1 and 1.
math.atan(x)
The arctangent in radians.
math.atan2(y, x)
The angle in radians of the point (x, y), from -π to π: it takes the quadrant into account.
math.degrees(x)
From radians to degrees.
math.radians(x)
From degrees to radians.
math.floor(x)
The largest integer not greater than x.
math.ceil(x)
The smallest integer not less than x.
math.trunc(x)
The integer part of x, towards zero.
math.copysign(x, y)
The value of x with the sign of y.
math.isnan(x)
True if x is nan, the missing value.
math.isfinite(x)
True if x is neither nan nor infinite.
math.sign(x)
-1, 0 or 1, the sign of x; nan stays nan.
math.round_to_tick(x, tick)
The multiple of tick closest to x, rounded like round. For example math.round_to_tick(x, bars.symbol.tick_size).