math.round#
Round value to the given number of decimal places.
SYNTAX#
function math.round(value: number, decimals?: number): numberARGUMENTS#
value(number) — Value to round.decimals(number) — Number of decimals to keep. Defaults to 0.
RETURNS#
number — the rounded value.
REMARKS#
For rounding to an exchange's tick increment, use Math.round(value / ctx.tickSize) * ctx.tickSize instead — decimals is base-10 only.
EXAMPLE#
const display = math.round(candles[i].close, 2);
plot('close', display);