OPEN-SOURCE SCRIPT
Relative Volatility Mass [SciQua]

The ⚖️ Relative Volatility Mass (RVM) is a volatility-based tool inspired by the Relative Volatility Index (RVI).
While the RVI measures the ratio of upward to downward volatility over a period, RVM takes a different approach:
This makes RVM particularly useful for identifying sustained high-volatility conditions without being diluted by averaging.
────────────────────────────────────────────────────────────
╭────────────╮
How It Works
╰────────────╯
1. Standard Deviation Calculation
• Computes the standard deviation of the chosen `Source` over a `Standard Deviation Length` (`stdDevLen`).
2. Directional Separation
• Volatility on up bars (`chg > 0`) is treated as upward volatility.
• Volatility on down bars (`chg < 0`) is treated as downward volatility.
3. Rolling Sum
• Over a `Sum Length` (`sumLen`), the upward and downward volatilities are summed separately using `math.sum()`.
4. Relative Volatility Mass
• The two sums are added together to get the total volatility mass for the rolling window.
Formula:
RVM = Σ(σup) + Σ(σdown)
where σ is the standard deviation over `stdDevLen`.
╭────────────╮
Key Features
╰────────────╯
╭─────╮
Usage
╰─────╯
RVM is not bounded like the RVI, so absolute values depend on market volatility and chosen parameters.
Consider normalizing or using smoothing for easier visual comparison.
╭────────────────╮
Example Settings
╰────────────────╯
╭───────────────────╮
Notes & Limitations
╰───────────────────╯
╭───────╮
Credits
╰───────╯
While the RVI measures the ratio of upward to downward volatility over a period, RVM takes a different approach:
- It sums the standard deviation of price changes over a rolling window, separating upward volatility from downward volatility.
- The result is a measure of the total “volatility mass” over a user-defined period, rather than an average or normalized ratio.
This makes RVM particularly useful for identifying sustained high-volatility conditions without being diluted by averaging.
────────────────────────────────────────────────────────────
╭────────────╮
How It Works
╰────────────╯
1. Standard Deviation Calculation
• Computes the standard deviation of the chosen `Source` over a `Standard Deviation Length` (`stdDevLen`).
2. Directional Separation
• Volatility on up bars (`chg > 0`) is treated as upward volatility.
• Volatility on down bars (`chg < 0`) is treated as downward volatility.
3. Rolling Sum
• Over a `Sum Length` (`sumLen`), the upward and downward volatilities are summed separately using `math.sum()`.
4. Relative Volatility Mass
• The two sums are added together to get the total volatility mass for the rolling window.
Formula:
RVM = Σ(σup) + Σ(σdown)
where σ is the standard deviation over `stdDevLen`.
╭────────────╮
Key Features
╰────────────╯
- Directional Volatility Tracking – Differentiates between volatility during price advances vs. declines.
- Rolling Volatility Mass – Shows the total standard deviation accumulation over a given period.
- Optional Smoothing – Multiple MA types, including SMA, EMA, SMMA (RMA), WMA, VWMA.
- Bollinger Band Overlay – Available when SMA is selected, with adjustable standard deviation multiplier.
- Configurable Source – Apply RVM to `close`, `open`, `hl2`, or any custom source.
╭─────╮
Usage
╰─────╯
- Trend Confirmation: High RVM values can confirm strong trending conditions.
- Breakout Detection: Spikes in RVM often precede or accompany price breakouts.
- Volatility Cycle Analysis: Compare periods of contraction and expansion.
RVM is not bounded like the RVI, so absolute values depend on market volatility and chosen parameters.
Consider normalizing or using smoothing for easier visual comparison.
╭────────────────╮
Example Settings
╰────────────────╯
- Short-term volatility detection: `stdDevLen = 5`, `sumLen = 10`
- Medium-term trend volatility: `stdDevLen = 14`, `sumLen = 20`
- Enable `SMA + Bollinger Bands` to visualize when volatility is unusually high or low relative to recent history.
╭───────────────────╮
Notes & Limitations
╰───────────────────╯
- Not a directional signal by itself — use alongside price structure, volume, or other indicators.
- Higher `sumLen` will smooth short-term fluctuations but reduce responsiveness.
- Because it sums, not averages, values will scale with both volatility and chosen window size.
╭───────╮
Credits
╰───────╯
- Based on the Relative Volatility Index concept by Donald Dorsey (1993).
- TradingView
- SciQua - Joshua Danford
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
🚀 Founder of SciQua | Strategy. Simulation. Signals.
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
🚀 Founder of SciQua | Strategy. Simulation. Signals.
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。