Scaling Yang–Zhang Volatility for Hourly Data
Summary
The answer explains how to set the time units when calculating Yang–Zhang volatility from hourly foreign-exchange prices. It distinguishes the basic time unit, which is the spacing between observed closing prices, from the result time unit, which is the period in which the final volatility is expressed. With hourly observations, the basic unit is one hour; an annual result therefore requires the number of hourly intervals in a year for the chosen market calendar.
The lookback count n represents the number of observed basic intervals included in the calculation, so a window described in trading days must be converted into hourly observations. The annualization factor Z is the number of basic intervals in the desired result period. The answer clarifies why using a daily factor with hourly observations changes the scale, but the excerpt does not resolve the correct trading-hours convention for Forex or validate the implementation. Annualization should match the instrument’s trading calendar and the formula’s definitions.
Key ideas
- The basic time unit is the interval between observed closing prices, which is one hour for hourly data.
- The result time unit is the period in which volatility is reported, such as one year.
- The lookback n counts observations in basic time units, so a day-based window must be converted to hourly observations.
- The annualization factor Z counts basic intervals per result period and must use a consistent market calendar.
Tags
Full text
# Choosing the Correct Periods for Yang-Zhang Volatility
# 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.
## Answer by Alex C (score 1, accepted)
https://quant.stackexchange.com/a/40964
Let's talk about time units.
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$.
HTHShown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.