Learn R Programming

TTR (version 0.13-1)

WPR: William's % R

Description

William's % R.

Usage

WPR(HLC, n=14)

Arguments

HLC
High-Low-Close price series to use. If only a univariate series is given, it will be used. See details.
n
Number of periods to use.

Value

  • A vector containing the William's %R values.

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.

References

The following site(s) were used to code/document this indicator: http://www.fmlabs.com/reference/WilliamsR.htm http://www.equis.com/Customer/Resources/TAAZ?c=3&p=126 http://linnsoft.com/tour/techind/willR.htm http://stockcharts.com/education/IndicatorAnalysis/indic_williamsR.html

See Also

See stochastic.

Examples

Run this code
data(ttrc)
  stoch.osc <- stochastic(ttrc[,c("High","Low","Close")])
  stoch.wpr <- WPR(ttrc[,c("High","Low","Close")])

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

Run the code above in your browser using DataLab