Last Updated on March 16, 2021 by Oddmund Groette
The famous trader and tax rebellion Larry Williams has given names to several technical indicators. Last week we wrote about WilliamsVixFix:
This article explains how to calculate the Williams %R, how you can use it, and we backtest to see if the Williams %R works.
What is the Williams %R indicator?
The Willaims %R fluctuates between 0 to -100. It’s an oscillating indicator and reflects the current close relative to the highest high for the lookback period. The indicator is somewhat similar to the stochastic indicator, however, that one measures the close relative to the lowest low. A high reading is considered overbought, and low readings are considered oversold.
Here is how a 5-day lookback period looks in the S&P 500:
Williams %R goes quickly from overbought and oversold conditions. Thus, it is mainly used as a mean reversion indicator.
How do you calculate Williams %r indicator?
If you use a lookback period of five days the formula looks like this:
Williams %R = ( ( highest high last 5 days – close ) / ( highest high last 5 days – lowest low last 5 days) )* -100
For example: if the close today is 100, the highest high over the last five days was 115, and the lowest low over the last five days was 95, then the Williams %R is -75 ( (15/20) *-100 )
Williams %R resembles WilliamsVixFix
The Williams %R is pretty similar to the WilliamsVixFix (but inversely from each other). The chart below is both indicators using a 22-day lookback period:
Williams %R – does it work?
We test the Williams %R on the S&P 500. Entry is on the close when the Williams %R is below -90 and exit is when today’s close is higher than yesterday’s high or when the Williams %R closes above -30.
By using optimization we get, perhaps as expected, the best results on short lookback periods. We used a minimum lookback period of two days and a maximum of 25 days. All tests gave a profit factor of two or more, except for 25 days which produced 1.9.
The best result is by using a two-day lookback period. This gives this equity curve:
Both during the GFC in 2008/09 and the Covid-19, the strategy performed exceptionally well. The percentage return in 2008 and 2020 were 98.9% and 43.3%! The returns above are compounded. CAGR is 12.4% (buy and hold is 6.5%), exposure is 23%, the number of trades is 397, average gain per trade is 0.64%, max drawdown is 17%, and the profit factor is 2.36. These are pretty good numbers!
Does the Williams %R work for shorts?
Unfortunately, and as expected, it’s much more difficult to find profitable strategies on the short side.
Williams %R Amibroker code:
Using a 5-day lookback period the Amibroker code looks like this (including a plot of the indicator):
Williams %R = ( ( HHV(H,5) – Close ) / ( HHV(H,5) – LLV(L,5) ) ) * -100 ;
Plot(Williams %R,”Williams %R”,colorRed,styleLine);
Williams %R vs. RSI and stochastic
The Williams %R is a mean revertive indicator, just like the Relative Strength Indicator (RSI) and Stochastics. Let’s test the RSI by using “similar” criteria as we did above for the Williams %R:
- Enter on the close when the two-day RSI is below 10
- Exit on the close when the close is higher than yesterday’s high or when the RSI(2) ends higher than 70
These criteria yield this equity curve:
The Williams %R is pretty similar to the WilliamsVixFix. However, it seems like the Williams %R performs slightly better in our backtests. Moreover, on a wide range of backtests, Williams %R seems to perform better than both the RSI and Stochastics (stochastics not included in this article).
Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinion – they are not suggestions to buy or sell any securities.