# Choosing the Correct Periods for Yang-Zhang Volatility

I am implementing the formula for YZ Volatility using this link.

I am testing it on hourly Forex charts and I'm getting some strange numbers. Taking the 14 day YZ volatility using Z as 252 * 24 (for hourly) I get numbers like 0.280535. Backing it off to 252 I get numbers like 0.0280535. In reality, it should be near the naive standard deviation 0.002x....

I'd like to confirm my assumptions on the periods are correct.

In the paper Z is described as the number of closing prices in a year. For daily data, I would assume this would be 252. Since I am doing this on hourly data my assumption is that this would be 252 * 24. Is this correct? The strangest thing is that the volatility seems correct, except for the fact it's two decimal points too far to the left.

The "result time unit" is the time in which you want the final result to be expressed. For example if you want "yearly volatility" or volatility per year then the RTU is "1 year"

The "basic time unit" is the time between successive closing prices that you observe. For Yang the BTU is one day, but for you (since you have decided to use hourly data) the BTU is "1 hour".

Now the numbers $n$ and $Z$. $n$ is the number of values in the summation ($\sum_{i=1}^n$), it is also the number of basic time intervals you have observed. For example if you are looking at the last 14 trading days using hourly prices then $n=14*24$. $Z$ is the number of BTUs in one RTU. So for computing yearly volatility from hourly data $Z=252*24$.

HTH

• The logic here makes sense to me. Reimplementing using web.archive.org/web/20090106023143/http://sitmo.com/eq/417.pdf I find that using n = 14 * 24 and Z = 252 * 24 results in numbers like .12xxx, which are way far off. I'm taking the sqrt of the variance function defined in the PDF. I can post my code if it would help?
– lolo
Jul 27 '18 at 4:23
• The yearly volatility of currencies that I have looked at have been about 8% or 10%, that is 0.08 to 0.10. So 0.12 is a little high but it does not seem that far off. Jul 27 '18 at 4:27
• oh, so this is yearly then. So I would need to get this into hourly by dividing the result by some factor then? That would get me closer to the naive standard deviation of the hourly chart (which would be in pips deviation from the mean). Would I divide by sqrt(252 * 24)?
– lolo
Jul 27 '18 at 4:31
• Yes. If you want hourly volatility and you work with hourly data then this whole issue of unit conversion does not apply and the $\frac{Z}{n}$ factor under the square root simply disappears from the formula, or if you prefer is replaced by $1$. Jul 27 '18 at 10:05