ohlc_sharpe: Calculate time series of point Sharpe-like statistics for...

View source: R/HighFreq.R

ohlc_sharpeR Documentation

Calculate time series of point Sharpe-like statistics for each row of a OHLC time series.

Description

Calculate time series of point Sharpe-like statistics for each row of a OHLC time series.

Usage

ohlc_sharpe(ohlc, method = "close")

Arguments

ohlc

An OHLC time series of prices in xts format.

method

A character string representing method for estimating the Sharpe-like exponent.

Details

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.

Value

An xts time series with the same number of rows as the argument ohlc.

Examples

# Calculate time series of running Sharpe ratios for SPY
sharpe_running <- ohlc_sharpe(HighFreq::SPY)


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