Skip to content
The Casebook · An idea an AI invented

Gap-up on volume, close near high, stop at day's low

Fire when the open exceeds the prior close by at least 1x ATR(14), the close is in the top 20% of the day's range, volume exceeds 1.5x the 20-day average, and the close is above the 50-day SMA. Enter long at close. Stop at the day's low; target 2.5x ATR above entry.
Why the AI thought it might work

A gap up that opens in the top part of the prior range and closes near the day's high on above-average volume signals institutional accumulation that could not be completed at the open and spills over into following days due to order-splitting constraints on large buyers.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.165R a trade after costs on the laggard stocks.
Trades on the laggards
46

42 large US stocks, 15 years

Per trade, after costs
−0.165R

Before costs −0.077R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggard stocks it averaged −0.165R a trade after costs over 46 trades, against −0.077R before costs. The 20 winners averaged 0.031R. In bull markets it came to −0.104R (t −0.32), and in flat markets −0.567R (t −1.29). The verdict follows from the negative laggard result.

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
Bull32−0.104R−0.320.00 · 29d−0.004R · beats 30%−0.162R
Flat9−0.567R−1.29−1.29 · 9d−0.330R · beats 25%+0.743R
Bear5+0.166R0.210.21 · 5d−0.108R · beats 60%+0.343R
All46−0.165R−0.079R+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 5.8 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 OpeningGapContinuationVolumeConfirmLong:
    name = "opening_gap_continuation_volume_confirm_long"
    description = "Gap up >=1 ATR, close in top 20% of range on >=1.5x volume above the 50-SMA; long continuation"

    def __init__(self, gap_atr_mult: float = 1.0, close_pos_min: float = 0.8, vol_mult: float = 1.5, sma_len: int = 50, target_atr_mult: float = 2.5, stop_atr_buffer: float = 0.0, min_rr: float = 1.5, min_bars: int = 60) -> None:
        self._gap_atr_mult = gap_atr_mult
        self._close_pos_min = close_pos_min
        self._vol_mult = vol_mult
        self._sma_len = sma_len
        self._target_atr_mult = target_atr_mult
        self._stop_atr_buffer = stop_atr_buffer
        self._min_rr = min_rr
        self._min_bars = min_bars

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < max(self._min_bars, self._sma_len + 2, 22):
            return None
        cur = bars[-1]
        prev = bars[-2]

        # ATR measured through yesterday so the gap is judged vs normal volatility
        atr_val = atr(bars[:-1], 14)
        if atr_val is None:
            return None
        atr_f = float(atr_val)
        if atr_f <= 0:
            return None
        atr_dec = Decimal(str(atr_f))

        open_ = Decimal(str(cur.open))
        high = Decimal(str(cur.high))
        low = Decimal(str(cur.low))
        close = Decimal(str(cur.close))
        prev_close = Decimal(str(prev.close))

        # 1. Gap up of at least gap_atr_mult * ATR
        gap = open_ - prev_close
        if gap < Decimal(str(self._gap_atr_mult)) * atr_dec:
            return None

        # 2. Close in the top part of the day's range
        rng = high - low
        if rng <= 0:
            return None
        close_pos = float((close - low) / rng)
        if close_pos < self._close_pos_min:
            return None

        # 3. Volume confirmation vs prior 20-day average
        prior_vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(prior_vols) / 20.0
        if avg_vol <= 0:
            return None
        vol_ratio = float(cur.volume) / avg_vol
        if vol_ratio < self._vol_mult:
            return None

        # 4. Trend filter: close above 50-day SMA
        closes = [float(b.close) for b in bars]
        sma_val = sma(closes, self._sma_len)
        if sma_val is None:
            return None
        sma_f = float(sma_val)
        if sma_f <= 0 or float(close) <= sma_f:
            return None

        # Trade plan
        entry = close
        stop = low - Decimal(str(self._stop_atr_buffer)) * atr_dec
        target = entry + Decimal(str(self._target_atr_mult)) * atr_dec
        risk = entry - stop
        if risk <= 0 or stop <= 0:
            return None
        reward = target - entry
        if reward <= 0:
            return None
        rr = reward / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        # Signal strength
        vol_score = min(35.0, max(0.0, (vol_ratio - self._vol_mult) / 2.0 * 35.0))
        gap_atr = float(gap) / atr_f
        gap_score = min(25.0, max(0.0, (gap_atr - self._gap_atr_mult) / 2.0 * 25.0))
        close_score = min(20.0, max(0.0, (close_pos - self._close_pos_min) / max(1e-9, 1.0 - self._close_pos_min) * 20.0))
        ext = (float(close) - sma_f) / sma_f
        # reward healthy trend, mildly penalise extreme extension (>25% above SMA)
        if ext <= 0.25:
            trend_score = min(20.0, ext / 0.10 * 20.0)
        else:
            trend_score = max(0.0, 20.0 - (ext - 0.25) * 80.0)
        strength = int(max(0, min(100, round(vol_score + gap_score + close_score + trend_score))))

        thesis = (
            f"Gapped up {gap_atr:.2f}x ATR and closed at {close_pos*100:.0f}% of the day's range on "
            f"{vol_ratio:.2f}x average volume, above the {self._sma_len}-SMA. The gap holding into the close "
            "suggests unfinished institutional accumulation that should spill into the following sessions. "
            "Stop is under the gap-day low; the target is 2.5x 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,
            asset_class="equity",
        )

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