Hi,

Here is an implementation of the Yang-Zhang volatility estimator. You can find the original derivation of the formula here: http://www.atmif.com/papers/range.pdf. The estimator is very effective to estimate the volatility based on bar data as it takes into account the close to open gap. The estimator has the advantage of being "unbiased in the continuous limit, (b) independent of the drift, (c) consistent in dealing with opening price jumps. Furthermore, it has the smallest variance among all estimators with similar properties. The improvement

of accuracy over the classical close-to-close estimator is dramatic for real-life time series" (YZ, 2000).

Some authors have show that, in the case of inverse volatility weighting of the position, using the YZ estimator for position sizing results in bigger profits because the turnover is reduced. If you compare the YZ volatility to the standard volatility estimator you will see that the YZ has less variation.

Hope it will be useful to some of you!

Best,

L

Author