Rounds a number to the nearest multiple of the symbol's minimum price step.
math.round_to_mintick snaps a price to a value the instrument can trade at. For a symbol with a tick of 0.01, 12.3456 becomes 12.35.
Use it before placing a level, a label or an order at a computed price. The result avoids floating-point dust, so three ticks of 0.1 are exactly 0.3.
Syntax
math.round_to_mintick(number: simple int/float) -> simple float
math.round_to_mintick(number: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| number | simple/ | required | The price to snap to the nearest multiple of the symbol's tick size. |
Returns
simple/series float: the price rounded to the symbol's tick size.
Remarks
- The tick size is
syminfo.mintickfor the chart's symbol.
Example
//@version=6
indicator("Tick-aligned level", overlay = true)
target = math.round_to_mintick(close * 1.005)
plot(target, "Close + 0.5%", color = color.orange)See also
Runs on Sidechair