Function reference
math
Arithmetic, rounding, logs, trigonometry and aggregates.
29 names from PineTS 0.11.1 · 17 with full entries
math.abs
Verifiedmath.abs(number)
Absolute value.
math.max
Verifiedmath.max(number0, number1, …)
The largest of its arguments.
math.min
Verifiedmath.min(number0, number1, …)
The smallest of its arguments.
math.avg
Verifiedmath.avg(number0, number1, …)
The mean of its arguments.
math.sum
Verifiedmath.sum(source, length)
Sum of the last length values of a series.
math.round
Supportedmath.round(number, precision)
Rounds to the nearest whole number, or to precision decimals.
math.round_to_mintick
Supportedmath.round_to_mintick(number)
Rounds to the symbol's price step (syminfo.mintick).
math.floor
Verifiedmath.floor(number)
Largest whole number not greater than number.
math.ceil
Supportedmath.ceil(number)
Smallest whole number not less than number.
math.sign
Supportedmath.sign(number)
1, 0 or -1.
math.pow
Supportedmath.pow(base, exponent)
base raised to exponent.
math.sqrt
Verifiedmath.sqrt(number)
Square root.
math.log
Verifiedmath.log(number)
Natural logarithm.
math.log10
Supportedmath.log10(number)
Base-10 logarithm.
math.exp
Supportedmath.exp(number)
e raised to number.
math.random
Supportedmath.random(min, max, seed)
A pseudo-random number between min and max.
math.pi
Supportedmath.piπ.
Everything else in math
Also implemented. These follow TradingView’s Pine v6 reference for their arguments.
- math.acosSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.asinSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.atanSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.cosSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.eSupportedEuler's number (e) The base of natural logarithms, approximately 2.718281828459045
- math.lnSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.phiSupportedGolden ratio (φ, phi) Calculated as (1 + sqrt(5)) / 2, approximately 1.618033988749895
- math.rphiSupportedReciprocal of golden ratio (1/φ) Equal to phi - 1, approximately 0.6180339887498948
- math.sinSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.tanSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
- math.todegreesSupportedConverts an angle in radians to degrees.
- math.toradiansSupportedConverts an angle in degrees to radians.