OPEN-SOURCE SCRIPT
Realized Volatility Comparator [AlgoTraderPro]

What it does
Plots the annualized realized volatility of the chart's symbol and of a second symbol of your choice in the same pane, so you can compare how "nervous" two assets actually are — and how that changes across years. The default comparison is gold, which makes it useful for one specific long-term study: watching Bitcoin's volatility mature toward that of older stores of value.
How it works
For each symbol the script computes the standard deviation of logarithmic returns over a configurable window, then annualizes it:
realized vol = stdev( ln(close / close[1]), window ) × √(periods per year) × 100
The annualization factor is derived from the chart timeframe automatically (a 365-day year), so the reading is comparable across daily and weekly charts. The comparison symbol's volatility is computed in its own symbol context via request.security, using its own bar series. An optional simple moving average smooths both lines, and a readout table shows the current value for each symbol plus the ratio between them.
Inputs
How to read it
The absolute level tells you the market's current disagreement about the asset's value: a young or contested asset prints high realized volatility; a settled one prints low. The slope across years tells you whether that disagreement is widening or narrowing. The ratio in the table condenses the comparison into one number — how many times more volatile the chart symbol is than the reference.
Suggested study
Load on BNC:BLX (Bitcoin Liquid Index, history back to 2010) on a weekly chart with the default gold comparison. The full history shows Bitcoin's realized volatility declining cycle after cycle while gold's stays in a low band — a maturation pattern gold itself went through after 1971.
Other uses
Position sizing context (size inversely to the regime), comparing any two assets' risk regimes before pairing them in a portfolio, or checking whether a "quiet" market is genuinely quiet by historical standards.
Plots the annualized realized volatility of the chart's symbol and of a second symbol of your choice in the same pane, so you can compare how "nervous" two assets actually are — and how that changes across years. The default comparison is gold, which makes it useful for one specific long-term study: watching Bitcoin's volatility mature toward that of older stores of value.
How it works
For each symbol the script computes the standard deviation of logarithmic returns over a configurable window, then annualizes it:
realized vol = stdev( ln(close / close[1]), window ) × √(periods per year) × 100
The annualization factor is derived from the chart timeframe automatically (a 365-day year), so the reading is comparable across daily and weekly charts. The comparison symbol's volatility is computed in its own symbol context via request.security, using its own bar series. An optional simple moving average smooths both lines, and a readout table shows the current value for each symbol plus the ratio between them.
Inputs
- Realized volatility window — bars in the standard deviation (default 26; suggested 26 on weekly ≈ six months, 90 on daily ≈ one quarter). Shorter = more reactive, longer = smoother regime view.
- Smoothing — SMA applied to both lines; 1 = off.
- Comparison symbol — any symbol (default OANDA:XAUUSD). Indices, FX, equities all work.
- Show readout table — toggles the current-values table.
- Colors — line colors for each series.
How to read it
The absolute level tells you the market's current disagreement about the asset's value: a young or contested asset prints high realized volatility; a settled one prints low. The slope across years tells you whether that disagreement is widening or narrowing. The ratio in the table condenses the comparison into one number — how many times more volatile the chart symbol is than the reference.
Suggested study
Load on BNC:BLX (Bitcoin Liquid Index, history back to 2010) on a weekly chart with the default gold comparison. The full history shows Bitcoin's realized volatility declining cycle after cycle while gold's stays in a low band — a maturation pattern gold itself went through after 1971.
Other uses
Position sizing context (size inversely to the regime), comparing any two assets' risk regimes before pairing them in a portfolio, or checking whether a "quiet" market is genuinely quiet by historical standards.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Code. Structure. Execution. Zones and flows from a live algorithmic trading desk. algotraderpro.io
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Code. Structure. Execution. Zones and flows from a live algorithmic trading desk. algotraderpro.io
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.