Skip to content
The Casebook · An idea an AI invented

Short a stalled retest of an unfilled gap-down edge

Entry short at latest close if a gap down of at least 3% occurred within the last 15 sessions and has not been filled, today's high reached within 1% of the gap's upper edge (prior close before the gap), and today's close is below its open and below yesterday's close. Stop 0.5 ATR above the gap edge. Target 3 ATR below.
Why the AI thought it might work

After a gap down, holders from before the gap are underwater and wait for a return to the gap's top edge to exit at breakeven, so supply is concentrated at the gap's upper boundary. A rally that stalls at that boundary and closes weak meets this concentrated, constrained supply.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.181R a trade after costs on the laggard stocks.
Trades on the laggards
81

42 large US stocks, 15 years

Per trade, after costs
−0.181R

Before costs −0.105R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks the plan averaged −0.181R a trade after costs over 81 trades, against −0.582R on today's winners. Bull markets came to −0.008R and flat to −0.109R, both near zero in 48 and 10 trades. Bear markets were worst at −0.573R, beating only 35% of random-date draws. Losses in all three market types are why the verdict is a loss.

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
Bull48−0.008R−0.040.17 · 44d−0.153R · beats 85%−0.514R
Flat10−0.109R−0.21−0.21 · 10d−0.220R · beats 70%+0.121R
Bear23−0.573R−2.17−1.64 · 20d−0.425R · beats 35%−0.971R
All81−0.181R−0.238R−0.582R

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

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


class FailedBounceBelowPriorGapSupplyShort:
    name = "failed_bounce_below_prior_gap_supply_short"
    description = "Short a red-close rejection at the upper edge of a recent unfilled 3%+ gap down."

    def __init__(self, gap_pct: float = 0.03, lookback: int = 15, touch_pct: float = 0.01,
                 stop_atr: float = 0.5, target_atr: float = 3.0, atr_period: int = 14) -> None:
        self._gap_pct = Decimal(str(gap_pct))
        self._lookback = lookback
        self._touch_pct = Decimal(str(touch_pct))
        self._stop_atr = Decimal(str(stop_atr))
        self._target_atr = Decimal(str(target_atr))
        self._atr_period = atr_period

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < 60:
            return None
        cur = bars[-1]
        prev = bars[-2]
        if not (cur.close < cur.open and cur.close < prev.close):
            return None

        # Find the most recent qualifying unfilled gap down (gap bar strictly before today).
        edge = None
        gap_size = Decimal("0")
        gap_idx = None
        start = max(1, n - 1 - self._lookback)
        for j in range(n - 2, start - 1, -1):
            pc = bars[j - 1].close
            if pc <= 0:
                continue
            op = bars[j].open
            if op > pc * (Decimal("1") - self._gap_pct):
                continue
            # Unfilled from the gap bar through yesterday.
            filled = False
            for k in range(j, n - 1):
                if bars[k].high >= pc:
                    filled = True
                    break
            if filled:
                continue
            edge = pc
            gap_size = (pc - op) / pc
            gap_idx = j
            break
        if edge is None:
            return None

        # Today's high tagged within 1% of the edge (allow a slight overshoot), but closed below it.
        if cur.high < edge * (Decimal("1") - self._touch_pct):
            return None
        if cur.high > edge * (Decimal("1") + self._touch_pct):
            return None
        if cur.close >= edge:
            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 = max(edge, cur.high) + self._stop_atr * a
        target = entry - self._target_atr * a
        if target <= 0 or not (target < entry < stop):
            return None
        risk = stop - entry
        if risk <= 0:
            return None
        rr = (entry - target) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength components
        rng = cur.high - cur.low
        if rng <= 0:
            rng = Decimal("0.01")
        upper_wick = (cur.high - max(cur.open, cur.close)) / rng
        close_pos = (cur.close - cur.low) / rng
        reject_score = int(min(30, max(0, float(upper_wick) * 30 + (1 - float(close_pos)) * 10)))

        avg_vol = sum(b.volume for b in bars[-21:-1]) / 20
        vol_ratio = float(cur.volume) / max(float(avg_vol), 1.0)
        vol_score = int(min(25, max(0, (vol_ratio - 0.7) * 25)))

        closes = [b.close for b in bars]
        trend_score = 0
        s50 = sma(closes, 50)
        if s50 is not None and cur.close < Decimal(str(s50)):
            trend_score += 12
        if n >= 200:
            s200 = sma(closes, 200)
            if s200 is not None and cur.close < Decimal(str(s200)):
                trend_score += 13

        gap_score = int(min(20, max(0, float(gap_size) * 250)))
        strength = max(0, min(100, reject_score + vol_score + trend_score + gap_score))

        days_ago = (n - 1) - gap_idx
        return Candidate(
            ticker=ticker,
            side="sell",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=strength,
            thesis=(f"Rally tagged the top edge ({edge}) of an unfilled {float(gap_size)*100:.1f}% gap down "
                    f"from {days_ago} sessions ago and closed red, below its open and the prior close; "
                    f"trapped pre-gap holders supply this level."),
        )

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 a stalled retest of an unfilled gap-down edge: Loses money · EdgeProven