ATR Percentile Rank
An ATR value by itself is close to meaningless without context - 0.0012 is enormous on a quiet pair and unremarkable on a volatile one, and the same number means something different on a 5-minute chart than on a daily chart. This indicator removes that ambiguity by counting, for every bar, what percentage of the last InpLookback ATR readings on this same symbol and timeframe sit at or below today's reading. The output is always a 0-100 number: 90 means current volatility is higher than 90% of the recent history, 10 means it is unusually quiet. That makes it directly comparable across instruments in a way raw ATR never is - an 85 on EURUSD and an 85 on gold both mean "stretched relative to its own recent normal", which is the actual question most volatility-based filters and position-sizing rules are trying to answer. It complements rather than replaces ATR-based tools already in this collection: use the pip or money value from a plain ATR reading to size a stop, and this percentile rank to judge whether the current reading is a normal day or an outlier one. Notes and limitations - Needs InpAtrPeriod + InpLookback + 1 bars of history before the first reading appears; earlier bars are intentionally left empty rather than ranked against a partial, unrepresentative sample. - Each bar's rank is derived fresh from the platform's own ATR history rather than tracked incrementally, so it cannot repaint once a bar closes and a changed InpLookback takes effect cleanly across the whole visible history. - A rank near 100 does not predict direction, only that the current range is unusually wide relative to recent history - it is a context filter, not a signal generator. - Very large InpLookback values on a long history can take a moment to finish computing when the indicator is first attached, since every bar re-scans its own lookback window.
Indicator · MT4 · v1.0 · Free
About ATR Percentile Rank
ATR Percentile Rank is an indicator for MetaTrader 4 based on ATR. It has 4 settings, such as Atr period, Lookback and High level. MQL source code included.
Files in the download: AtrPercentileRank.ex4, AtrPercentileRank.mq4, AtrPercentileRank.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Atr period | 14 | ATR averaging period |
| Lookback | 200 | Bars of ATR history the current reading is ranked against |
| High level | 80.0 | Reference line: volatility judged stretched above this |
| Low level | 20.0 | Reference line: volatility judged compressed below this |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: ATR · Trailing Stop & Break-even · MT4 Indicator · MQL4 Source Code