### How to calculate historical intraday volatility?

• Sorry for what must be a beginner question, but when I went to write code I realized I didn't understand exactly how historical volatility, or statistical volatility, is defined. Wikipedia tells me "volatility is the standard deviation of the instrument's logarithmic returns", and logarithmic return is defined as $\ln\left(\frac{V_f}{V_i}\right)$, where $V_f$ is closing price and $V_i$ is opening price.

If I want to calculate the volatility of a minute bar, from the raw ticks, do I just use the first and last tick in that minute? If I use first and last ticks in the minute (i.e. bar open/close), I will have a single logarithmic return, so s.d. of that one value will be 0. In an answer to this question, the intraday volatility chart is described as U-shaped. Exactly what sums do I need to do to generate that intraday volatility chart from the day's ticks?

In R terms, is logarithmic return:

#x is xts object containing ticks
r = na.omit( lag(x)/x )
lnr = log(r)


Background: I have a stream of ticks, and as I turn them into minute (and higher period) bars (using R's xts module) I also calculate the mean and s.d. Is the standard financial measure of volatility different from standard deviation? If not, can one be derived from the other?

If the above definition of volatility is correct, my answer (based on eyeballing the plots, and on running cor) seems to be that they are really quite different; I'm still chewing over how that gels with the answers here.

@TalFishman Thanks for the edits Tal; I also moved my comment over to your answer.

I am also very intersted in the Intraday vola calculator for gamma scalping purposes, can you please share it? Thanks Martin

9 years ago

The expression you have is fine. But more generally, for the intraday volatility, I don't think there "the correct definition". More like, whatever works in the given context. I found the following notes by Almgren pretty useful:

http://cims.nyu.edu/~almgren/timeseries/notes7.pdf

Thanks @LazyCat Knowing that all the sources I've seen are being _deliberately_ vague on implementation details, not just being _brief_, was the thing I needed to know. My eyes glazed over on parts of that PDF, but the comment at the top of p.10 (people generally use "ad hoc" sampling) and the suggestion at the end to compute across a range of parameters and not trust a result that varies a lot, was very helpful.