Learn R Programming

TTR (version 0.23-4)

runPercentRank: Percent Rank over a Moving Window

Description

This function computes a running/rolling percentage rank.

Usage

runPercentRank(x, n = 260, cumulative = FALSE, exact.multiplier = 0.5)

Arguments

x

Object coercible to xts or matrix.

n

Number of periods to use in the window or, if cumulative=TRUE, the number of observations to use before the first result is returned. Must be between 1 and nrow(x), inclusive.

cumulative

Logical, use from-inception calculation?

exact.multiplier

The weight applied to identical values in the window. Must be between 0 and 1, inclusive. See details.

Value

A object of percent ranks over a n-period moving window of the same class as x and y or a vector (if try.xts fails).

Details

The computation for a percentage rank can vary depending on the weight given to values in the window identical to the value being ranked. This weight can be set using the exact.multiplier argument which defaults to 0.5.

References

The following site(s) were used to code/document this indicator: http://en.wikipedia.org/wiki/Percentile_rank