Volatility Regime Indicator: Low, Normal, High in Subwindow
Info
The Volatility Regime Indicator: Low, Normal, High in Subwindow is a Indicator for MetaTrader 5 that understanding volatility regimesvolatility is dynamic, characterized by periods of low and high activity. The effectiveness of trading strategies, stop-loss placements, and position sizing can significantly differ across these regimes.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Indicators folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Volatility Regime Indicator: Low, Normal, High in Subwindow
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
Understanding Volatility RegimesVolatility is dynamic, characterized by periods of low and high activity.
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.
Description & Settings
Related: Gold Volatility and Risk Meter: ATR Regimes and Stop Cost Analysis for XAUUSD - another powerful indicator for MetaTrader 5 traders.
Understanding Volatility RegimesAlso recommended: XAUUSD Hourly Volatility Clock: Typical Hourly Range vs. Current Hour - similar indicator with strong performance on MetaTrader 5.
Volatility is dynamic, characterized by periods of low and high activity. The effectiveness of trading strategies, stop-loss placements, and position sizing can significantly differ across these regimes. While an absolute Average True Range (ATR) value can be difficult to interpret due to symbol, timeframe, and historical context, this indicator provides a relative measure.
It answers the question: Is the current volatility high or low compared to the recent history of the same trading instrument?
The indicator calculates the ATR (using Wilder's smoothing method) for each bar. This can be optionally expressed as a percentage of the closing price to mitigate the impact of long-term price trends on the comparison. It then determines the percent rank, which represents the proportion of previous bars within the lookback period that had lower volatility than the current bar. A rank of 90, for instance, indicates that the current volatility exceeds that of 90% of the preceding bars.
This rank is categorized into three regimes using two thresholds: Low (rank at or below the InpLowPercentile), High (rank at or above the InpHighPercentile), and Normal (for ranks falling between these thresholds).
Interpreting the Indicator
Histogram: Displays the volatility's percent rank on a scale of 0 to 100.
Bar Color: Indicates the current regime: Low (default blue), Normal (default gray), and High (default orange-red). A black and white display uses dark gray, medium gray, and white, respectively.
Dotted Levels: Represent the thresholds (InpLowPercentile and InpHighPercentile, defaulting to 25 and 75) that define the boundaries between regimes.
Info Label: Located in the upper-left corner of the subwindow, this label shows the current regime, the number of consecutive bars in that regime, the calculated rank, and the current ATR (either as a percentage of the close or in price points if normalization is disabled).
Alerts: Optional alerts can be configured to trigger when the volatility regime changes between two closed bars, such as a transition from Normal to High.
Typical Reading: A prolonged Low regime often precedes a period of increased volatility. Conversely, a High regime signifies significant price swings, typically necessitating wider stop-loss levels and smaller position sizes, and usually subsides over time.
Figure 1. Volatility Regime displayed below an H1 chart, illustrating a period of low volatility, followed by a High regime during a sharp decline, and then a return to calmer conditions. The black and white visualization adheres to Code Base image guidelines, with colors being customizable.
External Variables (Inputs)
Input
Default
Purpose
InpATRPeriod
14
Period for ATR calculation (minimum 2).
InpNormalize
true
true: ATR is measured as a percentage of the closing price; false: ATR is measured in price units.
InpLookback
100
Number of preceding bars used for percent rank calculation (minimum 10).
InpLowPercentile
25.0
The rank threshold below which the regime is considered Low. Must be greater than 0 and less than InpHighPercentile.
InpHighPercentile
75.0
The rank threshold at or above which the regime is considered High. Must be less than 100.
InpAlertOnChange
false
Enables alerts when the regime changes between two closed bars.
InpShowInfoLabel
true
Displays the information label detailing the current regime, rank, and ATR.
InpLabelColor
clrSilver
Sets the color for the information label.
Regime colors can be adjusted in the indicator's properties under the 'Colors' tab.
Recommended Usage
Symbols and Timeframes: The indicator is effective on any symbol and timeframe. As the regime is relative to the instrument's own historical data, consistent thresholds can be applied across different instruments. On intraday charts, volatility often exhibits a daily pattern (e.g., higher during market open). A High regime near session open might be normal; using a longer InpLookback period can help mitigate this effect.
Lookback Period: A shorter lookback period allows for quicker adaptation but may result in frequent regime changes. A longer lookback period offers more stability but reacts slower to evolving market conditions. The indicator requires InpATRPeriod + InpLookback bars for its initial calculation before display.
Thresholds: Default thresholds of 25/75 divide the historical data into quarters, ensuring that Low or High regimes are not excessively rare. For identifying only extreme conditions, consider using thresholds like 10/90.
Typical Applications: Adjust stop-loss distances or position sizes based on the volatility regime. Switch between trend-following and range-trading strategies. Filter signals from other indicators, for instance, by disregarding breakouts during a Low volatility regime. Note that the indicator solely measures price movement magnitude and does not indicate direction.
Caveats: The percent rank for the most recent bar is subject to change with every tick until the bar closes. Rank is a relative measure; if the entire recent history has been exceptionally volatile, a 'Normal' regime might still correspond to substantial price movements. The regime detection occurs after volatility has already shifted, thus describing the current state rather than predicting future changes.
Calculation: After the initial full calculation, only the forming bar and subsequent new bars undergo recalculation. The ATR is updated recursively, and the rank calculation requires a single pass through the lookback window for each bar.
Account Types: This indicator is non-trading and functions identically on both netting and hedging account types.
The information label is created within the indicator's subwindow using a unique prefix and is automatically removed when the indicator is deleted or reinitialized.
You may also like: Intraday Volatility Profile: Understanding Market Activity - excellent alternative for indicator users on MetaTrader 5.
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 indicator_separate_window
#property indicator_buffers 6
#property indicator_plots 1
#property indicator_label1 "Volatility Rank"
#property indicator_type1 DRAW_COLOR_HISTOGRAM
#property indicator_color1 clrDodgerBlue,clrGray,clrOrangeRed
.......
⚠ 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.