hitRatio: Compute the hit ratio of single or the difference between two...

Description Usage Arguments Value Examples

View source: R/hitRatio.R

Description

This function allows you to calculate the percentage of observations greater than zero in the case of a single track record, x. It also allows you to pass a second track record. If the seconde track record is passed, then the function computes the periodic differences and returns the percentage of observations where the difference x-y is positive. In the two track record case, the return value becomes an outperformance frequency measure.

Usage

1
hitRatio(x, y = NULL)

Arguments

x

a series of observations from a given asset.

y

a second track record to compare to x. Default is NULL.

Value

the percentage of time x is greater than 0 or the percentage of time x-y is greater than zero.

Examples

1
2
3
4
5
dts <- seq(Sys.Date()-49, Sys.Date(), 1)
returns <- matrix(rnorm(100),ncol = 2) / 100
ret.xts <- xts(returns, dts)
hitRatio(ret.xts[,1])
hitRatio(x = ret.xts[,1], y = ret.xts[,2])

gtog/dMisc documentation built on May 17, 2019, 8:57 a.m.