Volatility Cone Percentiles
A raw ATR or standard-deviation reading tells you a number, but not whether that number is unusual. This indicator answers the second question directly. It computes rolling realised volatility - the standard deviation of single-bar log returns over a short window, expressed as a percentage of price - and separately builds the full historical distribution of that same measure over a much longer lookback. The current reading is then plotted alongside five percentile lines (P10/P25/P50/P75/P90) taken from that distribution, so a glance shows whether today sits in the calm bottom decile or the stretched top decile of how this exact symbol has actually behaved. Sorting hundreds of historical samples on every tick would be wasteful, so the percentile levels are recomputed only once every InpRecalcBars newly closed bars and held flat between recalculations - a deliberate step function, not a continuously flexing cone. The realised-volatility line itself still updates every bar. This stays in native per-bar percentage terms rather than annualising, since annualising requires assumptions about trading days that vary by broker and symbol; comparing the line to the percentile bands on the same instrument does not need that conversion. Notes and limitations - The percentile bands are a step function, not a smooth curve - they only move at each recalculation, by design, to keep the sort operation affordable. - Realised volatility here is close-to-close, not a range-based estimator; it will read lower than range-based measures on gappy instruments. - Needs at least InpVolWindow * 5 bars of history before the distribution becomes meaningful; on a freshly opened chart the percentile lines stay blank until enough history has loaded. - This describes volatility, not direction. It does not size a position or place a stop.
Indicator · MT4 · v1.0 · Free
About Volatility Cone Percentiles
Volatility Cone Percentiles is an indicator for MetaTrader 4. It has 3 settings, such as Vol window, Lookback bars and Recalc bars. MQL source code included.
Files in the download: VolatilityConePercentiles.ex4, VolatilityConePercentiles.mq4, VolatilityConePercentiles.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Vol window | 20 | Bars used for each rolling realised-volatility reading |
| Lookback bars | 500 | Historical bars scanned to build the percentile distribution |
| Recalc bars | 20 | Recompute percentiles every this many newly closed bars |
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 · MT4 Indicator · MQL4 Source Code