Skip to content
The Casebook · An idea an AI invented

Buy after a big gap-down that closes above its open

Compute overnight return = open/prev close -1. Require overnight return <= -2.5 x the std of overnight returns over the past 60 bars, intraday return (close/open) > 0, and close below the prior close. Enter long at the latest close; stop below the day's low minus 0.2 ATR(14); target at the prior close or 2.5 x ATR(14) above, whichever is smaller.
Why the AI thought it might work

A large overnight gap down in a low-news name (gap bigger than 2x the stock's typical overnight move) is driven by thin pre-market order books where market makers widen spreads and demand compensation. When the stock then closes back inside the gap's bottom half but above the open, liquidity providers have been paid and inventory pressure fades; the following day's continuation toward the prior close earns the premium.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.378R a trade after costs on the laggard stocks.
Trades on the laggards
84

42 large US stocks, 15 years

Per trade, after costs
−0.378R

Before costs −0.210R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggard stocks the plan averaged −0.378R per trade after costs over 84 trades, versus −0.2102720592132752 before costs. It was negative in bull (−0.303R), flat (−0.585R) and bear (−0.453R) markets, and the 20 winners also came in negative at −0.232R. That is why the verdict is that it loses money.

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
Bull54−0.303R−1.38−1.28 · 50d−0.197R · beats 45%+0.263R
Flat14−0.585R−1.14−0.74 · 12d−0.316R · beats 30%−0.664R
Bear16−0.453R−1.34−0.95 · 9d+0.033R · beats 15%−0.954R
All84−0.378R−0.173R−0.232R

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

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


class VolScaledGapDownInventoryLong:
    name = "vol_scaled_gap_down_inventory_long"
    description = "Volatility-scaled overnight gap down that closes green but below prior close; long for inventory-premium drift toward gap fill."

    def __init__(self, std_lookback: int = 60, gap_sd_mult: float = 2.5, max_gap_sd: float = 8.0, max_gap_pct: float = 0.15, max_rel_vol: float = 3.0, vol_lookback: int = 20, atr_period: int = 14, stop_atr_buf: float = 0.2, target_atr_mult: float = 2.5, min_rr: float = 1.5) -> None:
        self._L = std_lookback
        self._mult = gap_sd_mult
        self._max_sd = max_gap_sd
        self._max_pct = max_gap_pct
        self._max_rv = max_rel_vol
        self._vl = vol_lookback
        self._ap = atr_period
        self._buf = stop_atr_buf
        self._tmult = target_atr_mult
        self._min_rr = min_rr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        need = max(self._L, self._vl) + self._ap + 5
        if n < need:
            return None
        cur = bars[-1]
        prev = bars[-2]
        pc = float(prev.close)
        o = float(cur.open)
        c = float(cur.close)
        if pc <= 0 or o <= 0 or c <= 0:
            return None

        # Overnight returns over the prior L bars (today excluded)
        rets = []
        for i in range(n - 1 - self._L, n - 1):
            if i < 1:
                continue
            p = float(bars[i - 1].close)
            if p <= 0:
                continue
            rets.append(float(bars[i].open) / p - 1.0)
        if len(rets) < int(self._L * 0.8):
            return None
        m = sum(rets) / len(rets)
        var = sum((r - m) ** 2 for r in rets) / max(len(rets) - 1, 1)
        sd = math.sqrt(var)
        if sd <= 0:
            return None

        gap = o / pc - 1.0
        if gap > -self._mult * sd:
            return None
        sd_mult = -gap / sd
        # News-gap proxies: extreme gaps are likely fundamental events
        if sd_mult > self._max_sd or -gap > self._max_pct:
            return None

        # Intraday green, still below prior close
        if c <= o or c >= pc:
            return None

        # News-gap proxy: climactic volume suggests an information event
        vols = [float(b.volume) for b in bars[-(self._vl + 1):-1]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        if avg_vol <= 0:
            return None
        rel_vol = float(cur.volume) / avg_vol
        if rel_vol > self._max_rv:
            return None

        atr_val = atr(bars, self._ap)
        if atr_val is None or float(atr_val) <= 0:
            return None
        atr_dec = Decimal(str(float(atr_val)))

        entry = cur.close
        stop = cur.low - Decimal(str(self._buf)) * atr_dec
        target = min(prev.close, entry + Decimal(str(self._tmult)) * atr_dec)
        risk = entry - stop
        reward = target - entry
        if risk <= 0 or reward <= 0:
            return None
        rr = reward / risk
        if rr <= Decimal(str(self._min_rr)):
            return None

        # Score 1: reclaim depth; bottom-half-of-gap closes favored per mechanism
        retrace = (c - o) / (pc - o)
        if retrace <= 0.5:
            reclaim_score = 35.0 * min(1.0, retrace / 0.15)
        else:
            reclaim_score = 35.0 * 0.6 * max(0.0, (1.0 - retrace) / 0.5)
        # Score 2: thin-book proxy (lower relative volume is better)
        if rel_vol <= 1.5:
            thin_score = 35.0
        else:
            thin_score = 35.0 * max(0.0, (self._max_rv - rel_vol) / (self._max_rv - 1.5))
        # Score 3: gap size; moderate gaps favored over extreme ones
        if sd_mult <= 5.0:
            gap_score = 30.0
        else:
            frac = (sd_mult - 5.0) / max(self._max_sd - 5.0, 0.01)
            gap_score = 30.0 - 20.0 * min(1.0, frac)
        strength = int(max(0, min(100, round(reclaim_score + thin_score + gap_score))))

        thesis = (
            f"Overnight gap {gap*100:.1f}% ({sd_mult:.1f} sd of {self._L}-bar overnight moves) on "
            f"{rel_vol:.1f}x avg volume (non-climactic, thin-book proxy); session closed green above open, "
            f"reclaiming {retrace*100:.0f}% of the gap. Dealer inventory premium should fade into drift "
            f"toward the prior close."
        )

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

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 big gap-down that closes above its open: Loses money · EdgeProven