Systemicalpha

Constant Bias Scale

systemic:core-cbsIndicatorsfunction1 cr

Inputs

NameTypeDescription
BiasfloatThe bias is a constant value **added** to each scaled data point. It shifts the entire output series up or down.
ScalefloatThe scale is a constant multiplier applied to each input value. It controls the amplitude or spread of the output.
DatafloatarrayThe input series to be transformed. Each value undergoes the linear transformation: multiply by scale, then add bias.

Outputs

NameTypeDescription
CbsfloatarrayThe 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.

CBS(x)=x⋅scale+bias\text{CBS}(x) = x \cdot \text{scale} + \text{bias}

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:

  1. Multiply by the scale factor (stretches or compresses)
  2. 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+ BiasOutput
00 × 7 = 00 + 33
11 × 7 = 77 + 310
22 × 7 = 1414 + 317
33 × 7 = 2121 + 324
44 × 7 = 2828 + 331

Result: [3, 10, 17, 24, 31]


Understanding the Parameters

Scale: Amplitude Control

The scale parameter controls the spread or amplitude of your data:

ScaleEffect
> 1Amplify / stretch the range
= 1No change to spread
0 < scale < 1Compress the range
= 0Flatten to constant
< 0Invert and scale

Bias: Level Shift

The bias parameter shifts the entire output up or down:

BiasEffect
> 0Shift values upward
= 0No shift
< 0Shift values downward

Practical Applications

1. Re-centering an Oscillator

Many oscillators (RSI, Stochastic) range from 0 to 100. To center them around zero:

Original RangeScaleBiasNew Range
0 to 1001-50-50 to +50
0 to 1000.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:

CBS2(CBS1(x))=(x⋅s1+b1)⋅s2+b2=x⋅(s1⋅s2)+(b1⋅s2+b2)\text{CBS}_2(\text{CBS}_1(x)) = (x \cdot s_1 + b_1) \cdot s_2 + b_2 = x \cdot (s_1 \cdot s_2) + (b_1 \cdot s_2 + b_2)

This means chained transformations can always be reduced to one.


Edge Cases

ScenarioResult
Scale = 0All outputs equal bias (constant)
Bias = 0, Scale = 1Output equals input (identity)
Empty inputRejected — the series must contain at least one value
Missing (null) value in inputOutput 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

DimensionScoreRationale
Popularity6Linear transformations are universally used but often as building blocks within larger systems, not standalone indicators. Well understood in engineering and data science.
Reliability10Mathematically deterministic—identical inputs always produce identical outputs. No statistical uncertainty or market-dependent behavior.
Complexity2Elementary arithmetic (multiply then add). Requires only basic algebra to understand and apply correctly.
Versatility10Applicable to any numerical series across all asset classes, timeframes, and use cases. Fundamental building block for normalization, unit conversion, and signal processing.
Recent Interest4As a fundamental operation, interest is stable rather than trending. No recent surge in research—it simply works and has for centuries.
Rendering diagrams...
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5