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 the current Average True Range (ATR) against its values over a rolling lookback window. Unlike a fixed ATR cutoff, the percentile rank adapts to the instrument and timeframe. The chart shades compression and expansion bars, can optionally shade normal conditions, displays the current regime, and supports alerts when a newly closed bar changes regime.

The note proposes using regimes as context for other strategies: compression may serve as a setup condition for breakout systems, expansion may support trend continuation with wider stops, and mean-reversion entries may be more suitable in normal or compressed conditions. These are suggested uses, not results from a reported test. The indicator exposes the ATR percentile and a numeric regime code through buffers that Expert Advisors can read. Values for a forming bar can change with price, while alerts rely on closed bars. The document gives input settings and practical usage details but provides no backtest evidence that the regime categories improve trading outcomes.

Key ideas

  • The indicator assigns volatility regimes using the current ATR's percentile rank in a rolling history.
  • Percentile thresholds define compression and expansion, with readings between them treated as normal.
  • Compression can be used as a condition before arming breakout strategies, while expansion may suit trend-continuation approaches.
  • Mean-reversion entries are suggested for normal or compressed regimes, but this is not backed by reported testing.
  • Expert Advisors can access the percentile and regime code, and regime-change alerts use closed bars.

Tags

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