Skip to content
The Casebook · An idea an AI invented

Overnight selling, intraday buying: long on overnight uptick

Entry at latest close if the sum of (open/prior close - 1) over the last 10 days is below -4%, the sum of (close/open - 1) over the same days is above +2%, and today's overnight return is positive. Stop 1.5 ATR below. Target 2.5 ATR above.
Why the AI thought it might work

Overnight returns reflect institutional order flow while intraday returns reflect retail. When a stock's cumulative overnight return is strongly negative while intraday returns are positive over 10 days, institutions are net distributing yet price is supported by retail, which tends to resolve upward when overnight selling pressure fades; entry when the latest overnight return turns positive marks that turn.

VerdictTested Nov 22, 2026

Indistinguishable from luck

It looks positive, but not more than chance would produce at this many tries, or than the same plan on random dates.

  • Positive (+0.142R a trade), but no market clears t > 2.95 by trade and by day.
Trades on the laggards
271

42 large US stocks, 15 years

Per trade, after costs
+0.142R

Before costs +0.220R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On laggards the idea averaged 0.142R per trade after costs over 271 trades, but no market cleared the 2.95 bar: bear was highest at t 1.86 by trade and 2.16 by day, bull 0.31. Bear beat 90% of random-date draws, bull only 70%, so the result is indistinguishable from luck.

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
Bull119+0.039R0.310.30 · 92d−0.032R · beats 70%−0.033R
Flat56+0.167R0.881.12 · 41d−0.014R · beats 95%+0.026R
Bear96+0.255R1.862.16 · 42d+0.108R · beats 90%+0.586R
All271+0.142R+0.021R+0.208R

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

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


class OvernightSellingIntradayBuyingDivergenceLong:
    name = "overnight_selling_intraday_buying_divergence_long"
    description = "Broad negative overnight / positive intraday divergence over 10 days, entered on the first positive overnight gap."

    def __init__(self, window: int = 10, on_sum_max: float = -0.04, id_sum_min: float = 0.02,
                 min_neg_count: int = 6, max_gap_share: float = 0.5,
                 stop_atr: float = 1.5, target_atr: float = 2.5, atr_period: int = 14) -> None:
        self._window = window
        self._on_sum_max = on_sum_max
        self._id_sum_min = id_sum_min
        self._min_neg = min_neg_count
        self._max_share = max_gap_share
        self._stop_atr = stop_atr
        self._target_atr = target_atr
        self._atr_period = atr_period

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        w = self._window
        if len(bars) < max(60, w + self._atr_period + 5):
            return None
        cur = bars[-1]
        prev = bars[-2]
        if prev.close <= 0 or cur.open <= 0:
            return None
        today_on = float(cur.open) / float(prev.close) - 1.0
        if today_on <= 0:
            return None
        # Divergence window: the w bars ending yesterday
        ons = []
        ids = []
        for i in range(len(bars) - 1 - w, len(bars) - 1):
            pc = float(bars[i - 1].close)
            o = float(bars[i].open)
            c = float(bars[i].close)
            if pc <= 0 or o <= 0:
                return None
            ons.append(o / pc - 1.0)
            ids.append(c / o - 1.0)
        on_sum = sum(ons)
        id_sum = sum(ids)
        if on_sum >= self._on_sum_max or id_sum <= self._id_sum_min:
            return None
        # Fire-once guard: yesterday's overnight must be non-positive (this is the turn)
        if ons[-1] > 0:
            return None
        # Dispersion guards: persistent, not a single gap event
        neg_count = sum(1 for x in ons if x < 0)
        if neg_count < self._min_neg:
            return None
        worst = min(ons)
        if worst < 0 and abs(worst) > self._max_share * abs(on_sum):
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None or atr_val <= 0:
            return None
        a = Decimal(str(atr_val))
        entry = cur.close
        stop = entry - Decimal(str(self._stop_atr)) * a
        target = entry + Decimal(str(self._target_atr)) * a
        if stop <= 0 or not (stop < entry < target):
            return None
        risk = entry - stop
        rr = (target - entry) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength: divergence magnitude, persistence, today's close location
        div_mag = (-on_sum) + id_sum
        mag_score = min(40, max(0, int((div_mag - 0.06) / 0.10 * 40)))
        pers_score = min(30, max(0, int((neg_count - self._min_neg + 1) / (w - self._min_neg + 1) * 30)))
        rng = float(cur.high - cur.low)
        close_pos = (float(cur.close - cur.low) / rng) if rng > 0 else 0.5
        close_score = min(30, max(0, int(close_pos * 30)))
        strength = max(0, min(100, mag_score + pers_score + close_score))

        thesis = (
            f"Prior {w}d overnight sum {on_sum*100:.1f}% ({neg_count}/{w} negative, worst gap {worst*100:.1f}%) "
            f"vs intraday sum {id_sum*100:.1f}%. Persistent overnight selling was absorbed intraday, and today's "
            f"+{today_on*100:.2f}% overnight gap marks the turn. Stop {self._stop_atr} ATR, target {self._target_atr} ATR."
        )
        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=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
Overnight selling, intraday buying: long on overnight uptick: Indistinguishable from luck · EdgeProven