Firedrops

Garman-Klass-Yang-Zhang Volatility Estimator

The Garman-Klass-Yang-Zhang Volatility Estimator (GKYZVE) is yet another attempt to robustly measure volatility, integrating intra-candle and inter-candle dynamics. It is an extension of the Garman-Klass Volatility Estimator (GKVE) incorporating insights from the Yang-Zhang Volatility Estimator (YZVE). Like the YZVE, the GKYZVE holistically considers open, high, low, and close prices. The formula for GKYZ is:

GKYZVE = 0.5 * σ_HL² + * σ_CC² + σ_OC²

Where:
  • σ_HL² is the variance based on the high and low prices (σ_HL² = (high - low)² / (4 * math.log(2))), weighted at 0.5.
  • σ_CC² is the close-to-close variance (σ_CC² = (close - close)²), weighted at (2 ln 2) -1 for the logarithmic distribution of returns and emphasizing the impact of day-to-day price changes.
  • σ_OC² is the variance of the opening price against the closing price (σ_OC² = 0.5 * (open - close)²), weighted at 1.

The GKYZVE differs from the YZVE by using fixed weighing factors derived from theoretical calculations, leaning heavier into the assumption that returns are log-distributed.

This script also offers a choice for normalization between 0 and 1, turning the estimator into an oscillator for comparing current volatility to recent levels. Horizontal lines at user-defined levels are also available for clearer visualization. Both options are off by default.

References:

Garman, M. B., & Klass, M. J. (1980). On the estimation of security price volatilities from historical data. The Journal of Business, 53(1), 67-78.
Yang, D., & Zhang, Q. (2000). Drift-independent volatility estimation based on high, low, open, and close prices. The Journal of Business, 73(3), 477-492.
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?