Trading Idea #028 – Williams %R Mean Reversion 1

I have built at least a dozen systems for forex trading, but none have passed our criteria for a tradable system. For this idea, I want to try to apply some of the mean-reversion techniques that I have used with success in other systems, namely SAT-002 and SAT-011. Both of those systems utilize RSI, but I wanted to try Williams %R, which is a similar oscillator. Williams %R was developed by legendary trader Larry Williams.

I chose forex because I believe it mean-reverts well. I have no proof of this, but only based on my observations of how price moves in waves.

Trends develop in the longer term, but the shorter and noisier periods show characteristics of Elliott waves. Earlier systems I have developed were breakout systems, but I was never able to find a profitable idea in the long term. I would like to see if the %R affords opportunities in a mean-reversion setup.

One challenge I expect if I make it to back-testing is that I will be working with/against a data set that has a lot of quantitative easing (QE) from central banks, in the wake of the 2008 global financial crisis (GFC) and later actions in 2020. This has proved to be exceptionally difficult in other systems I have developed.

Phase 1: Plan & Design

1. Trading Idea

The big idea is to use Williams %R to determine when we go into oversold or overbought territory:

  • 3-period %R for direction and exit; the three period is a little slower than 2-period, which I am hoping gives me better signals
  • 40-period simple moving average (SMA) as a trend filter;
    • Only go long if the Close price is above the SMA
    • Only go short if the Close price is below the SMA
  • When %R falls below 10, go long; exit when %R moves past 70
  • When %R moves above 90, go short; exit when %R moves past 30
  • Daily timeframe

In addition to this, I will attempt some position sizing, which I will describe later, depending upon how deep the %R goes into overbought or oversold.

Right now, it seems like a lot of rules. In trading system development, simpler is almost always better, so I may be setting myself up for failure. I hope we are not overloaded with rules.

2. System Definition

Indicators:

%R 3-period

%R behaves a lot like RSI, so I figured I would try it

Simple Moving Average – 40 period

40-period, which equates to 8 weeks or about 2 months

Input Parameters:

Input(Default)Data TypeOptimizable?Comments
Risk_Capital(2000)IntegerYesRisk_Capital
Leverage(50)IntegerYesMultiplier for risk capital

Variables:

VariableData TypeDefaultCalculation
Percent_RDouble0None: stores the calculated %R
SMADouble0None: stored the calculated 40 period simple moving average
NumSharesInteger1None: this is our position size
Extreme_MultiplierInteger1Used for position sizing and multiplied by NumShares; can be 1, 2, or 3, as described in the position sizing section below
Long_ExitDouble70The value of %R above which we exit a long position
Short_ExitDouble30The value of %R below which we exit a short position
MA_Trend_PeriodInteger40The number of periods in our SMA calculation
Percent_R_LengthInteger3The number of periods in our %R calculation

Initial Capital:

  • 6,000 per forex pair, denominated in the appropriate currency  
    • Exception: JPY/USD is 600,000, since the base currency is JPY (Japanese Yen)
    • I’m not going to get into currency conversion unless one of these ideas passes; forex is confusing enough as-is.

Leverage:

  • 50:1

Position Sizing:

I want to add position sizing to my entries. My idea is that the deeper we are in overbought or oversold, the higher that chance that we will have a reversion to the mean. Here is how I will do it:

Position SizeShort (%R)Long (%R)
100k lot90 – 93.36.68 – 10
200k lot93.4 – 96.73.34 – 6.67
300k lot96.8 – 1000 – 3.33

Entry:

  • Long:
    • %R <= 10 and
    • SMA < Close
  • Short:
    • %R >= 90 and
    • SMA > Close

Exit(s):

The exit used for this system is similar to the one used in our Trading Idea #11, Connors RSI 2.

  • Long:
    • If %R >= 70, exit next bar
  • Short:
    • If %R <= 30, exit next bar

Stop Loss:

  • No stop loss
    • I might regret this

Profit Target:

  • None

Challenges: None. This should be easy to code

3. Performance Objectives

The system will meet the following objectives:

ObjectiveGoal
System Type (trend, mean-reversion, day, swing, etc.)Mean-reversion
Risk of Ruin0%
Profit Factor>= 1.5
Adjusted Profit Factor> 1.0
Win Percent> 60%
Max Drawdown %< 35%
Profit/Drawdown Ratio> 2.0
Ready Date2022/02/15

I expect a high win rate for a mean reversion system. I will continue to use Adjusted Profit Factor (worst case Profit Factor) as a criteria for passing the system.

This idea is S.M.A.R.T.: Specific, Measurable, Achievable, Realistic, Time-bound

4. Market Selection

Markets:

EnergiesCurrenciesFixed IncomeAgricultureMetalsSoftsIndexesEquities
X

Instruments:

Market SectorInstrumentSymbolComments
Currencies (Forex)EUR/USD
JPY/USD
NZD/CHF
AUD/NZD
SameI am guessing this idea would work on currency futures, as spot forex tracks very close to futures in my experience.

I chose these systems based on analysis done by Stefan Friedrichowski, which he shared on episode #178 of Better System Trader (see Sources/References for a link). He performed tick-level analysis on forex pairs and came up with forex pairs that mean-revert more often than others, as demonstrated in this chart:

