Williams R (Mean reversion)

Williams %R: buys when the oscillator climbs back out of the oversold -80 zone and sells when it pushes up through the overbought -20 level.

How It Works

  1. Compute Williams %R over 14 bars: 0 when the close equals the window's highest high, −100 when it equals the lowest low.
  2. Buy when %R climbs back above −80 — price was sitting in the bottom fifth of its recent range and has begun to lift out of it. Waiting for the crossing rather than buying at −80 avoids catching a market still falling.
  3. Sell when %R pushes up through −20, the top fifth of the range.

Worked example. With a 14-bar high of 110 and low of 90, a close at 93 gives %R = −85. The next bar closes at 96 for %R = −70, crossing back above −80, so the strategy buys. It exits when a close at 107 lifts %R to −15.

The Math Behind The Indicators

Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.

Williams %R
The same range-position idea as the stochastic, measured from the top and reported on a negative scale: 0 means the close sits at the highest high of the window, −100 at the lowest low. Readings below −80 mark the bottom fifth of the recent range, above −20 the top fifth.
\[\%R = -100 \cdot \dfrac{\max(H_N) - P_t}{\max(H_N) - \min(L_N)}\]
Example: With a 14-bar high of 110 and low of 90, a close at 94 gives %R = −100·(110 − 94)/(110 − 90) = −80 — right at the oversold edge. A close at 108 gives −10, deep in overbought territory.

Example Chart

Example Chart

Williams R (Mean reversion)

Real Data23/ 100Composite score

Metrics Per Trade

Metrics Per Trade

Real data · Williams R (Mean reversion)

Final Metrics

Final Metrics

Real data · Williams R (Mean reversion)

Scores

Scores

Real data · Williams R (Mean reversion)

Resampled Data25/ 100Composite score

Metrics Per Trade

Metrics Per Trade

Resampled data · Williams R (Mean reversion)

Final Metrics

Final Metrics

Resampled data · Williams R (Mean reversion)

Scores

Scores

Resampled data · Williams R (Mean reversion)