Skip to content
The Casebook · An idea an AI invented

Hold-above-midpoint after a high-volume gap-up, ATR target

Find a bar within the last 8 sessions with gap up >4% (open vs prior close) and volume >3x 50-day average. Since then, every close must be above that bar's midpoint ((high+low)/2) and latest close within 3% of the highest close since. Enter long at close. Stop = gap bar low. Target = entry + 3.0*ATR(14).
Why the AI thought it might work

Post-earnings-announcement drift: investors under-react to earnings news, and a gap-up on huge volume that holds above the gap-day's midpoint for several sessions shows institutional accumulation continuing over days because large funds cannot build positions at once. Persists because of slow diffusion and capital constraints.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.116R a trade after costs on the laggard stocks.
Trades on the laggards
55

42 large US stocks, 15 years

Per trade, after costs
−0.116R

Before costs +0.002R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks, 55 trades averaged −0.116R after costs, against 0.002R before costs. In bull markets the average was −0.294R over 46 trades, beating 20% of random-date draws. The flat-market result of 1.333R rests on just 7 trades. Winners also came out slightly negative at −0.031R.

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
Bull46−0.294R−1.27−1.27 · 46d−0.107R · beats 20%−0.014R
Flat7+1.333R3.293.29 · 7d+0.137R · beats 100%−0.201R
Bear2−1.096R−140.66−140.66 · 2d−0.099R · beats 10%+0.632R
All55−0.116R−0.076R−0.031R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 19.9 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 PostEarningsGapHoldDriftLong:
    name = "post_earnings_gap_hold_drift_long"
    description = "Recent >4% gap-up on >3x volume that has held above its midpoint and sits near its post-gap high"

    def __init__(self, max_age: int = 8, min_age: int = 2, gap_pct: float = 0.04,
                 vol_mult: float = 3.0, vol_lookback: int = 50, near_high_pct: float = 0.03,
                 atr_period: int = 14, atr_target_mult: float = 3.0, min_rr: float = 1.5) -> None:
        self._max_age = max_age
        self._min_age = min_age
        self._gap_pct = gap_pct
        self._vol_mult = vol_mult
        self._vol_lookback = vol_lookback
        self._near_high_pct = near_high_pct
        self._atr_period = atr_period
        self._atr_target_mult = atr_target_mult
        self._min_rr = min_rr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < self._vol_lookback + self._max_age + 30:
            return None
        last = n - 1
        gap_idx = None
        gap_ratio = 0.0
        vol_ratio = 0.0
        # most recent qualifying gap bar first
        for age in range(self._min_age, self._max_age + 1):
            k = last - age
            if k - self._vol_lookback < 1:
                break
            prev_close = float(bars[k - 1].close)
            if prev_close <= 0:
                continue
            g = float(bars[k].open) / prev_close - 1.0
            if g <= self._gap_pct:
                continue
            vols = [float(b.volume) for b in bars[k - self._vol_lookback:k]]
            avg_v = sum(vols) / len(vols) if vols else 0.0
            if avg_v <= 0:
                continue
            vr = float(bars[k].volume) / avg_v
            if vr <= self._vol_mult:
                continue
            gap_idx = k
            gap_ratio = g
            vol_ratio = vr
            break
        if gap_idx is None:
            return None

        gbar = bars[gap_idx]
        mid = (gbar.high + gbar.low) / 2
        for b in bars[gap_idx + 1:]:
            if b.close <= mid:
                return None
        max_close = max(b.close for b in bars[gap_idx:])
        current = bars[-1]
        if max_close <= 0:
            return None
        dist = float((max_close - current.close) / max_close)
        if dist > self._near_high_pct:
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None or atr_val <= 0:
            return None
        atr_dec = Decimal(str(atr_val))
        entry = current.close
        stop = gbar.low
        if stop <= 0 or stop >= entry:
            return None
        target = entry + Decimal(str(self._atr_target_mult)) * atr_dec
        risk = entry - stop
        if risk <= 0 or target <= entry:
            return None
        rr = (target - entry) / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        # scoring
        vol_score = min(35, max(0, int((vol_ratio - self._vol_mult) / 5.0 * 35) + 10))
        gap_score = min(25, max(0, int((gap_ratio - self._gap_pct) / 0.10 * 25) + 5))
        prox_score = min(20, max(0, int((1.0 - dist / self._near_high_pct) * 20)))
        closes = [float(b.close) for b in bars]
        sma50 = sma(closes, 50)
        trend_score = 0
        if sma50 is not None and float(current.close) > sma50:
            trend_score += 10
        sma200 = sma(closes, 200) if n >= 200 else None
        if sma200 is not None and float(current.close) > sma200:
            trend_score += 10
        strength = max(0, min(100, vol_score + gap_score + prox_score + trend_score))

        age = last - gap_idx
        return Candidate(
            ticker=ticker,
            side="buy",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=int(strength),
            thesis=(f"Gap-up {gap_ratio*100:.1f}% on {vol_ratio:.1f}x volume {age} sessions ago has held above "
                    f"the gap-bar midpoint and sits within {dist*100:.1f}% of its post-gap high; "
                    f"post-announcement drift from staggered institutional accumulation. Stop at gap-bar low."),
        )

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
Hold-above-midpoint after a high-volume gap-up, ATR target: Loses money · EdgeProven