Skip to Content
ChartIndicatorsMeanReversion

MeanReversion

MeanReversion estimates how the price reverts to VWAP: it shows either the s-score — how far the price is from equilibrium right now — or the half-life — in how many bars the deviation from VWAP halves. The deviation of the price from VWAP is treated as an Ornstein–Uhlenbeck process (the Avellaneda–Lee model).

The indicator is drawn in a separate area below the chart.

How to read it

  • s-score: in the Avellaneda–Lee model, a trade is entered when the absolute value of s is above 1.25 and exited when it is below 0.5–0.75. The 1.25 and −1.25 levels mark a price far above and far below equilibrium.
  • Half-life: if it is longer than your trade, do not count on a reversion to VWAP.
  • A break in the line means there is no reversion to VWAP over this window.

How it is calculated

  1. The deviation X = close − VWAP. VWAP accumulates from the start of the period set in VWAP anchor period; the bar price in VWAP is set by VWAP source.
  2. Over pairs of neighboring bars of the last Window bars, the regression X = a + b × X of the previous bar + ε is fitted. Pairs that cross the start of the VWAP period are not used.
  3. If b is greater than 0 and less than 1:
    • half-life = ln 2 / (−ln b);
    • equilibrium μ = a / (1 − b), its spread σ = √(variance of ε / (1 − b²));
    • s-score = (X − μ) / σ.

If b is outside the 0 to 1 interval, the line breaks in both modes.

The first value appears on bar number Window + 1 (bar 101 with the default settings). The day starts at midnight by the chart’s time scale.

Parameters

ParameterDescriptionDefault
VWAP anchor periodSince when VWAP is accumulated: Day, Week, Month or All bars.Day
VWAP sourceThe bar price in VWAP: Close — the close, Median — (High + Low) / 2, Typical — (High + Low + Close) / 3.Typical
WindowOver how many last bars the reversion is estimated, at least 3.100
Shows-score — the deviation from equilibrium in its σ, or Half-life — in bars.s-score

Plots

ParameterDescriptionDefault
LineThe s-score or the half-life.Orange, solid

Levels

The levels are shown in the settings and on the chart only in the s-score mode.

ParameterDescriptionDefault
UpperThe price is far above equilibrium.1.25, blue
LowerThe price is far below equilibrium.−1.25, blue

Style

The line has the Plot (show the line), Label (show the last value on the right scale), Color, Width (1–5) and Style (Solid, Dashes, Dots) fields.

Each level has the Show, Value, Color, Width and Style fields.

How to add an indicator to the chart is described in Adding an indicator; parameters are changed in the indicator manager.

Last updated on