OPEN-SOURCE SCRIPT
Volatility Bars (with Moving Averages)

This indicator identifies trending vs. ranging market phases by comparing recent volatility to a prior period using symmetrically weighted moving averages (SWMA).
It compares volatility over two configurable windows (for example 30 vs. 60 days on daily charts) and colors bars to show relative volatility and direction.
Values of C (the volatility ratio) > 1 indicate rising volatility; C < 1 indicate falling volatility.
Recommended timeframes: 1H, 4H, 1D.
How to interpret the colors:
Note: a yellow bar indicates high volatility but does not provide information about the direction of the trend. For this reason I added a moving average for direction reference on main chart.
Practical use (options trading)
I found useful when trading Options, here are some example:
Parameters and behavior:
Two configurable windows (e.g. 30 vs. 60 on daily); the script can adapt window sizes by reference timeframe.
C = recent-window TR sum / prior-window TR sum — a relative volatility ratio.
Color thresholds are adjustable; defaults use 0.75 and 1.25.
Disclaimers:
This indicator provides informational guidance only and is not trading advice.
Backtest strategies and use risk management before applying to live trades.
It compares volatility over two configurable windows (for example 30 vs. 60 days on daily charts) and colors bars to show relative volatility and direction.
Values of C (the volatility ratio) > 1 indicate rising volatility; C < 1 indicate falling volatility.
Recommended timeframes: 1H, 4H, 1D.
How to interpret the colors:
- Yellow: recent volatility much higher than the previous period (C > 1.25). Sign of a significant increase in volatility.
- Silver: recent volatility much lower than the previous period (C < 0.75). Quieter market.
- Green: volatility within the normal range (C between 0.75 and 1.25) and bullish bar (close > open).
- Red: volatility within the normal range and bearish bar (close < open).
Note: a yellow bar indicates high volatility but does not provide information about the direction of the trend. For this reason I added a moving average for direction reference on main chart.
Practical use (options trading)
I found useful when trading Options, here are some example:
- Straddle / Strangle: consider when C is high or rising — you expect large moves but are uncertain of direction.
- Iron Butterfly: consider when C is low or falling and you expect the underlying to remain near a range (benefits from low vol and time decay).
- Iron Condor: consider when volatility is moderate-to-low and you expect limited movement within a wider range (more forgiving than a tight butterfly)
Parameters and behavior:
Two configurable windows (e.g. 30 vs. 60 on daily); the script can adapt window sizes by reference timeframe.
C = recent-window TR sum / prior-window TR sum — a relative volatility ratio.
Color thresholds are adjustable; defaults use 0.75 and 1.25.
Disclaimers:
This indicator provides informational guidance only and is not trading advice.
Backtest strategies and use risk management before applying to live trades.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。