Floor
Element-wiseCore Math
The Floor node applies Math.floor to each element, rounding every value down to the nearest integer. Commonly used for position sizing (never allocate more than a whole lot), discretizing prices to floor ticks for conservative stop placement, and computing integer bar offsets from floating-point lookback periods.
Algorithm
- ▸output[i] = Math.floor(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 |
Live mode: In live streaming mode the node updates only the last bar in-place rather than recalculating the full array, keeping CPU usage minimal during real-time data feeds.
Use Cases
Conservative Lot Sizing
Floor a fractional contract count to always round down, ensuring you never over-allocate against a fixed dollar risk.
Stop Level Rounding
Floor a calculated stop price to the nearest integer for whole-number tick assets, giving a marginally tighter stop.
Lookback Discretization
Floor a volatility-scaled lookback (e.g., 14 × vol_ratio) to produce a valid integer period for downstream windowed nodes.