Systemicbeta

Z Score (custom)

systemic:core-zscrStatistics

Inputs

NameTypeDescription
DataNumber seriesThe series of values to score, for example closing prices or volume.
AverageNumber seriesThe mean that the Data value is compared with at each bar.
Standard DeviationNumber seriesThe standard deviation that scales the distance between Data and Average at each bar.

Outputs

NameTypeDescription
Z ScoreNumber seriesThe number of standard deviations the Data value is above or below the mean, at each bar.

Cost

7
credits per run
1,000
bars

0.199 + 0.00612·n credits for n bars, rounded up. The marks are each plan's limit of bars.

The Z-Score measures how many standard deviations a value is from the mean. In trading, it shows how "unusual" the current price is compared with its history, which is the basis of mean-reversion strategies.

Z=X−μσZ = \frac{X - \mu}{\sigma}

Where:

  • XX = Current value
  • μ\mu = Mean
  • σ\sigma = Standard deviation

Z Score (custom) takes μ\mu and σ\sigma from its Average and Standard Deviation inputs, bar by bar. Z Score (simple) takes only the data. It uses the mean and standard deviation of all bars from the start of the run up to the current bar.


How It Works

flowchart TD
    subgraph Input["Price Data"]
        P["Data series"]
    end
    
    subgraph Stats["Statistical Calculation"]
        MEAN["μ = Mean of prices"]
        STD["σ = Standard deviation"]
        CURR["X = Current price"]
    end
    
    subgraph Calc["Z-Score"]
        DIFF["X - μ"]
        DIV["÷ σ"]
        Z["Z-Score"]
    end
    
    P --> MEAN & STD
    CURR & MEAN --> DIFF
    DIFF & STD --> DIV --> Z

Missing Data

If any value the calculation needs at a bar is empty (a data gap or a closed-market day), the Z-Score at that bar is empty. Gaps are never filled: a gap in your inputs stays a gap in the output.

The Z-Score is also undefined when the standard deviation is zero, because a flat series has no "distance from the mean". That bar is empty too, not 0. In Z Score (simple), this always applies to the first bar that has a value.

XμσZ-Score
empty1005empty
110empty5empty
1101000empty
11010052.0

Interpreting Z-Score

Z-ScoreInterpretation
> +2Far above average (possibly overbought)
+1 to +2Above average
-1 to +1Normal range
-2 to -1Below average
< -2Far below average (possibly oversold)
flowchart LR
    subgraph Zones["Z-Score Distribution"]
        EXT2[">+2 σ<br/>Extreme high"]
        HIGH["+1 to +2 σ<br/>Above normal"]
        NORM["-1 to +1 σ<br/>Normal (68%)"]
        LOW["-2 to -1 σ<br/>Below normal"]
        EXT1["<-2 σ<br/>Extreme low"]
    end
    
    EXT2 --> HIGH --> NORM --> LOW --> EXT1

Trading Applications

1. Mean Reversion Strategy

Z-ScoreSignal
< -2Consider buying (price abnormally low)
> +2Consider selling (price abnormally high)
Approaching 0Take profits (returning to mean)

2. Pairs Trading

Compare Z-Scores of two correlated assets:

  • Diverging Z-Scores → Trade the spread
  • Converging Z-Scores → Close position

3. Risk Management

Flag positions where the Z-Score exceeds a threshold, for review.


Statistical Context

The Z-Score assumes a normal distribution:

Z-Score RangeData Within Range
±1σ~68%
±2σ~95%
±3σ~99.7%

In practice, financial data often has "fat tails": extreme events happen more often than a normal distribution predicts.


Parameters

ModuleLook-back for mean and standard deviation
Z Score (custom)The window of the modules you connect to Average and Standard Deviation (common: 20, 50, 100 bars)
Z Score (simple)All bars from the start of the run to the current bar

Shorter look-backs = more reactive but noisier
Longer look-backs = smoother but slower to adapt


Z-Score vs Other Normalization

MethodFormulaUse Case
Z-Score(X - μ) / σMean reversion, outlier detection
Min-Max(X - min) / (max - min)Bounded 0-1 scaling
PercentileRank / NDistribution-free ranking

Advantages

  • Standardized — Comparable across assets
  • Statistical foundation — Based on probability theory
  • Mean reversion — Well suited to reversion strategies
  • Outlier detection — Identifies unusual price behavior

Disadvantages

  • Assumes normality — Markets often have fat tails
  • Backward-looking — Mean and standard deviation come from history
  • Look-back sensitive — The look-back length matters
  • Trending markets — May give signals too early

Further Reading

Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5