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 or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_williams_percent_r as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
tickers=["EURUSD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.technicals.get_williams_percent_r().tail(5)
Or, after setting up the Finance Toolkit MCP, ask:
How did the Williams %R of the euro against the dollar move between overbought and oversold from 26 to 31 December 2025?
Which returns:
| Date | EURUSD | Benchmark |
|---|---|---|
| 2025-12-26 | -16.5329 | -6.0156 |
| 2025-12-28 | -18.4956 | -11.4945 |
| 2025-12-29 | -18.4956 | -16.9733 |
| 2025-12-30 | -78.0427 | -20.7008 |
| 2025-12-31 | -78.0427 | -43.3797 |
Parameters
get_williams_percent_r accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”. | "weekly" |
close_column | str | The name of the column containing the close prices. Defaults to “Adj Close”, in which case the open, high and low prices are adjusted for dividends in the same way. | "Close" |
window | int | The number of periods for calculating the Williams %R. Defaults to 14. | 20 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the indicator values. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |