Description: The HV-RV Oscillator is a powerful tool designed to help traders track and compare two types of volatility measures: Historical Volatility (HV) and Realized Volatility (RV). This indicator is useful for identifying periods of market volatility and can be employed in various trading strategies. It plots both volatility measures on a normalized scale (0 to 100) to allow easy comparison and analysis.
How It Works: Historical Volatility (HV):
HV is calculated by taking the log returns of the closing prices and finding the standard deviation over a specified period (default is 14 periods). The value is then annualized assuming 252 trading days in a year.
Realized Volatility (RV):
RV is based on the True Range, which is the maximum of the current high-low range, the difference between the high and the previous close, and the difference between the low and the previous close. Like HV, the standard deviation of the True Range over a specified period is calculated and annualized. Normalization:
Both HV and RV values are normalized to a 0-100 scale, making it easy to see their relative magnitude over time. The highest and lowest values within the period are used to normalize the data, which smooths out short-term volatility spikes. Smoothing:
The normalized values of both HV and RV are then smoothed using a Simple Moving Average (SMA) to reduce noise and provide a clearer trend. Crossover Signals:
Buy Signal: When the Normalized HV crosses above the Normalized RV, it indicates that the historical volatility is increasing relative to the realized volatility, which could be interpreted as a buy signal. Sell Signal: When the Normalized HV crosses below the Normalized RV, it suggests that the historical volatility is decreasing relative to the realized volatility, which could be seen as a sell signal. Features: Two Volatility Lines: The blue line represents Normalized HV, and the orange line represents Normalized RV. Neutral Line: A gray dashed line at the 50 level indicates a neutral state between the two volatility measures. Buy/Sell Markers: Green upward arrows are shown when the Normalized HV crosses above the Normalized RV, and red downward arrows appear when the Normalized HV crosses below the Normalized RV. Inputs: HV Period: The number of periods used to calculate Historical Volatility (default = 14). RV Period: The number of periods used to calculate Realized Volatility (default = 14). Smoothing Period: The number of periods used for smoothing the normalized values (default = 3). How to Use: This oscillator is designed for traders who want to track the relationship between Historical Volatility and Realized Volatility. Buy signals occur when HV increases relative to RV, which can indicate increased market movement or potential breakout conditions. Sell signals occur when RV is greater than HV, signaling reduced volatility or potential trend exhaustion. Example Use Cases: Breakout/Trend Strategy: Use the oscillator to identify potential periods of increased volatility (when HV crosses above RV) for breakout trades. Mean Reversion: Use the oscillator to detect periods of low volatility (when RV crosses above HV) that might signal a return to the mean or consolidation. This tool can be used on any asset class such as stocks, forex, commodities, or indices to help you make informed decisions based on the comparison of volatility measures.
NOTE: FOR INTRDAY PURPOSE USE 30/7/9 AS SETTING AND FOR DAY TRADE USE 14/7/9
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.