Williams %R
Calculate the Williams Percent R (Williams %R) for a given price series.
The Williams %R is a momentum indicator that measures the level of the close price relative to the high-low range over a certain number of periods.
The formula is as follows:
\[\text{Williams} \%R = (\text{Highest High} - \text{Close}) / (\text{Highest High} - \text{Lowest Low}) \cdot - 100\]Also known as: Williams percent R, overbought oversold oscillator.
Williams %R in Python
get_williams_percent_r is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_williams_percent_r as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_williams_percent_r()
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2026-06-18 | -64.5903 | -93.4222 | -36.128 |
| 2026-06-22 | -67.9214 | -99.6876 | -42.3433 |
| 2026-06-23 | -76.9487 | -90.6301 | -69.6493 |
| 2026-06-24 | -81.0127 | -99.0472 | -70.1848 |
| 2026-06-25 | -96.7927 | -95.4778 | -65.6498 |
| 2026-06-26 | -77.0218 | -65.0235 | -69.0524 |
| 2026-06-29 | -72.1311 | -69.1462 | -39.1022 |
| 2026-06-30 | -45.5528 | -57.3424 | -24.7132 |
| 2026-07-01 | -28.0433 | -33.2445 | -27.2319 |
| 2026-07-02 | -2.2147 | -21.4272 | -29.6758 |
Parameters
get_williams_percent_r accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The name of the column containing the close prices. Defaults to “Adj Close”.
- window (int, optional): The number of periods for calculating the Williams %R. Defaults to 14.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the indicator values. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.