calc_hurst_ohlc | R Documentation |
Calculate the Hurst exponent from the volatility ratio of aggregated OHLC prices.
calc_hurst_ohlc(
ohlc,
step,
method = "yang_zhang",
closel = 0L,
scale = TRUE,
index = 0L
)
ohlc |
A time series or a matrix of OHLC prices. |
step |
The number of time periods in each interval between neighboring end points. |
method |
A character string representing the price range estimator for calculating the variance. The estimators include:
(The default is the |
closel |
A vector with the lagged close prices
of the OHLC time series. This is an optional argument. (The
default is |
scale |
Boolean argument: Should the returns be divided
by the time index, the number of seconds in each period? (The default is
|
index |
A vector with the time index of the time
series. This is an optional argument (the default is |
The function calc_hurst_ohlc()
calculates the Hurst exponent from the
ratios of the variances of aggregated OHLC prices.
The aggregated volatility \sigma_t
increases with the length of the
aggregation interval \Delta t
.
The aggregated volatility increases as the length of the aggregation
interval \Delta t
raised to the power of the Hurst exponent
H
:
\sigma_t = \sigma {\Delta t}^H
Where \sigma
is the daily return volatility.
The Hurst exponent H
is equal to the logarithm of the ratio
of the volatilities divided by the logarithm of the time interval
\Delta t
:
H = \frac{\log{\sigma_t} - \log{\sigma}}{\log{\Delta t}}
The function calc_hurst_ohlc()
calls the function
calc_var_ohlc_ag()
to calculate the aggregated variance
\sigma^2_t
.
The Hurst exponent calculated from the volatility ratio of aggregated OHLC prices.
## Not run:
# Calculate the log ohlc prices
ohlc <- log(rutils::etfenv$VTI)
# Calculate the Hurst exponent from 21 day aggregations
calc_hurst_ohlc(ohlc, step=21)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.