roll_hurst: Calculate a time series of _Hurst_ exponents over a rolling...

View source: R/HighFreq.R

roll_hurstR Documentation

Calculate a time series of Hurst exponents over a rolling look-back interval.

Description

Calculate a time series of Hurst exponents over a rolling look-back interval.

Usage

roll_hurst(ohlc, look_back = 11)

Arguments

ohlc

An OHLC time series of prices in xts format.

look_back

The size of the look-back interval, equal to the number of rows of data used for aggregating the OHLC prices.

Details

The function roll_hurst() calculates a time series of Hurst exponents from OHLC prices, over a rolling look-back interval.

The Hurst exponent is defined as the logarithm of the ratio of the price range, divided by the standard deviation of returns, and divided by the logarithm of the interval length.

The function roll_hurst() doesn't use the same definition as the rescaled range definition of the Hurst exponent. First, because the price range is calculated using High and Low prices, which produces bigger range values, and higher Hurst exponent estimates. Second, because the Hurst exponent is estimated using a single aggregation interval, instead of multiple intervals in the rescaled range definition.

The rationale for using a different definition of the Hurst exponent is that it's designed to be a technical indicator for use as input into trading models, rather than an estimator for statistical analysis.

Value

An xts time series with a single column and the same number of rows as the argument ohlc.

Examples

# Calculate rolling Hurst for SPY in March 2009
hurst_rolling <- roll_hurst(ohlc=HighFreq::SPY["2009-03"], look_back=11)
chart_Series(hurst_rolling["2009-03-10/2009-03-12"], name="SPY hurst_rolling")


algoquant/HighFreq documentation built on Feb. 9, 2024, 8:15 p.m.