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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.