OPEN-SOURCE SCRIPT

Helios Volatility Forecast [JOAT]

995
Helios Volatility Forecast [JOAT]

Helios Volatility Forecast is a Yang-Zhang volatility estimator with regime classification, a volatility cone (historical percentile bands), an HMA-smoothed forecast line, and a position-size suggestion. Volatility is classified into four regimes (LOW / NORMAL / ELEVATED / EXTREME) by percentile rank against its own history. Cross-pane elements paint a soft regime tint and a position-multiplier suggestion onto the price chart.

ekran görüntüsü

What makes it different
  • Most volatility indicators use a simple close-to-close standard deviation, which discards intraday range information and ignores overnight gaps. The Yang-Zhang estimator combines four components — overnight close-to-open variance, intraday open-to-close variance, and a Rogers-Satchell range term — into a single estimator that is more accurate than close-to-close for instruments that gap.
  • A 4-band volatility cone (5th, 25th, 50th, 75th, 95th percentile of the past 100 bars) is plotted around the current volatility, with gradient fills bracketing tails and the interquartile range.
  • A 4-regime classifier (LOW / NORMAL / ELEVATED / EXTREME by percentile thresholds at 25, 65, 90) drives a cross-pane tint on the price chart and a numeric position-size multiplier suggestion. The suggestion scales inversely with realized vol — wider sizes in low-vol regimes, halved sizes in extreme-vol regimes.
  • An HMA forecast line projects the smoothed vol trajectory ahead. Forecast-crossing-realized alerts fire when expansion or contraction is imminent.


How it works
  1. Yang-Zhang formula combines overnight return, intraday return, and Rogers-Satchell range term, weighted by k = 0.34 / (1.34 + (len + 1) / (len - 1)).
  2. Percentile rank of sigma_yz over a 100-bar history equals vol_pct.
  3. Regime classification: LOW below 25, NORMAL 25 to 65, ELEVATED 65 to 90, EXTREME above 90.
  4. HMA of sigma_yz equals the forecast. Forecast direction equals the sign of (forecast minus current).
  5. Position-size multiplier equals clamp(1.5 minus vol_pct / 100, 0.3, 1.5).
  6. Vol-of-vol (stdev of recent realized vol) feeds a regime stickiness indicator.


Reading the chart
  • In-pane: regime-tinted volatility line (vivid mint for LOW, neutral white for NORMAL, amber for ELEVATED, vivid red for EXTREME), HMA forecast line with direction-color flow, five vol-cone percentile lines.
  • Cross-pane: soft regime tint background on the price chart, plus a Size x0.50 EXTREME vol label updating each bar.
  • A vol-of-vol panel as a sub-strip at the top of the pane.
  • Five right-edge cone percentile labels (p5 / p25 / p50 / p75 / p95).
  • A current-vol percentile rank label.
  • Regime change timeline labels on the price chart at each regime transition.
  • Cross-pane vol-cone touch markers when vol crosses p95 (breakout) or p5 (contraction).
  • A regime stickiness indicator (how long the regime has been in its current state).
  • Forward expected-range lines on the price chart (close plus or minus forecast times ATR scalar).


Signals
  • Regime up / down (any percentile-bucket transition)
  • Extreme vol entry
  • Low vol entry
  • Vol breakout (sigma crosses above p95 of its own history)
  • Vol contract (sigma crosses below p5)
  • Vol Z-shock up / down (when vol z-score exceeds plus or minus 2)
  • Forecast cross up / down (forecast vs realized)

All gated on barstate.isconfirmed or barstate.ishistory. No future references. No lookahead_on.

Inputs
  • Volatility: Yang-Zhang window, regime percentile lookback, forecast HMA length.
  • Visual: bullish (low vol) color, bearish (extreme vol) color, elevated (amber) color, cone toggle, forecast toggle, cross-pane candles toggle, regime pulse toggle.
  • Dashboard: position, size.


How traders use this
  • Position sizing: scale entries inversely with the regime. Full size in LOW, default in NORMAL, half in ELEVATED, third in EXTREME. The multiplier label provides the suggested factor.
  • Volatility breakouts: vol crossing above p95 historically precedes large directional moves. Tighten trailing stops or reduce holding time.
  • Volatility contraction: vol crossing below p5 historically precedes range / chop. Reduce directional bias. Consider mean-reversion strategies.
  • Regime-aware stops: in ELEVATED or EXTREME regimes, ATR-based stops should be wider. In LOW regimes, tighter. The pos-mult label codifies this implicitly.


Limitations
  • Yang-Zhang assumes log-normal returns and lognormality breaks down during fat-tail events (it under-estimates vol in true crash regimes).
  • Percentile classification needs sufficient history. The default 100-bar lookback can be lengthened for stable instruments.
  • The position-size multiplier is a heuristic, not a portfolio-management recommendation. Combine with your own risk-management framework.
  • The HMA forecast lags slightly behind real-time changes. Treat as smoothed trend, not pinpoint prediction.


Compatibility
Pine Script v6 open-source indicator (pane plus cross-pane). Any symbol, any timeframe. Cross-pane elements use force_overlay=true. No request.security calls.

Defaults
20-bar Yang-Zhang window, 100-bar regime lookback, 5-bar HMA forecast, mint / red / amber palette, top-right medium dashboard.

Credits
  • Yang-Zhang estimator from D. Yang and Q. Zhang, Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices, Journal of Business (2000).

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.