ohlc_sharpe | R Documentation |
Calculate time series of point Sharpe-like statistics for each row of a OHLC time series.
ohlc_sharpe(ohlc, method = "close")
ohlc |
An OHLC time series of prices in xts format. |
method |
A character string representing method for estimating the Sharpe-like exponent. |
The function ohlc_sharpe()
calculates Sharpe-like statistics
for each row of a OHLC time series.
The Sharpe-like statistic is defined as the ratio of the difference between
Close minus Open prices divided by the difference between
High minus Low prices.
This statistic may also be interpreted as something like a Hurst
exponent for a single row of data.
The motivation for the Sharpe-like statistic is the notion that if prices
are trending in the same direction inside a given time bar of data, then
this statistic is close to either 1 or -1.
An xts time series with the same number of rows as the
argument ohlc
.
# Calculate time series of running Sharpe ratios for SPY
sharpe_running <- ohlc_sharpe(HighFreq::SPY)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.