Financial Time Series Toolbox | ![]() ![]() |
William's %R
William's %R is an indicator that measures overbought and oversold levels. The function willpctr
is from the stochastics category. All the technical analysis functions can accept a different name for a required data series. If, for example, a function needs the high, low, and closing price series but your time series object does not have the data series names exactly as High
, Low
, and Close
, you can specify the correct names as follows.
The function willpctr
now assumes that your high price series is named Hi
, low price series is named Lo
, and closing price series is named Closing
.
Since the time series object part_ibm
has its data series names identical to the required names, name adjustments are not needed. The input argument to the function is only the name of the time series object itself.
Calculate and plot the William's %R indicator for IBM along with the price range using these commands:
wpctr_ibm = willpctr(part_ibm); subplot(2, 1, 1); plot(wpctr_ibm); title('William''s %R of IBM stock, 10/01/95-12/31/95'); datetick('x', 'mm/dd/yy'); hold on; plot(wpctr_ibm.dates, -80*ones(1, length(wpctr_ibm)),... 'color', [0.5 0 0], 'linewidth', 2) plot(wpctr_ibm.dates, -20*ones(1, length(wpctr_ibm)),... 'color', [0 0.5 0], 'linewidth', 2) subplot(2, 1, 2); highlow(part_ibm); title('IBM Stock Prices, 10/01/95-12/31/95'); datetick('x', 'mm/dd/yy');
Figure 3-2, William's %R and IBM Stock Prices shows the results. The top plot has the William's %R line plus two lines at -20% and -80%. The bottom plot is the High-Low plot of the IBM stock price for the corresponding time period.
Figure 3-2: William's %R and IBM Stock Prices
![]() | Moving Average Convergence/Divergence (MACD) | Relative Strength Index (RSI) | ![]() |