Skip to content
The Casebook · An idea an AI invented

Buy after a held gap-down, close above the gap-day high

Within last 4 bars there was a gap-down open >= 3% below prior close, with close > open that day. In subsequent bars no low undercuts the gap-day low. Today's close > gap-day high. Long at close. Stop = gap-day low minus 0.3*ATR(14). Target = entry + 3*ATR(14).
Why the AI thought it might work

A large gap-down that is bought immediately so the close is above the open, then holds the gap-day low for two further sessions, means sellers who sold the open could not push price further. Short sellers who entered into the gap are underwater and cover on any strength, giving an asymmetric squeeze.

VerdictTested Nov 22, 2026

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.
Trades on the laggards
75

42 large US stocks, 15 years

Per trade, after costs
+0.257R

Before costs +0.319R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 75 laggard trades it averages 0.257R after costs, against 0.457 on today's winners. Bull markets show 0.139R (t 0.60) and flat markets 0.467R (t 1.23); only bear markets reach t 1.96, from 12 distinct days. The winners' own rise carried the result, hence the verdict.

How it was tested

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

Side
Long
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
Bull30+0.139R0.600.28 · 27d+0.009R · beats 70%+0.796R
Flat13+0.467R1.231.23 · 13d−0.031R · beats 100%+0.395R
Bear32+0.283R1.962.43 · 12d+0.127R · beats 80%+0.096R
All75+0.257R+0.052R+0.457R

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.3 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 GapDownTrappedShortsLong:
    name = "gap_down_trapped_shorts_long"
    description = "Bought gap-down (>=3%) whose low holds 2+ sessions, triggered on first close above the gap-day high"

    def __init__(self, gap_pct: float = 0.03, min_hold: int = 2, max_back: int = 4,
                 stop_atr_buf: float = 0.3, target_atr_mult: float = 3.0,
                 min_rr: float = 1.6, atr_period: int = 14) -> None:
        self._gap_pct = Decimal(str(gap_pct))
        self._min_hold = min_hold
        self._max_back = max_back
        self._stop_buf = Decimal(str(stop_atr_buf))
        self._tgt_mult = Decimal(str(target_atr_mult))
        self._min_rr = Decimal(str(min_rr))
        self._atr_period = atr_period

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < 60:
            return None
        n = len(bars)
        today = bars[-1]
        gap_idx = None
        # k = bars ago of the gap bar; k >= min_hold ensures >= 2 post-gap sessions (incl. today)
        for k in range(self._min_hold, self._max_back + 1):
            i = n - 1 - k
            if i < 1:
                break
            g = bars[i]
            prev_close = bars[i - 1].close
            if prev_close <= 0:
                continue
            if g.open > prev_close * (Decimal("1") - self._gap_pct):
                continue
            if g.close <= g.open:
                continue
            gap_idx = i
            break
        if gap_idx is None:
            return None
        g = bars[gap_idx]
        prev_close = bars[gap_idx - 1].close
        post = bars[gap_idx + 1:]
        if len(post) < self._min_hold:
            return None
        # Gap-day low must hold on every subsequent bar including today
        if any(b.low < g.low for b in post):
            return None
        # Trigger: today closes above gap-day high for the first time since the gap
        if today.close <= g.high:
            return None
        if any(b.close > g.high for b in post[:-1]):
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None or atr_val <= 0:
            return None
        atr_d = Decimal(str(atr_val))
        entry = today.close
        stop = g.low - self._stop_buf * atr_d
        risk = entry - stop
        if risk <= 0 or stop <= 0:
            return None
        target = entry + self._tgt_mult * atr_d
        # If the structural stop is wide, extend target to keep minimum R:R
        if (target - entry) / risk < self._min_rr:
            target = entry + self._min_rr * risk
        rr = (target - entry) / risk
        if rr <= Decimal("1.5"):
            return None

        # Strength components
        gap_size = float((prev_close - g.open) / prev_close)
        gap_score = min(30, max(0, int((gap_size - 0.03) * 600) + 10))
        g_rng = g.high - g.low
        g_pos = float((g.close - g.low) / g_rng) if g_rng > 0 else 0.5
        rev_score = min(25, max(0, int(g_pos * 25)))
        vols = [float(b.volume) for b in bars[gap_idx - 20:gap_idx]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        vr = float(g.volume) / avg_vol if avg_vol > 0 else 1.0
        vol_score = min(25, max(0, int((vr - 1.0) * 15)))
        t_rng = today.high - today.low
        t_pos = float((today.close - today.low) / t_rng) if t_rng > 0 else 0.5
        close_score = min(20, max(0, int(t_pos * 20)))
        strength = max(0, min(100, gap_score + rev_score + vol_score + close_score))

        hold_days = len(post)
        return Candidate(
            ticker=ticker,
            side="buy",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=strength,
            thesis=(f"{gap_size*100:.1f}% gap-down was bought (close>open), its low held for {hold_days} sessions, "
                    f"and price just reclaimed the gap-day high; gap shorts are trapped and likely to cover."),
        )

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
Buy after a held gap-down, close above the gap-day high: Survivorship mirage · EdgeProven