Selected volatility estimators/indicators; various authors.
Object that is coercible to xts or matrix and
contains Open-High-Low-Close prices (or only Close
Number of periods for the volatility estimate.
The calculation (type) of estimator to use.
Number of periods per year.
Arguments to be passed to/from other methods.
sqrt(N) * runSD(ROC(Cl), n-1)
OHLC Volatility: Garman and Klass
The Garman and Klass estimator for estimating historical volatility assumes Brownian motion with zero drift and no opening jumps (i.e. the opening = close of the previous period). This estimator is 7.4 times more efficient than the close-to-close estimator.
sqrt(N/n * runSum(0.5 * log(Hi/Lo)^2 - (2*log(2)-1) * log(Cl/Op)^2, n))
High-Low Volatility: Parkinson
The Parkinson formula for estimating the historical volatility of an underlying based on high and low prices.
sqrt(N/(4*n*log(2)) * runSum(log(Hi/Lo)^2, n))
OHLC Volatility: Rogers and Satchell
The Roger and Satchell historical volatility estimator allows for non-zero drift, but assumed no opening jump.
sqrt(N/n * runSum(log(Hi/Cl) * log(Hi/Op) + log(Lo/Cl) * log(Lo/Op), n))
OHLC Volatility: Garman and Klass - Yang and Zhang
This estimator is a modified version of the Garman and Klass estimator that allows for opening gaps.
sqrt(N/n * runSum(log(Op/lag(Cl,1))^2 + 0.5 * log(Hi/Lo)^2 - (2*log(2)-1) * log(Cl/Op)^2 , n))
OHLC Volatility: Yang and Zhang
The Yang and Zhang historical volatility estimator has minimum estimation error, and is independent of drift and opening gaps. It can be interpreted as a weighted average of the Rogers and Satchell estimator, the close-open volatility, and the open-close volatility.
Users may override the default values of α
(1.34 by default) or k used in the calculation by
k will cause
to be ignored, if both are provided.
s <- sqrt(s2o + k*s2c + (1-k)*(s2rs^2))
s2o <- N * runVar(log(Op/lag(Cl,1)), n=n)
s2c <- N * runVar(log(Cl/Op), n=n)
s2rs <- volatility(OHLC, n, "rogers.satchell", N, ...)
k <- (alpha-1) / (alpha + (n+1)/(n-1))
A object of the same class as
OHLC or a vector (if
try.xts fails) containing the chosen volatility
The following sites were used to code/document these
indicators. All were created by Thijs van den Berg under
the GNU Free Documentation License and were retrieved on
2008-04-20. The links are currently dead, but can be
accessed via internet archives.
Close-to-Close Volatility (
OHLC Volatility: Garman Klass (
High-Low Volatility: Parkinson (
OHLC Volatility: Rogers Satchell (
OHLC Volatility: Garman Klass - Yang Zhang (
OHLC Volatility: Yang Zhang (
for other volatility measures.
1 2 3 4 5 6