# 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.

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$.
• 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
• 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$. – Alex C Jul 27 '18 at 10:05