OPEN-SOURCE SCRIPT

Range Volatility Oscillator [Session Adjusted]

25
Description
This open-source indicator calculates a volatility oscillator based purely on price range expansion/contraction (High − Low), making it especially suitable for instruments with well-defined trading sessions (FTSEMIB, DAX, ES, NQ, forex majors during London/NY overlap, etc.).

Instead of using price returns or close-based volatility, it compares short-term and long-term simple moving averages of the daily range, then expresses the relative difference as a percentage oscillator — similar in spirit to a MACD-style momentum readout, but applied to volatility itself.

Core Concept
Fast SMA(range, fast × candles_per_session)
Slow SMA(range, slow × candles_per_session)
Oscillator = 100 × (Fast / Slow − 1)

Positive values → recent ranges are expanding compared to the longer-term average (rising volatility / potential trend acceleration or breakout environment).
Negative values → ranges are contracting (falling volatility / potential consolidation or mean-reversion setup).
Zero line acts as the neutral pivot between expanding vs contracting regimes.

Key Features
- Session-aware calculation — user inputs session duration (default 6.5 h) → automatically estimates how many candles = 1 trading day on the current timeframe
- Works on any timeframe (1 min → daily), including irregular ones
- Optional signal line (SMA of the oscillator) for smoother readings and crossover strategies
- Clean, minimalistic plot with customizable colors
- Zero line always visible (dotted)

Typical Usage Ideas
- Rising oscillator + above zero → increasing volatility → favor momentum / breakout / trend-following strategies
- Falling oscillator / below zero → decreasing volatility → consider mean-reversion, tightening stops, or waiting for compression → expansion setups
- Signal line crossovers — fast line crossing above signal = short-term volatility pickup, crossing below = volatility cooling
- Divergences between price and the oscillator can sometimes highlight weakening trends (classic volatility divergence)

Combine with trend filters (EMA, VWAP, SuperTrend), support/resistance or volume for higher-probability setups.

Recommended Starting Settings
Session Duration: 6.5–8.5 hours (adjust to your market — e.g. 8.5 for many European indices, 6.5 for US regular session).

Fast SMA Length: 5 days
Slow SMA Length: 15 days
Signal-line Length: 3 days (if enabled)

Best results usually appear on intraday timeframes (3 min – 30 min) and on instruments with clear session boundaries and meaningful daily ranges.

Notes / Limitations
- Pure range-based → ignores gaps, overnight moves and volume
- Not normalized to ATR or percentage of price → readings are relative within each instrument
- Very low-liquidity / very small-range instruments may produce noisy output

Released under open source — feel free to modify, combine with other logic or use in strategies.
Feedback and improvements are welcome!

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。