In this article, we're going to evaluate the use of one of the most famous indicators in the trading landscape: the "Williams Percent Range," better known as “%R.”
Larry Williams developed Williams %R based on the Stochastic indicator. While the Stochastic indicator uses the difference between the closing price and the lowest lows of n periods, the difference between the closing price and the highest highs of n periods (where n=14 is considered the ideal value) is used to calculate the Williams %R. The %R then fluctuates on a scale from 0 to 100 (but in some cases, it is calculated on a negative scale from -100 to 0).
Several traders use the indicator to determine when the market is in an oversold or overbought condition and, of course, for trend reversals. The author sets the threshold for the overbought condition to a value of 80 (-20 in case of a negative scale) and the threshold for the oversold condition to a value of 20 (-80).
However, in the everyday use of the oscillator, many false signals occur. In this article, we'll investigate whether it's possible to optimize the Williams %R parameters for a highly diversified futures portfolio to use as the starter script for an automated strategy (trading system).
Figure 1
The strategy
The strategy we'll use is a traditional system based on a "mean-reverting" approach, namely, we'll exploit the two thresholds of the %R as the reversal point of the market. We'll wait until prices cross the oversold threshold (20) and then go long when the oscillator crosses this level again from the downside to the upside. Conversely, we'll go short after prices cross the overbought threshold (80) if the oscillator crosses that level again from the upside to the downside.
Since this is a "mean-reverting" strategy, it's advantageous to use a stop loss from the beginning, which can protect us to some extent from excessive capital losses. The stop loss is calculated as the average volatility of the last 5 bars divided by 1.5 (a value obtained through a preliminary optimization) so that the parameters obtained are as uniform as possible for all the underlying assets of the portfolio in question.
In this example, we're going to test the strategy on a time frame of 1440 (minutes), representing daily bars adjusted to the last market price, to see how the following futures would have behaved from 2010 to 2022:
- Crude Oil (CL)
- S&P500 (ES)
- Nasdaq (NQ)
- DAX (FDAX)
- Gold (GC)
- Live Cattle (LC)
- Feeder Cattle (FC)
- Soybeans (S)
- US Treasury Note 30 Yrs (US)
- Wheat (W)
- British Pound (BP)
- Bund (FGBL)
- Copper (HG)
- Heating Oil (HO)
- Natural Gas (NG)
- RBOB Gasoline (RB)
- EuroFX (EC)
In Figures 2 and 3, we can estimate the metrics obtained with the reversal strategy in terms of %R. The results are quite encouraging with a rising equity line, which is a good starting point, but we can see that this hasn't been consistent over the years either. For example, the significant drawdown from 2020 onwards shows that the strategy needs to be refined.
Figure 2
Figure 3
Looking at the results for the individual markets, we see that only 6 of 17 markets suffered losses.
A downer, however, is the average total trade, which only reaches $23. This isn't enough to make the system usable for live trading, as commission costs and slippage would completely consume it. It's, therefore, necessary to at least tweak the indicator's parameters to see if there's room for improvement.
Optimization
So, let's try to improve the average trade of the strategy by intervening in the indicator. Specifically, we'll optimize the overbought and oversold levels to see if the values suggested by the author (80 and 20) are the best values to look for trend reversal zones (since we've chosen a mean-reverting strategy).
From the optimization results shown in Figure 4, we see that the 25-85 combination consistently improves net profit ($371,483) and average trade (which exceeds $50) while reducing the maximum portfolio drawdown.
Figure 4
The system's equity has improved, but without further adjustments, the system still can't be said to be tradable.
When trying to enter a take profit, which is also calculated on the average volatility of the last 5 bars times a multiplicative factor, the best value for this factor is found by optimization at 1.5 (coincidentally the same as the stop loss).
Figure 5
At this point, the equity line is more constant (see Figure 5), the net profit rises to $40.7228 and the average trade to $57, while the max drawdown drops to more acceptable values, although still high for the strategy to be usable in live trading.
Conclusion
In summary, %R, optimized in its parameters for this specific portfolio and time frame, has shown that it can be a valuable tool for systematic trading. However, the strategy presented here needs further refinement. For example, the average trade value is still relatively low. However, the large number of trades would make it possible to use additional filters for the entries and try to eliminate the less profitable ones.
Generally, achieving a very high average trade value with such a diverse and diversified portfolio is still challenging. However, one could try to isolate trades only on days when a particular price pattern occurred, thus avoiding taking a position when the conditions are unfavorable for the trend reversal that the strategy seeks to achieve.
Finally, it should be noted that the %R value is excellent for identifying bullish and bearish divergences. A bearish divergence occurs when prices reach new highs while the oscillator indicates falling highs. Conversely, we see a bullish divergence when prices mark new lows while the oscillator shows rising lows. Tracking divergences could be another idea to work on to filter trades and improve the system.
I hope you have gained some interesting insights from the above. I recommend you always to be curious and open to testing new ideas.