Constant Bias Scale
systemic:core-cbsIndicatorsInputs
| Name | Type | Description |
|---|---|---|
| Bias | Number | A constant number added to each value after scaling. |
| Scale | Number | A constant number that each input value is multiplied by. |
| Data | Number series | The series to transform, with at least one value. |
Outputs
| Name | Type | Description |
|---|---|---|
| Cbs | Number series | The transformed series: each input value multiplied by the scale, plus the bias. |
Cost
0.198 + 0.00563·n credits for n bars, rounded up. The marks are each plan's limit of bars.
The Constant Bias Scale module applies a linear transformation to each value in a series: it multiplies by a scale factor, then adds a bias.
This operation is a basic tool for rescaling and normalizing data.
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 (about 0.5556), Bias = -17.78 (approximate)
- Percentage to decimal: Scale = 0.01, Bias = 0
3. Normalizing Custom Ranges
Map any range [a, b] to a new range by choosing the right scale and bias.
Combining CBS Modules
Several CBS modules in a row are equal to a single 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 |
| Empty value in input | Output is empty at the same position |
Missing Data
An empty value (null), such as a data gap or a bar when the market is closed, gives an empty value at the same position in the output. CBS never invents a value for a missing input. In particular, an empty value is never replaced with the bias, which is what treating it as zero would give.
CBS works for every number, so there is no invalid input: the output is empty only where the input is empty. The one exception is arithmetic with no defined result (for example, an infinite value multiplied by a scale of zero), which is also empty at that position.
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 | Deterministic: the same inputs always give the same 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. |