Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.math.round
On this pageSignatureParametersReturnsExample

Math / Reference

alerta.math.round

TradingView-compatible spelling: math.round, runs without warnings

Rounds to the nearest integer, or — with `precision` — to that many decimal places. `math.round(x, 2)` is how dashboards trim a figure before `str.tostring`.

alerta.math.round(x, precision?) → series float

Parameters

NameTypeRequiredDefaultDescription
xseries floatYes—Value to round.
precisionseries intNo—Decimal places to keep. Omitted = round to an integer.

Returns

series float

Example

alerta.math.round
const r = round(1.5)r2 = math.round(close / 7, 2)plot(r2, { title: "two decimals" })

Names and aliases

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

AlertaScript

No results found.

Search by name, alias, or keyword.