Yang & Zheng Extension of Garman & Klass

First off, a huge thank you to the following people:


This is the Yang & Zhang extension of Garman & Klass. The equation was modified to include the logarithm of the open price divided by the preceding close price. As a result, this function uses the open, high, low and close prices to estimate volatility. This modification allows the volatility estimator to account for the opening jumps, but as the original function, it assumes that the underlying follows a Brownian motion with zero drift (the historical mean return should be equal to zero). This estimator tends to overestimate the volatility when the drift is different from zero, however, for a zero drift motion, this estimator has an efficiency of eight times the classic close-to-close estimator (standard deviation).

This script allows you to transform the volatility reading. The intention of this is to be able to compare volatility across different assets and timeframes. Having a relative reading of volatility also allows you to better gauge volatility within the context of current market conditions.

For the signal lie I chose a repulsion moving average to remove choppy crossovers of the estimator and the signal. This may have been a mistake, so in the near-future I might update so that the MA can be selected. Let me know if you have any opinions either way.


Want to Learn?

If you'd like the opportunity to learn Pine but you have difficulty finding resources to guide you, take a look at this rudimentary list:

The list will be updated in the future as more people share the resources that have helped, or continue to help, them. Follow me on Twitter to keep up-to-date with the growing list of resources.

Suggestions or Questions?

Don't even kinda hesitate to forward them to me. My (metaphorical) door is always open.


TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。