Z-Score Oscillator

May 25, 2026

Static chart image
Signals
Oscillators
Divergences

The Z-Score Oscillator indicator is a statistical momentum tool that measures how far the current price deviates from its rolling mean in standard deviation units to identify overbought and oversold conditions. It provides a statistically grounded measure of extremity that automatically adapts to changing volatility regimes across any asset or timeframe.

Usage

The Usage section describes how the script can be used to identify market extremes, trend strength, and potential reversals.

  • Mean-Reversion: Use the oscillator to identify statistical extremes (overbought/oversold) where the price is likely to return to its average.
  • Trend Confirmation: Persistent elevation in the z-score can confirm strong trending behavior.
  • Divergence Spotting: Identify potential reversals or trend continuations by spotting discrepancies between price action and momentum.
  • Mode Interpretation:
    • Oscillator Mode: Normalizes data into a fixed ±100 range. Readings above +100 or below -100 indicate statistical extremes based on the selected percentiles.
    • Z-Score Mode: Displays the raw number of standard deviations from the mean. This is useful for traders who prefer viewing literal sigma levels (e.g., ±2.0 or ±3.0).
    • Percentile Rank Mode: Displays the rank of the current value within its history, ranging roughly ±50. This mode is distribution-free and ideal for volatile assets.

Details

The script offers two primary calculation methods to define the "center" and "spread" of price:

  1. Mean / StDev: The classic approach using arithmetic mean and standard deviation. It is statistically conventional but can be sensitive to large price outliers.
  2. Median / MAD: A robust alternative using the median and Median Absolute Deviation. This method is outlier-resistant and recommended for markets with frequent gaps or long wicks, such as cryptocurrencies.

The indicator utilizes a Multi-Period Percentile Blend, which calculates thresholds across three different lookback windows simultaneously. This prevents the overbought/oversold levels from being overly sensitive to short-term spikes while maintaining relevance to recent price action.

Settings

Display & Z-Score Settings

  • Mode: Switches between Oscillator, Z-Score, and Percentile Rank displays.
  • Calculation Method: Selects between "Mean / StDev" (Classic) or "Median / MAD" (Robust).
  • Rolling Window: The lookback period used to calculate the mean and deviation.
  • Percentile Lookback: The history used to determine what constitutes an "extreme" value.
  • Upper/Lower Percentile: Defines the statistical cutoffs for overbought (default 95%) and oversold (default 5%) levels.

Multi-Period & Smoothing

  • Enable Multi-Period Blend: Toggles the weighted blending of three different lookback periods for thresholds.
  • Smoothing Type: Provides five options (ALMA, LinReg, Hull MA, Super Smoother, Two-Pole Gaussian) to reduce bar-to-bar noise.
  • Smoothing Length: The period for the selected smoothing algorithm.

Divergence

  • Enable Divergence Detection: Toggles the detection of Regular (reversal) and Hidden (continuation) divergences.
  • Pivot Lookback Right/Left: Sets the number of bars required to confirm a high or low pivot.
  • Delay Plot Until Candle Closes: Prevents repainting by waiting for the price bar to finalize before marking a divergence.

FAQ

How do I interpret a Z-Score of +2.0? In Z-Score mode, a +2.0 reading means the price is currently two standard deviations above its rolling average, which is statistically significant in most distributions.

What is the benefit of the Median / MAD method? The Median / MAD method is less affected by extreme "black swan" events or outliers, ensuring that a single massive price spike doesn't distort the indicator's scale for the subsequent periods.

How can I access the Z-Score Oscillator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.