Volatility Regime Shader for MT4: Adaptive Volatility Classification
Info
The Volatility Regime Shader for MT4: Adaptive Volatility Classification is a Indicator for MetaTrader 4 that volatility regime shader classifies market volatility into three regimes and shades the chart background accordingly. Instead of comparing ATR to a fixed value, it calculates the percentile rank of the current ATR within a lookback window.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Indicators folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use Volatility Regime Shader for MT4: Adaptive Volatility Classification
1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.
2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.
3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.
4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.
Frequently Asked Questions
Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."
Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).
Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.
What this tool does
Volatility Regime Shader classifies market volatility into three regimes and shades the chart background accordingly.
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Indicator works on MetaTrader 4. Place the file in the MQL4/Indicators folder and restart the terminal.
Description & Settings
Related: Copilot Adaptive Regime Candles - another powerful indicator for MetaTrader 4 traders.
Volatility Regime Shader classifies market volatility into three regimes and shades the chart background accordingly. Instead of comparing ATR to a fixed value, it calculates the percentile rank of the current ATR within a lookback window. A percentile of 90 means the current ATR is higher than 90% of the values in that window, so the reading adapts automatically to any symbol and timeframe.Also recommended: volatility change indicator - similar indicator with strong performance on MetaTrader 4.
Bars at or below the Compression threshold are shaded light blue, and bars at or above the Expansion threshold are shaded light red. Normal bars are left unshaded by default. A label in the upper-right corner shows the current regime and ATR percentile.
The regimes can be used as a filter for other strategies. Compression phases often come before breakouts, so breakout systems can wait for compression before arming. Expansion phases favor trend continuation and wider stops, while mean-reversion entries are usually safer in compression or normal conditions.
Input Parameters
ATR period
Period of the ATR used to measure volatility. Default 14.
Percentile lookback
Number of previous bars the current ATR is ranked against. Default 100.
Compression at or below percentile
Percentile at or below which a bar is classified as Compression. Default 20.
Expansion at or above percentile
Percentile at or above which a bar is classified as Expansion. Default 80.
Bars to calculate and shade
How many recent bars are calculated and shaded. Default 3000.
Compression / Expansion / Normal shade
Background colors for each regime.
Shade Normal regime
Also shades Normal bars when enabled.
Show current regime label
Shows the current regime and ATR percentile in the upper-right corner.
Pop-up / push / sound alerts
Alerts when a newly closed bar starts a different regime.
Expert Advisors can read two buffers with iCustom. Buffer 0 holds the ATR percentile (0 to 100) and buffer 1 holds the regime code: 0 for Compression, 1 for Normal and 2 for Expansion. Both values are also visible in the Data Window. The values of the forming bar update with price, while alerts use closed bars only.
You may also like: starc bands: understanding market volatility - excellent alternative for indicator users on MetaTrader 4.
Source Code
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
input string InpHdrCalc = "===== Calculation =====";
input int InpAtrPeriod = 14;
input int InpLookback = 100;
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.