Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

WPR

William's %R


Description

William's % R.

Usage

WPR(HLC, n = 14)

Arguments

HLC

Object that is coercible to xts or matrix and contains High-Low-Close prices. If only a univariate series is given, it will be used. See details.

n

Number of periods to use.

Details

If an High-Low-Close series is provided, the indicator is calculated using the high/low values. If a vector is provided, the calculation only uses that series.

Value

A object of the same class as HLC or a vector (if try.xts fails) containing the William's %R values.

Note

The William's %R calculation is similar to stochastics' fast %K.

The value for William's %R will be 0.5 whenever the highest high and lowest low are the same over the last n periods.

Author(s)

Joshua Ulrich

References

See Also

See stoch.

Examples

data(ttrc)
stochOsc <- stoch(ttrc[,c("High","Low","Close")])
stochWPR<- WPR(ttrc[,c("High","Low","Close")])

plot(tail(stochOsc[,"fastK"], 100), type="l",
    main="Fast %K and Williams %R", ylab="",
    ylim=range(cbind(stochOsc, stochWPR), na.rm=TRUE) )
lines(tail(stochWPR, 100), col="blue")
lines(tail(1-stochWPR, 100), col="red", lty="dashed")

TTR

Technical Trading Rules

v0.24.2
GPL (>= 2)
Authors
Joshua Ulrich
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.