Absolute Value
Element-wiseCore Math
The Absolute Value node maps every element x to |x|, stripping its sign while preserving magnitude. In trading pipelines abs is foundational wherever you need distance from zero — drawdown magnitude, spread size, oscillator amplitude, and deviation metrics all depend on it. It processes the full windowed array element-by-element with no rolling period, and null inputs pass through as null.
Algorithm
- ▸output[i] = Math.abs(input[i])
- ▸null inputs → null output (propagated, not zero-filled)
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
Drawdown Magnitude
Negate a return series and pipe through Abs to get a positive loss-magnitude series suitable for drawdown analysis.
MACD Histogram Distance
Apply Abs to the MACD histogram to measure oscillator energy, then feed into Average to get mean oscillator amplitude.
Bar-by-Bar Volatility Proxy
Compute close-minus-previous-close, then Abs, to get a simple absolute price-change series as a fast volatility surrogate.