Main Content

willpctr

Description

PercentR = willpctr(Data) calculates the Williams PercentR (%R) values for a data series of with high, low, and closing prices.

example

PercentR = willpctr(___,Name,Value) adds optional name-value pair arguments.

example

Examples

collapse all

Load the file SimulatedStock.mat, which provides a timetable (TMW) for financial data for TMW stock.

load SimulatedStock.mat
PercentR = willpctr(TMW);
plot(PercentR.Time,PercentR.WillPercentR)
title('Williams %R for TMW')

Figure contains an axes object. The axes object with title Williams %R for TMW contains an object of type line.

Input Arguments

collapse all

Data with high, low, open, close information, specified as a matrix, table, or timetable. For matrix input, Data is an M-by-3 with high, low, and closing prices stored in the corresponding columns. Timetables and tables with M rows must contain variables named 'High', 'Low', and 'Close' (case insensitive).

Data Types: double | table | timetable

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: PercentR = willpctr(TMW,'NumPeriods',15)

Moving window for Williams PercentR, specified as the comma-separated pair consisting of 'NumPeriods' and a scalar positive integer.

Data Types: double

Output Arguments

collapse all

Williams PercentR series, returned with the same number of rows (M) and the same type (matrix, table, or timetable) as the input Data.

More About

collapse all

Williams %R

Williams %R shows the current closing price in relation to the high and low of the past n days.

By default, Williams %R values are based on 14 periods.

References

[1] Achelis, S. B. Technical Analysis from A to Z. Second Edition. McGraw-Hill, 1995, pp. 316–317.

Version History

Introduced before R2006a

expand all