Williams %R(10) oversold buy above 200-day average
Williams %R: buy when %R(10) is below -90 and the stock is above its 200-day average; sell when %R goes above -20.
Survivorship mirage
It clears the bar on today's winners, the stocks everyone wishes they had bought, but not on the laggards, which is where hindsight can't help.
- It clears the bar on today's winners but not on the laggards: the winners' own rise did the work.
42 large US stocks, 15 years
Before costs +0.055R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards the idea averaged −0.024R per trade after costs over 2606 trades, while on today's winners it averaged 0.077. Bull markets were negative at −0.048R, flat markets reached 0.079 and bear markets 0.001. The winners' gain did not carry over to the laggards, which is why the verdict is a survivorship mirage.
How it was tested
Buy at the close when Williams %R(10) is below -90 while the close is above its 200-day simple moving average, and exit at the first close where %R(10) is above -20.
- Side
- Long
- Its own exit
- At each close after entry, exit at that close if Williams %R(10) is above -20., checked at each close
- Time limit
- Exit at the close after 30 trading days, unless the stop, the target or its own exit comes first
- Bar to clear
- t > 2.01, by trade and by day, sized to a first try (one idea, tested once)
- Prices
- 15 years of daily bars through 2026-11-20; judged 2026-11-22
- Williams %R uses the standard formula over 10 daily bars including the signal day
- 200-day average is a simple moving average of closes
- Entry at the signal day's close
- Protective stop of 3 x ATR(14) and target of 6 x ATR(14) were chosen because the idea names none; the %R exit is the intended exit
- Time limit set to the 30-day maximum since the idea names none
- Signal is the %R level condition on the day, not a fresh cross, and a new trade is only taken when flat
The evidence
The laggards decide: 22 large stocks that lagged or fell, where hindsight can't flatter a rule. Today's winners sit beside them to show what survivorship would add.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 2,023 | −0.048R | −2.87 | −3.75 · 1,079d | −0.051R · beats 70% | +0.087R |
| Flat | 431 | +0.079R | 2.14 | 1.52 · 207d | −0.033R · beats 100% | +0.092R |
| Bear | 152 | +0.001R | 0.01 | −0.14 · 78d | −0.021R · beats 65% | −0.118R |
| All | 2,606 | −0.024R | −0.046R | +0.077R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 15.0 bps) plus 0.045R for the fills a real order wouldn't get. “By day” groups trades opened the same day, so a rule that fires on the same dates for every stock counts as a few events. “Random dates” places the same plan on random days of the same stocks in the same kind of market, 20 times; the idea must beat 95% of those draws.
The scanner we wroteShow the codeHide
from decimal import Decimal
from core.domain import Bar
from strategies.indicators import atr, sma
from scanners.base import Candidate
class WilliamsROversoldAbove200DmaLong:
name = "williams_r_oversold_above_200dma_long"
description = "Long when Williams %R(10) < -90 and close above 200-day SMA; exit when %R(10) > -20."
def __init__(self, wr_period: int = 10, wr_entry: float = -90.0, wr_exit: float = -20.0,
sma_period: int = 200, atr_period: int = 14,
stop_mult: float = 3.0, target_mult: float = 6.0) -> None:
self._wr_period = wr_period
self._wr_entry = wr_entry
self._wr_exit = wr_exit
self._sma_period = sma_period
self._atr_period = atr_period
self._stop_mult = stop_mult
self._target_mult = target_mult
def _williams_r(self, bars):
if len(bars) < self._wr_period:
return None
window = bars[-self._wr_period:]
hh = max(b.high for b in window)
ll = min(b.low for b in window)
rng = hh - ll
if rng <= 0:
return None
return float(-100 * (hh - bars[-1].close) / rng)
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
need = max(self._sma_period, self._atr_period + 1, self._wr_period)
if len(bars) < need:
return None
wr = self._williams_r(bars)
if wr is None or not (wr < self._wr_entry):
return None
current = bars[-1]
sma_val = sma([b.close for b in bars], self._sma_period)
if sma_val is None or current.close <= Decimal(str(sma_val)):
return None
atr_val = atr(bars, self._atr_period)
if atr_val is None or atr_val <= 0:
return None
atr_dec = Decimal(str(atr_val))
entry = current.close
stop = entry - Decimal(str(self._stop_mult)) * atr_dec
target = entry + Decimal(str(self._target_mult)) * atr_dec
risk = entry - stop
if risk <= 0 or stop <= 0:
return None
rr = (target - entry) / risk
return Candidate(
ticker=ticker,
side="buy",
entry=entry,
stop=stop,
target=target,
risk_reward_ratio=rr.quantize(Decimal("0.01")),
signal_strength=50,
thesis=f"Williams %R(10) at {wr:.1f} (< -90) while close is above the 200-day SMA.",
)
def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal,
side: str, bars_held: int) -> bool:
wr = self._williams_r(bars)
if wr is None:
return False
return wr > self._wr_exit
Hypothetical results from our own backtest of the rule as restated, on 42 large US stocks over 15 years. Past performance, real or simulated, does not predict future results. Research and education only; not investment advice.
Describe it in plain words and get the same honest test in about a minute.