TradeZoro
Notifications

Reference

Math

Numbers and arithmetic.

math.abs(x)

Absolute value.

Returns: a number

ParameterType
xnum

math.acos(x)

Arc cosine.

Returns: a number

ParameterType
xnum

math.asin(x)

Arc sine.

Returns: a number

ParameterType
xnum

math.atan(x)

Arc tangent.

Returns: a number

ParameterType
xnum

math.avg(...values)

Average of the values.

Returns: a number

ParameterType
valuesnum

math.ceil(x)

Rounds up.

Returns: a whole number

ParameterType
xnum

math.cos(x)

Cosine (radians).

Returns: a number

ParameterType
xnum

math.exp(x)

e to the power x.

Returns: a number

ParameterType
xnum

math.floor(x)

Rounds down.

Returns: a whole number

ParameterType
xnum

math.log(x)

Natural logarithm.

Returns: a number

ParameterType
xnum

math.log10(x)

Base-10 logarithm.

Returns: a number

ParameterType
xnum

math.max(...values)

Largest of the values.

Returns: a number

ParameterType
valuesnum

math.min(...values)

Smallest of the values.

Returns: a number

ParameterType
valuesnum

math.pow(base, exponent)

base to the power exponent.

Returns: a number

ParameterType
basenum
exponentnum

math.random(min=0, max=1, seed=na)

A repeatable pseudo-random number between min and max. Call on every bar: it keeps its own running memory.

Returns: a number

ParameterTypeNotes
minnumDefault 0
maxnumDefault 1
seedintDefault na

math.round(x, precision=na)

Rounds to the nearest whole number, or to precision decimals.

Returns: a number

ParameterTypeNotes
xnum
precisionintDefault na

math.round_to_mintick(x)

Rounds to the symbol's tick size.

Returns: a number

ParameterType
xnum

math.sign(x)

-1, 0 or 1.

Returns: a number

ParameterType
xnum

math.sin(x)

Sine (radians).

Returns: a number

ParameterType
xnum

math.sqrt(x)

Square root.

Returns: a number

ParameterType
xnum

math.sum(source, length)

Sum of the last length values. Call on every bar: it keeps its own running memory.

Returns: a number

ParameterType
sourcenum
lengthint

math.tan(x)

Tangent (radians).

Returns: a number

ParameterType
xnum

math.todegrees(x)

Radians to degrees.

Returns: a number

ParameterType
xnum

math.toradians(x)

Degrees to radians.

Returns: a number

ParameterType
xnum

Education only. Not financial advice. Examples are teaching samples, not trading results.

Zscript is coming soon

The manual opens when Zscript launches.

Back to home