Skip to content
The Casebook · An idea an AI invented

Short after a failed 20-bar breakout, stop above the high

Today's high exceeds the highest high of the prior 20 bars, but close is in the bottom 35% of today's range and below prior close. Short at close. Stop = today's high plus 0.25*ATR(14). Target = entry - 2*ATR(14).
Why the AI thought it might work

A spike above a multi-week high that closes in the lower part of the range harvested buy-stop orders and breakout-chasers' entries; once triggered flow is exhausted there is no new buyer, and the chasers are trapped. Supply from trapped longs and fading shorts caps the move.

VerdictTested Nov 22, 2026

Loses money

After costs it lost money on the stocks that decide the verdict.

  • −0.231R a trade after costs on the laggard stocks.
Trades on the laggards
1,572

42 large US stocks, 15 years

Per trade, after costs
−0.231R

Before costs −0.103R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks this short lost −0.231R a trade after costs over 1572 trades, and −0.294R on the winners. Before costs it was still negative at about −0.103R. Bull markets lost −0.234R, flat −0.183R and bear −0.334R, with bull and bear beating only 10% and 20% of random-date draws. The verdict follows from losses in every market type.

How it was tested

The rule as written, coded once, run on every stock the same way.

Side
Short
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.95, by trade and by day, sized to the 362 rules in the search it came from
Prices
15 years of daily bars through 2026-11-20; judged 2026-11-22

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.

MarketTradesPer tradet, by tradet, by dayRandom datesWinners, per trade
Bull1,190−0.234R−5.50−4.79 · 787d−0.172R · beats 10%−0.241R
Flat282−0.183R−2.13−2.08 · 178d−0.189R · beats 55%−0.424R
Bear100−0.334R−2.42−0.75 · 52d−0.197R · beats 20%−0.764R
All1,572−0.231R−0.177R−0.294R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 12.7 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 code
from decimal import Decimal

from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate


class UpperWickStopRunReversalShort:
    name = "upper_wick_stop_run_reversal_short"
    description = "Failed 20-bar-high breakout that closes in the bottom 35% of the range and below the prior close; short the trapped breakout buyers."

    def __init__(
        self,
        lookback: int = 20,
        close_pct_max: float = 0.35,
        atr_period: int = 14,
        stop_atr_buffer: float = 0.25,
        target_atr_mult: float = 2.0,
        min_rr: float = 1.6,
        extend_target: bool = True,
        max_risk_atr: float = 2.5,
    ) -> None:
        self._lookback = lookback
        self._close_pct_max = Decimal(str(close_pct_max))
        self._atr_period = atr_period
        self._stop_buf = Decimal(str(stop_atr_buffer))
        self._target_mult = Decimal(str(target_atr_mult))
        self._min_rr = Decimal(str(min_rr))
        self._extend_target = extend_target
        self._max_risk_atr = Decimal(str(max_risk_atr))

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < max(self._lookback, self._atr_period) + 25:
            return None
        cur = bars[-1]
        prev = bars[-2]
        prior_window = bars[-(self._lookback + 1):-1]
        prior_high = max(b.high for b in prior_window)
        if cur.high <= prior_high:
            return None
        rng = cur.high - cur.low
        if rng <= 0:
            return None
        close_pos = (cur.close - cur.low) / rng
        if close_pos > self._close_pct_max:
            return None
        if cur.close >= prev.close:
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None or atr_val <= 0:
            return None
        a = Decimal(str(atr_val))

        entry = cur.close
        stop = cur.high + self._stop_buf * a
        risk = stop - entry
        if risk <= 0:
            return None
        if risk > self._max_risk_atr * a:
            return None

        dist = self._target_mult * a
        extended = False
        if dist < self._min_rr * risk:
            if not self._extend_target:
                return None
            dist = self._min_rr * risk
            extended = True
        target = entry - dist
        if target <= 0 or not (target < entry < stop):
            return None
        rr = dist / risk
        if rr <= Decimal("1.5"):
            return None

        wick_score = int((1.0 - float(close_pos)) * 35)
        overshoot_atr = float((cur.high - prior_high) / a)
        over_score = int(min(25.0, max(0.0, overshoot_atr * 50.0)))
        vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        vol_ratio = float(cur.volume) / avg_vol if avg_vol > 0 else 1.0
        vol_score = int(min(25.0, max(0.0, (vol_ratio - 1.0) * 25.0)))
        drop_atr = float((prev.close - cur.close) / a)
        drop_score = int(min(15.0, max(0.0, drop_atr * 15.0)))
        strength = max(0, min(100, wick_score + over_score + vol_score + drop_score))

        tgt_note = (
            "target widened to %.2fR because the wide spike bar made 2 ATR too small for the platform R:R floor" % float(self._min_rr)
            if extended
            else "target = entry - %.1f ATR" % float(self._target_mult)
        )
        thesis = (
            "Stop-run reversal: high %.2f pierced the prior %d-bar high %.2f, then closed at %.0f%% of the range, below the prior close. "
            "Breakout buy-stops were harvested and chasers are trapped; their supply should cap price. "
            "Stop %.2f is the spike high + %.2f ATR; %s; vol %.1fx avg."
            % (
                float(cur.high), self._lookback, float(prior_high), float(close_pos) * 100,
                float(stop), float(self._stop_buf), tgt_note, vol_ratio,
            )
        )

        return Candidate(
            ticker=ticker,
            side="sell",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=strength,
            thesis=thesis,
            asset_class="equity",
        )

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.

Have an idea of your own?

Describe it in plain words and get the same honest test in about a minute.

Run the Gauntlet
Short after a failed 20-bar breakout, stop above the high: Loses money · EdgeProven