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.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?