HVR
HVR (Historical Volatility Ratio) is a custom indicator for MT5 that calculates the ratio of 6-period historical volatility to 100-period historical volatility, displayed in a separate window. It uses log returns of a selectable applied price and computes annualized standard deviation (assuming 52-week basis) for both short and long windows. The HTF version allows displaying this indicator on a higher timeframe while viewing a lower timeframe chart.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
The core concept of the HVR indicator is to calculate the ratio of short-term (6-period) to long-term (100-period) historical volatility, measuring relative changes in market volatility. The indicator first computes log returns (ln(P_t/P_{t-1})) of a user-selected applied price, then calculates sample standard deviations over 6-period and 100-period windows respectively, multiplying by 7.2111 (which is √52, for annualizing weekly volatility) to produce annualized figures. The final indicator value is hv6/hv100; a ratio above 1 indicates short-term volatility exceeds long-term volatility, suggesting the market may be in an active phase, while below 1 suggests the opposite. The indicator itself contains no entry or exit conditions, nor any position sizing or money management logic — it serves purely as a volatility analysis tool. The HTF version calls the base HVR indicator via iCustom, enabling multi-timeframe display so traders can observe higher-timeframe volatility ratio changes on lower-timeframe charts.
Strengths
- The volatility ratio analysis provides an intuitive quantitative measure of market volatility regime changes, helping identify whether the market is in a calm or active phase
- Supports 12 applied price types including custom Simpl, Quarter, TrendFollow, and Demark prices, offering high flexibility
- The HTF version enables multi-timeframe display, convenient for volatility analysis across different timeframes
- Uses a circular buffer (Count array) for efficient data management, reducing memory reallocation overhead
Weaknesses
- The indicator provides no trading signals or threshold reference lines; traders mustindependently interpret the volatility ratio and develop their own trading strategies
- The 6-period and 100-period window lengths are hardcoded and not adjustable via parameters, limiting strategy adaptability
- The annualization factor 7.2111 (√52) assumes weekly periods; using it on other timeframes produces inaccurate annualized volatility
- The circular buffer indexing logic (Recount_ArrayZeroPos) adds code complexity and reduces readability
Possible improvements
- Make the 6 and 100 window lengths configurable input parameters, and auto-calculate the annualization factor based on the current chart timeframe (e.g., √252 for daily, √(252*24) for hourly)
- Add overbought/oversold threshold horizontal lines or signal lines to help traders more intuitively identify extreme volatility states
- Replace the current Count array indexing scheme with a cleaner circular buffer implementation, or use MQL5's CopyBuffer family of functions to simplify data access
Risk assessment
Overall risk: Safe
- This is a pure analysis tool that executes no trades, posing no trading risk
- The annualization factor may produce misleading values when used on non-weekly timeframes
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
IPC | PRICE_CLOSE_ | Applied price type |
TimeFrame | PERIOD_H4 | Higher timeframe for HTF version |
Shift | 0 | Vertical shift for HTF indicator |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.