Constant Bias Scale
systemic:core-cbsIndicatorsfunction1 crInputs
| Name | Type | Description |
|---|---|---|
| Bias | float | The bias is a constant value **added** to each scaled data point. It shifts the entire output series up or down. |
| Scale | float | The scale is a constant multiplier applied to each input value. It controls the amplitude or spread of the output. |
| Data | floatarray | The input series to be transformed. Each value undergoes the linear transformation: multiply by scale, then add bias. |
Outputs
| Name | Type | Description |
|---|---|---|
| Cbs | floatarray | The transformed series after applying the linear transformation to each input value. |
The Constant Bias Scale module applies a linear transformation to each value in a series—first multiplying by a scale factor, then adding a bias term.
This simple yet powerful operation is fundamental to signal processing and data normalization.
How It Works
flowchart LR
subgraph Input
X["x₁, x₂, ... xₙ"]
end
subgraph Transform["Linear Transformation"]
M["× Scale"]
A["+ Bias"]
end
subgraph Output
Y["y₁, y₂, ... yₙ"]
end
X --> M --> A --> Y
For each input value:
- Multiply by the scale factor (stretches or compresses)
- Add the bias term (shifts up or down)
Step-by-Step Example
Input: [0, 1, 2, 3, 4]
Scale: 7
Bias: 3
| Input (x) | × Scale | + Bias | Output |
|---|---|---|---|
| 0 | 0 × 7 = 0 | 0 + 3 | 3 |
| 1 | 1 × 7 = 7 | 7 + 3 | 10 |
| 2 | 2 × 7 = 14 | 14 + 3 | 17 |
| 3 | 3 × 7 = 21 | 21 + 3 | 24 |
| 4 | 4 × 7 = 28 | 28 + 3 | 31 |
Result: [3, 10, 17, 24, 31]
Understanding the Parameters
Scale: Amplitude Control
The scale parameter controls the spread or amplitude of your data:
| Scale | Effect |
|---|---|
| > 1 | Amplify / stretch the range |
| = 1 | No change to spread |
| 0 < scale < 1 | Compress the range |
| = 0 | Flatten to constant |
| < 0 | Invert and scale |
Bias: Level Shift
The bias parameter shifts the entire output up or down:
| Bias | Effect |
|---|---|
| > 0 | Shift values upward |
| = 0 | No shift |
| < 0 | Shift values downward |
Practical Applications
1. Re-centering an Oscillator
Many oscillators (RSI, Stochastic) range from 0 to 100. To center them around zero:
| Original Range | Scale | Bias | New Range |
|---|---|---|---|
| 0 to 100 | 1 | -50 | -50 to +50 |
| 0 to 100 | 0.02 | -1 | -1 to +1 |
2. Converting Units
Transform data between different scales:
- Fahrenheit to Celsius: Scale = 5/9, Bias = -17.78 (approximate after input shift)
- Percentage to decimal: Scale = 0.01, Bias = 0
3. Normalizing Custom Ranges
Map any range [a, b] to a new center point by choosing appropriate scale and bias.
Combining CBS Modules
Multiple CBS transformations in sequence compose into a single equivalent CBS:
This means chained transformations can always be reduced to one.
Edge Cases
| Scenario | Result |
|---|---|
| Scale = 0 | All outputs equal bias (constant) |
| Bias = 0, Scale = 1 | Output equals input (identity) |
| Empty input | Rejected — the series must contain at least one value |
| Missing (null) value in input | Output is null at the same position |
Missing Data
A missing datapoint (null) — a data gap or a closed-market slot — produces null at the same position in the output. CBS never invents a value for a missing input; in particular, a missing slot is never replaced with the bias, which is what scaling a fabricated zero would produce. The math is never faked.
CBS itself is defined for every real number, so there is no invalid-input case: nulls in the output mirror missing inputs. The one exception is arithmetic with no defined result (for example an infinite value multiplied by a scale of zero), which is also null at that position.
In live execution, CBS returns exactly one datapoint: the transformed newest value, or null when that value is missing.
Further Reading
Indicator Assessment
---
config:
xyChart:
width: 600
height: 400
themeVariables:
xyChart:
plotColorPalette: "#1abc9c"
---
xychart-beta horizontal
title "Constant Bias Scale Assessment (Scale: 1-10)"
x-axis ["Popularity", "Reliability", "Complexity", "Versatility", "Recent Interest"]
y-axis "Score" 0 --> 10
bar [6, 10, 2, 10, 4]
Note: Single bar shown as scores are identical across asset classes for this fundamental mathematical operation.
Dimension Explanations
| Dimension | Score | Rationale |
|---|---|---|
| Popularity | 6 | Linear transformations are universally used but often as building blocks within larger systems, not standalone indicators. Well understood in engineering and data science. |
| Reliability | 10 | Mathematically deterministic—identical inputs always produce identical outputs. No statistical uncertainty or market-dependent behavior. |
| Complexity | 2 | Elementary arithmetic (multiply then add). Requires only basic algebra to understand and apply correctly. |
| Versatility | 10 | Applicable to any numerical series across all asset classes, timeframes, and use cases. Fundamental building block for normalization, unit conversion, and signal processing. |
| Recent Interest | 4 | As a fundamental operation, interest is stable rather than trending. No recent surge in research—it simply works and has for centuries. |