Skip to content
The Casebook · An idea an AI invented

Buy after gap-down sessions that close above their open

Over last 4 bars: at least 3 have open < prev_close by >0.5% AND close > open; cumulative 4-day close-to-close return < -4%. Enter long at latest close. Stop = lowest low of last 4 bars minus 0.25*ATR(14). Target = entry + 2.5*ATR(14).
Why the AI thought it might work

After a sequence of strongly negative overnight gaps (sell orders accumulated while market closed, margin calls, news-driven overnight liquidations) that are then partially bought intraday, intraday liquidity providers are repaid for absorbing overnight imbalance. When 3 of the last 4 sessions gapped down but each closed above its open, buyers are visibly absorbing forced overnight supply, and the reversion captures the liquidity premium.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.262R a trade after costs on the laggard stocks.
Trades on the laggards
30

42 large US stocks, 15 years

Per trade, after costs
−0.262R

Before costs −0.182R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks the 30 trades averaged −0.262R after costs, and the winners did worse at −0.51R. Only flat markets were positive (0.688R, 9 trades, t 0.84); bull (−0.522R) and bear (−0.743R) were negative. No market state reached the bar of t 2.95, so the verdict is a loss.

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
Bull7−0.522R−0.92−0.92 · 7d−0.307R · beats 35%−0.640R
Flat9+0.688R0.840.84 · 9d−0.187R · beats 95%−1.222R
Bear14−0.743R−1.39−1.05 · 12d+0.375R · beats 10%−0.353R
All30−0.262R+0.047R−0.510R

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
from scanners.base import Candidate


class OvernightWeaknessCapitulationLong:
    name = "overnight_weakness_capitulation_long"
    description = "3 of last 4 sessions gapped down >0.5% but closed above open, with 4-day return < -4%: buyers absorbing forced overnight supply."

    def __init__(self, window: int = 4, min_hits: int = 3, gap_pct: float = 0.005, cum_ret: float = -0.04, stop_atr_buf: float = 0.25, target_atr_mult: float = 2.5, min_bars: int = 60, min_rr: float = 1.5) -> None:
        self._window = window
        self._min_hits = min_hits
        self._gap_pct = gap_pct
        self._cum_ret = cum_ret
        self._stop_buf = stop_atr_buf
        self._tgt_mult = target_atr_mult
        self._min_bars = min_bars
        self._min_rr = min_rr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < max(self._min_bars, self._window + 22):
            return None
        current = bars[-1]
        w = self._window

        hits = 0
        gap_sum = 0.0
        absorb_sum = 0.0
        for k in range(n - w, n):
            b = bars[k]
            prev_close = float(bars[k - 1].close)
            o = float(b.open)
            c = float(b.close)
            if prev_close <= 0:
                return None
            gap = (prev_close - o) / prev_close
            if gap > self._gap_pct and c > o:
                hits += 1
                gap_sum += gap
                gap_abs = prev_close - o
                absorb_sum += min(1.0, (c - o) / gap_abs) if gap_abs > 0 else 0.0
        if hits < self._min_hits:
            return None

        base_close = float(bars[n - w - 1].close)
        if base_close <= 0:
            return None
        cum = float(current.close) / base_close - 1.0
        if cum >= self._cum_ret:
            return None

        atr_val = atr(bars, 14)
        if atr_val is None or atr_val <= 0:
            return None
        atr_dec = Decimal(str(atr_val))

        entry = current.close
        window_low = min(b.low for b in bars[n - w:])
        stop = window_low - Decimal(str(self._stop_buf)) * atr_dec
        target = entry + Decimal(str(self._tgt_mult)) * atr_dec
        if not (stop < entry < target):
            return None
        risk = entry - stop
        if risk <= 0:
            return None
        rr = (target - entry) / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        # Sub-score 1: gap severity (avg gap of qualifying bars), up to 30
        avg_gap = gap_sum / hits
        gap_score = min(30, max(0, int(avg_gap * 1000)))
        # Sub-score 2: absorption (avg fraction of each gap recovered intraday), up to 35
        absorb_score = min(35, max(0, int((absorb_sum / hits) * 35)))
        # Sub-score 3: volume over window vs prior 20-day average, up to 20
        prior_vol = [float(b.volume) for b in bars[n - w - 20:n - w]]
        avg_vol = sum(prior_vol) / max(len(prior_vol), 1)
        win_vol = sum(float(b.volume) for b in bars[n - w:]) / w
        vol_ratio = win_vol / avg_vol if avg_vol > 0 else 1.0
        vol_score = min(20, max(0, int((vol_ratio - 1.0) * 20)))
        # Sub-score 4: last-bar close location, up to 15
        rng = float(current.high - current.low)
        close_pos = (float(current.close - current.low) / rng) if rng > 0 else 0.5
        close_score = min(15, max(0, int(close_pos * 15)))
        strength = max(0, min(100, gap_score + absorb_score + vol_score + close_score))

        thesis = (
            f"{hits} of last {w} sessions gapped down (avg {avg_gap*100:.1f}%) yet closed above the open; "
            f"{w}-day return {cum*100:.1f}%. Intraday buyers are absorbing forced overnight supply, so a liquidity-premium reversion is expected. "
            f"Stop below the {w}-day low, target +{self._tgt_mult} ATR."
        )
        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 gap-down sessions that close above their open: Loses money · EdgeProven