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 อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?