Skip to Content
ChartIndicatorsVarianceRatio

VarianceRatio

VarianceRatio (VR, Lo and MacKinlay’s variance ratio) shows whether price moves continue over a scale of several bars or reverse. Around 1 is a random walk, above 1 is a trend, below 1 is mean reversion. The indicator helps choose a strategy: trend-following or mean reversion.

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

How to read it

What the line shows is set by the Show parameter:

  • Ratio — the VR value itself; the level 1 is the border between a trend and mean reversion;
  • z-statistic — the same difference from a random walk in units of the estimate’s error: an absolute value above 1.96 means the difference is noticeable over the window.

With VR above 1 trend-following strategies fit, with VR below 1 mean-reversion strategies do.

The z-statistic is a scale, not a strict statistical test: overlapping windows and changing volatility inflate it.

How it is calculated

  1. The logarithmic changes of the price set in Source over the last Window bars are taken.
  2. The variance of the changes over Lag bars is divided by the variance of one-bar changes multiplied by the lag. For a random walk this ratio equals 1.
  3. In the z-statistic mode the deviation of VR from 1 is divided by its expected error for this window and lag.

The first value appears on bar number “window + 1” — the 201st with the default settings. If Window is less than Lag + 1, it is raised to Lag + 1. If the price is zero or below, or did not change over the whole window, the line breaks.

Parameters

ParameterDescriptionDefault
LagChanges over this many bars are compared with one-bar changes. At least 2.4
WindowHow many last bars are in the estimate; fewer is noisier. At least 10.200
SourceThe bar price used in the calculation: Close — the close, Median — (High + Low) / 2, Typical — (High + Low + Close) / 3.Close
ShowRatio or z-statistic.Ratio

Plots

ParameterDescriptionDefault
VRThe variance ratio or its z-statistic.Orange, solid, width 1

Levels

The levels are visible in the settings and on the chart only in their mode.

ParameterDescriptionDefault
Random walkNeither a trend nor reversion. Ratio mode.1, blue
TrendA noticeable trend. z-statistic mode.1.96, blue
ReversionA noticeable mean reversion. z-statistic mode.−1.96, blue

Style

The VR 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. A visible level shows its value on the right scale.

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

Last updated on