Round
The Round node applies Math.round to each element, rounding to the nearest integer (ties round toward positive infinity, matching JavaScript semantics). Used for discretizing outputs to tick resolution, rounding computed prices before order placement, normalizing integer-valued metrics such as bar counts or period lengths, and producing clean display values.
Algorithm
- ▸output[i] = Math.round(input[i])
- ▸null inputs → null output
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input | number[] | Source numeric array |
| Outputs | ||
| values | number | null | Computed value at each bar; null before the warmup period completes |
| timestamps | number[] | Bar timestamps (UNIX ms), aligned 1-to-1 with values |
Use Cases
Order Price Rounding
Round a computed entry price to the nearest tick before passing it to an order management node to avoid sub-tick price rejections.
Dynamic Period Rounding
Round a volatility-adjusted period (e.g., 14 × vol_ratio) to the nearest integer before feeding into a rolling stat node that requires integer periods.
Display Normalization
Round indicator outputs to 2 decimal places by multiplying by 100, rounding, then dividing by 100 — using Round as the middle step.