Learn R Programming

TTR (version 0.2)

volatility: Volatility

Description

Selected volatility estimators/indicators; various authors.

Usage

volatility(OHLC, n=10, calc="close", N=260, ...)

Arguments

OHLC
Object that is coercible to xts or matrix and contains Open-High-Low-Close prices.
n
Number of periods for the volatility estimate.
calc
The calculation (type) of estimator to use.
N
Number of periods per year.
...
Arguments to be passed to/from other methods.

Value

  • A object of the same class as OHLC or a vector (if try.xts fails) containing the chosen volatility estimator values.

Details

Close-to-Close Volatility (close): Historical volatility calculation using close-to-close prices. OHLC Volatility: Garman and Klass (garman.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. High-Low Volatility: Parkinson (parkinson): The Parkinson formula for estimating the historical volatility of an underlying based on high and low prices. OHLC Volatility: Rogers and Satchell (rogers.satchell): The Roger and Satchell historical volatility estimator allows for non-zero drift, but assumed no opening jump. OHLC Volatility: Garman and Klass - Yang and Zhang (gk.yz): This estimator is a modified version of the Garman and Klass estimator that allows for opening gaps. OHLC Volatility: Yang and Zhang (yang.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.

References

The following site(s) were used to code/document these indicators: Close-to-Close Volatility (close): http://www.sitmo.com/eq/172 OHLC Volatility: Garman Klass (garman.klass): http://www.sitmo.com/eq/402 High-Low Volatility: Parkinson (parkinson): http://www.sitmo.com/eq/173 OHLC Volatility: Rogers Satchell (rogers.satchell): http://www.sitmo.com/eq/414 OHLC Volatility: Garman Klass - Yang Zhang (gk.yz): http://www.sitmo.com/eq/409 OHLC Volatility: Yang Zhang (yang.zhang): http://www.sitmo.com/eq/417

See Also

See TR and chaikinVolatility for other volatility measures.

Examples

Run this code
data(ttrc)
  ohlc <- ttrc[,c("Open","High","Low","Close")]
  vClose <- volatility(ohlc, calc="close")
  vGK <- volatility(ohlc, calc="garman")
  vParkinson <- volatility(ohlc, calc="parkinson")
  vRS <- volatility(ohlc, calc="rogers")

Run the code above in your browser using DataLab