Multi-Timescale Robust Z-Score | NAL

3 344
Multi-Timescale Robust Z-Score is a statistical momentum framework designed to evaluate price displacement across multiple observation horizons using median-based normalization and robust dispersion estimation.

Traditional Z-scores rely on the arithmetic mean and standard deviation, making their readings sensitive to extreme observations and the selection of a single lookback period.

This model addresses both limitations by calculating robust Z-scores across a structured range of historical windows and aggregating their results into one unified statistical signal.

The objective is to distinguish persistent directional displacement from isolated statistical extremes while reducing dependence on any single estimation horizon.

1. Robust Statistical Normalization

Each observation window independently calculates a robust measure of price displacement.

Instead of using the conventional mean and standard deviation, the model uses:

  1. Rolling Median — estimates the central tendency of price while reducing sensitivity to extreme observations.
  2. Median Absolute Deviation (MAD) — estimates dispersion relative to the rolling median.
  3. Robust Z-Score — expresses current price displacement relative to these robust statistical estimates.


The MAD is scaled by 1.4826 to approximate standard-deviation units under a normal distribution.

Pine Script®


This produces a more outlier-resistant representation of relative price displacement than a conventional mean-based Z-score.

2. Multi-Timescale Architecture

Rather than relying on one arbitrarily selected lookback, the model evaluates multiple historical windows simultaneously.

The user specifies a central lookback, the number of additional windows on either side, and the spacing between them.

For example, a central length of 60, five windows on each side, and a spacing of 10 produces 11 independent statistical observations spanning 10 to 110 bars.

Each window produces its own robust Z-score before the results are consolidated.

Multi-timescale refers to multiple historical window lengths on the selected chart timeframe, not separate chart timeframes.

3. Robust Aggregation

The individual Z-scores are combined into a single composite reading using one of two methods:

  1. Median Aggregation — the default configuration, designed to reduce the influence of unusually extreme readings from individual windows.
  2. Mean Aggregation — provides an arithmetic consensus across the complete window structure.


Pine Script®


The model only produces its final composite once every configured window has sufficient valid observations.

4. Directional State Classification

The aggregated Z-score is evaluated against configurable directional thresholds.

  1. Bullish — the composite Z-score reaches or exceeds the upper threshold.
  2. Neutral — the composite remains between the directional thresholds.
  3. Bearish — the composite Z-score reaches or falls below the lower threshold.


The neutral state can be disabled, allowing the model to preserve its previous bullish or bearish classification until the opposing threshold is reached.

Because thresholds are independently configurable, a bearish classification does not necessarily require a negative Z-score. It represents the model's position relative to the selected directional boundaries.

Visuals & Interpretation

The indicator displays the aggregated robust Z-score as a continuously updated oscillator, with colors reflecting the prevailing directional state.

Additional visualization features include:

  1. Dynamic bullish, bearish, and neutral coloration
  2. Configurable directional threshold lines
  3. Zero-centered statistical reference
  4. Optional comparison between median and mean aggregation
  5. Trend-colored candles on the main chart
  6. Standard, Nordic, and Simple color presets


Practical Application

The central advantage of the model is its ability to evaluate whether statistical displacement is consistent across multiple observation horizons, rather than being disproportionately influenced by one lookback or a small number of extreme price observations.

By combining robust statistics with multi-window aggregation, the indicator provides a structured measure of relative momentum, statistical extension, and directional market state.

At its core, the model asks:

Is the observed price displacement supported across multiple statistical horizons, or is it primarily a consequence of a narrow estimation window?

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.