Skip to content
The Casebook · An idea an AI invented

Modest gap-up above a rising 50-day average, high volume

Require close above a rising 50-SMA, overnight gap (open/prev close -1) between +0.5% and +1.5%, close above the open and above the prior high, and volume >= 1.1x the 20-bar average. Enter long at the latest close; stop below the day's low minus 0.2 ATR(14); target 2.5 x ATR(14) above.
Why the AI thought it might work

Overnight returns account for a disproportionate share of equity premium because institutions place buy orders at the open and index-linked inflows trade at the open. A stock in an uptrend that gaps up modestly (0.5 to 1.5%) and holds the gap through the close attracts follow-through as late buyers see confirmation, while the small size avoids exhaustion. Persistence is attributable to institutional execution programs spreading orders over multiple days.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.227R a trade after costs on the laggard stocks.
Trades on the laggards
518

42 large US stocks, 15 years

Per trade, after costs
−0.227R

Before costs −0.096R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggard stocks, 518 trades averaged −0.227R after costs and −0.096R before costs. Bull markets gave −0.222R across 415 trades and beat only 5% of random-date draws. Flat (−0.314R) and bear (−0.098R) markets were also negative. The 20 winners showed 0.052R.

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
Bull415−0.222R−2.36−2.42 · 322d−0.084R · beats 5%+0.021R
Flat72−0.314R−1.45−1.24 · 61d−0.083R · beats 30%+0.199R
Bear31−0.098R−0.29−0.83 · 23d−0.008R · beats 30%+0.474R
All518−0.227R−0.079R+0.052R

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


class GapHoldTrendContinuationLong:
    name = "gap_hold_trend_continuation_long"
    description = "Modest 0.5-1.5% gap up that holds, closes green above prior high, inside a rising 50-SMA uptrend with volume."

    def __init__(self, sma_len: int = 50, slope_lookback: int = 10, gap_min: float = 0.005, gap_max: float = 0.015, vol_mult: float = 1.1, vol_len: int = 20, atr_len: int = 14, stop_atr_buf: float = 0.2, target_atr_mult: float = 2.5, min_rr: float = 1.5) -> None:
        self._sma_len = sma_len
        self._slope_lb = slope_lookback
        self._gap_min = gap_min
        self._gap_max = gap_max
        self._vol_mult = vol_mult
        self._vol_len = vol_len
        self._atr_len = atr_len
        self._stop_buf = stop_atr_buf
        self._tgt_mult = target_atr_mult
        self._min_rr = min_rr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        need = self._sma_len + self._slope_lb + self._vol_len + 5
        if len(bars) < need:
            return None
        cur = bars[-1]
        prev = bars[-2]
        try:
            c = float(cur.close)
            o = float(cur.open)
            h = float(cur.high)
            lo = float(cur.low)
            pc = float(prev.close)
            ph = float(prev.high)
        except Exception:
            return None
        if pc <= 0 or o <= 0 or c <= 0:
            return None

        gap = o / pc - 1.0
        if gap < self._gap_min or gap > self._gap_max:
            return None
        if c <= o or c <= ph:
            return None
        # gap held: day low did not fully fill the gap
        if lo <= pc:
            return None

        closes = [float(b.close) for b in bars]
        sma_now = sma(closes, self._sma_len)
        sma_prev = sma(closes[:-self._slope_lb], self._sma_len)
        if sma_now is None or sma_prev is None:
            return None
        sma_now = float(sma_now)
        sma_prev = float(sma_prev)
        if sma_prev <= 0 or c <= sma_now or sma_now <= sma_prev:
            return None

        vols = [float(b.volume) for b in bars[-(self._vol_len + 1):-1]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        if avg_vol <= 0:
            return None
        vol_ratio = float(cur.volume) / avg_vol
        if vol_ratio < self._vol_mult:
            return None

        atr_val = atr(bars, self._atr_len)
        if atr_val is None:
            return None
        a = float(atr_val)
        if a <= 0:
            return None

        entry = cur.close
        stop = Decimal(str(round(lo - self._stop_buf * a, 4)))
        target = Decimal(str(round(c + self._tgt_mult * a, 4)))
        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

        # scoring
        vol_score = min(30.0, max(0.0, (vol_ratio - 1.0) * 30.0))
        gap_score = max(0.0, 20.0 - abs(gap - 0.01) * 4000.0)
        rng = max(h - lo, 1e-6)
        close_pos = (c - lo) / rng
        close_score = min(25.0, max(0.0, close_pos * 25.0))
        slope = (sma_now / sma_prev - 1.0)
        slope_score = min(15.0, max(0.0, slope * 500.0))
        ext = (c - sma_now) / a
        ext_score = 10.0 if ext <= 2.0 else max(0.0, 10.0 - (ext - 2.0) * 5.0)
        strength = int(max(0, min(100, round(vol_score + gap_score + close_score + slope_score + ext_score))))

        thesis = (
            f"Gapped up {gap * 100:.2f}% and held the gap (low above prior close), closed green above prior high "
            f"on {vol_ratio:.2f}x volume, above a rising 50-SMA; institutional open-auction demand likely continues "
            f"over multiple sessions. Stop under day low - {self._stop_buf} ATR, 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