Scale
The Scale node performs a linear mapping from a known input range [fromMin, fromMax] to a desired output range [toMin, toMax]. Unlike Normalize (which auto-detects the input range from actual data), Scale requires you to specify the expected input bounds explicitly — making it suitable when you know the theoretical range of an indicator and want deterministic mapping regardless of actual data extremes.
Algorithm
- ▸fromRange = fromMax − fromMin, toRange = toMax − toMin
- ▸output[i] = toMin + (v[i] − fromMin) × (toRange / fromRange)
- ▸When fromRange = 0: output = (toMin + toMax) / 2 for all valid values
- ▸null inputs → null output
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| fromMin | number | 0 | Expected minimum of the input range. |
| fromMax | number | 100 | Expected maximum of the input range. |
| toMin | number | −1 | Desired minimum of the output range. |
| toMax | number | 1 | Desired maximum of the output range. |
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
RSI Remapping
Scale RSI from [0, 100] to [−1, +1] (fromMin=0, fromMax=100, toMin=−1, toMax=1) to make it compatible with signed signal aggregation where zero represents neutral.
Stochastic to Probability
Scale Stochastic (0–100) to [0, 1] to represent it as a probability value, enabling direct use as a weighting factor in portfolio allocation formulas.
Temperature/Parameter Scaling
When a downstream node expects inputs in a specific range, Scale converts indicator outputs to that range using known theoretical bounds rather than data-driven bounds.