I picked two from the left side (mean reverts more often) and two from the right side (mean reverts infrequently). The methodology is data intensive, but I will leverage this research and see if it is useful.

Chart Type, Timeframe, Session, Time Zone:

AttributeValueComments
Chart TypeRegular CandlestickCharting is only useful for validating entry and exit signals
Timeframe / Interval(s)Daily 
SessionRegular 
Time ZoneExchange 

Phase 2: Build

5. Manual Test

Pass. It looked okay on EUR/USD pair in this period, as shown in this equity curve:

6. Build

Process Diagram

Comments:

Unlike earlier systems presented on this site, this is the first to use position sizing.

7. Unit Test

It took several rounds of testing to get this working properly. Here are some trades on a chart:

Complete?

Phase 3: Test

8. Optimization

We are not optimizing parameters for this system. We have a lot of variables we could consider, but I want to try with no optimization.

9. Walk-Forward Analysis

I used data from January 1, 2010, through December 31, 2020. Everything failed.  Here is a subset of the metrics for these forex pairs:

JPY/USD almost passed but was just below the 60% win rate.

I included the average bars per win and per loss to illustrate a couple points. The first point is that in mean-reversion systems, at least in my experience, if a trade does not go your way within 3-4 bars, it is probably a losing trade. That was anecdotal evidence, so I looked at the data for this system to support my hypothesis. You can easily see that the longer we are in a trade, the more likely it is to fail. A consideration for future mean-reversion systems would be to exit after n-bars have passed. 5 seems to be a good number. 

The second point is simply the trading adage: cut your losses and let your winners run. Mean-reversion is a wicked mistress/master, in that your first day or two can be….uncomfortable. You may get in one bar too early and must wait one more bar for the turn. Sometimes the turn never comes. When do you cut your losses? Again, if something runs past 5 bars, it is probably a loser. As a parent might say, nothing good happens after 2 am (or 5 bars).

I am tempted to advance JPY/USD, but Profit Factor, Adjusted Profit Factor, and Win % are all very weak. At this point, you can skip to the Notes and Commentary section.

10. Monte Carlo Simulation

We did not make it this far.

11. Incubation

We did not make it this far.

Phase 4: Deploy

12. Production / Portfolio Assignment

We did not make it this far.

Trading System Result: FAIL

Notes and Commentary

It has been just over one year since I published our first system, and what a ride it has been! Most blogs fail within the first 6 months of existence, and this one nearly did, but I am stubborn and persistent, so we continue our trading system adventure. 

Firstly, let me get this point addressed: Why should I bother to build a system that I cannot, as of this writing, trade? I am a ‘connected person’, which means I am close with someone in the financial industry and am not allowed to trade forex. I do it for:

  • You
  • The site
  • The challenge
  • The exercise
  • And so that I have a forex system ready to go if the opportunity arises

This idea was not bad. I tried two forex pairs in two different time periods, and it looked like a plausible idea (5. Manual Test). I do not know if Williams %R is the right tool for the job. Maybe RSI is the right tool, and I should work with what I know. My grandfather always stated, “there is a right tool for every job”. I have bent or broken my fair share of kitchen knives in want of a screwdriver, but I digress.

There are a couple things I really liked:

  • Position Sizing: doing some sampling of this system with and without my position sizing methodology, the system had better results (Profit Factor, et.al) with it than without it.
  • Trend Filter: I was afraid a 40 day moving average was too fast as a trend filter. When I played around with any other value, the results were almost always worse. Who knew?

There is one thing I did not like. I expected EUR/USD and JPY/USD to be poor in mean-reversion, based on Stefan Friedrichowski’s analysis, but I found the opposite to be true. I purposely chose these two because I wanted to see if they would fail.  That does not make his analysis wrong, particularly since he performed his analysis on tick-based charts. My expectation was that the mean-reversion attributes would apply at the daily level, given the belief that market data is fractal, i.e., we are measuring the same thing, just with different resolution or granularity. I have found his findings to be accurate on other timeframes, so I am puzzled. This is something I would like to study in greater details. Regardless of this outcome, I highly recommend the YouTube video referenced in the Sources/References section.

Continuous Improvement Department:

There are dozens of ideas that can sprout from this, but I will focus on a few:

  1. Try other timeframes; weekly looked like it had promise on EUR/USD
  2. Optimize some parameters:
    1. %R thresholds for entry or exit
    1. Number of periods for %R (2 and 3)
  3. Try RSI or RSI variants, such as the RSIH featured in the last trading idea
  4. Exit after n-trades if in a losing position
  5. Exit if the trend changes direction
  6. Use a volatility measure
  7. Add a stop loss

#4 is my favorite of these new ideas. As you can see, I could create a year’s worth of system ideas just with what I have here.

Next Trading System Idea: I have not decided yet, but I think I will focus on another forex system. Forex February it is!  

As always, thank you for reading. If you find this useful, share this post, subscribe to our twice-monthly newsletter, and check out some of our other systems.

Do you have a trading idea that you want me to put through our process to see if it would make a valid trading system?  Leave a comment below and we can discuss.

Sources/References

Did you like what you read? Do you want to see more?  Subscribe now and receive our email twice per month, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

Did you like what you read? Do you want to see more?  Subscribe now and receive our email twice per month, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

Leave a Reply

Your email address will not be published.