Indicator · Pine Script v6 · Own pane

Mean Reversion (z-score)

by natalivm

A separate-pane oscillator that plots a z-score, the distance of price from its rolling mean measured in standard deviations, smoothed over a few bars.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code174
Settings18inputs
LicenceNone stated
Last updateyesterday28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Dots mark turns that happen outside a chosen zone around zero. An AR(1) half-life readout and optional regime gates using variance ratio and Hurst exponent can hide dots when the symbol is trending. Settings cover lookback, smoothing, zone limits, dot mode, drawing style, colors and a statistics table.

Details

Published by

natalivm on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Mean reversion, Oscillators & momentum

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourceclosesrc
Lookbackint50len
Smooth overint5smoothLn
Zone from ±float0.382zoneIn
to ±float0.618zoneOut
Dot sitsstringD_PEAKdotMode
Bars either side of the turnint3confirm
Only on a new extremebooltruenewExt
Hide dots when the half-life is longer than the lookbackbooltruehlGate
Hide dots when the symbol is trendingboolfalsegateOn
Variance ratio horizon (q)int4vrLag
Trade only while Hurst <float0.5hurstMx
Show all 18 settings
SettingTypeDefaultVariable
Draw asstringP_LINEplotAs
Richcolor#4a7dffupCol
Cheapcolor#4a7dffdnCol
Turn downcolor#f23645hiDot
Turn upcolor#089981loDot
Stats tablebooltrueshowTbl
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

261 stars

This indicator calculates standardized z-scores of price data across four different lookback periods (6, 14, 26, and 100). Standardizing data subtracts the moving average from the price and divides by the standard deviation. It applies a Double Exponential Mov

Indicator v5 Mean reversionVolatility & bands
114 stars

This indicator calculates normalized percentage bounds around price highs and lows to anticipate local trend reversals. It oscillates within a fixed -1 to 1 channel and plots two boundary tracking curves alongside a background Karobein oscillator histogram for

Indicator v4 Mean reversionOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Mean Reversion Indicator
99 stars

This indicator calculates the statistical autocorrelation coefficient of an input series over a user-defined lookback window at a specified lag. It tracks values using an internal circular buffer, computes sample mean, variance, and autocovariance, and normali

Indicator v6 TrendMean reversion
Updated 4 weeks ago · Apache-2.0 GitHub repository of Autocorrelation Function (ACF)

Pretty Good Oscillator

by mihakralj
47 stars

The Pretty Good Oscillator calculates the distance between the selected price source and its simple moving average, normalized by the Average True Range over a specified period. It renders as an oscillator line in a separate pane alongside a zero line and thre

Indicator v6 Oscillators & momentumMean reversion
Updated 8 months ago · MIT GitHub repository of Pretty Good Oscillator

Calculates a composite carry and decay oscillator fusing impulse-autocorrelation half-life, a Hurst exponent approximation, path efficiency, and range expansion ratios. It evaluates whether an impulse is likely to persist or mean-revert, plotting the oscillato

Indicator v6 TrendOscillators & momentum
Updated 2 days ago · MIT GitHub repository of Market Memory & Decay Oscillator [WavesUnchained]

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers