Rescale¶
Math · Transform
Affine remap: linearly map a value from the input range [in_min, in_max] onto the output range [out_min, out_max] (not clamped — values outside the input range map proportionally beyond). e.g. remap an RSI's 0–100 onto −1…+1. Degenerate input range emits NaN.
Rescale linearly remaps a value from one range onto another. Tell it the input range [in_min, in_max] and the output range [out_min, out_max] and it stretches or shifts the value proportionally — for example turning an RSI's 0–100 into a −1…+1 signal. It's the block for putting different indicators onto a common, comparable scale.
How it works¶
Each bar it applies the affine map out_min + (value − in_min) ÷ (in_max − in_min) × (out_max − out_min). It is not clamped: a value outside the input range maps proportionally beyond the output range, preserving the linear relationship. If the input range is degenerate (in_min == in_max) the map is undefined and it emits NaN. Lookahead-free.
When to use it¶
Use it to normalise indicators before combining them — remap RSI, Stochastic and a custom score all onto 0–1 so a weighted sum is fair — or to flip and centre an oscillator around zero. It's the standard pre-processing step for building composite scores out of blocks that naturally live on different scales.
Example¶
Centre an RSI: wire RSI into Rescale with in_min = 0, in_max = 100, out_min = −1, out_max = 1. Now 50 maps to 0, overbought is positive, oversold negative — a symmetric momentum input you can Add into a composite score.
Tips & gotchas¶
- Not clamped — out-of-range inputs map beyond the output range. Follow with Clamp if you need hard bounds.
- Degenerate input range → NaN (
in_minmust differ fromin_max). - Swap out_min/out_max to invert — great for flipping an oscillator's polarity.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | series / bars |
Source series. BARS input uses close. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| mapped | series |
Line · sub-pane | Value affine-remapped to the output range. |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| In min | number · -1000000.0–1000000.0 | 0.0 |
|
| In max | number · -1000000.0–1000000.0 | 100.0 |
|
| Out min | number · -1000000.0–1000000.0 | 0.0 |
|
| Out max | number · -1000000.0–1000000.0 | 1.0 |
Reference auto-generated from the block catalog · category Math.