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.
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?