Skip to content
All library documents

Classifying Volatility Regimes with ATR Percentile Ranks

Article MQL5 code base

Summary

This indicator classifies volatility as compression, normal, or expansion by ranking current average true range against its values over a rolling lookback window. Percentile thresholds define the regimes, so the classification adapts to the instrument and timeframe instead of relying on one fixed ATR level. The indicator shades chart backgrounds, displays the current regime and percentile, and can alert when a newly closed bar changes regime. It also exposes the percentile and regime code through data buffers for use by automated strategies.

The description suggests using compression as a condition before activating breakout systems, expansion as a setting for trend continuation and wider stops, and compression or normal conditions for mean-reversion entries. These are proposed applications rather than results from a backtest. The thresholds and lookback are configurable, with example defaults supplied, but no evidence is given that any default or regime transition predicts a profitable trade. The forming bar's values can change with price, while alerts are based on closed bars.

Key ideas

  • ATR is ranked against a rolling history to classify volatility relative to recent conditions.
  • Percentile thresholds divide observations into compression, normal, and expansion regimes.
  • The indicator communicates regimes through chart shading, a label, alerts, and data buffers.
  • The suggested strategy uses are hypotheses; the document provides no backtest or performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.