Overnight gains, intraday losses, buy a down day
Over the last 20 bars, require sum of overnight returns (open/prev close -1) > +2% and sum of intraday returns (close/open -1) < -2%. Today require intraday return < -1% with overnight return >= 0. Enter long at the latest close; stop 2 x ATR(14) below; target 3 x ATR(14) above.
When a stock's overnight returns (prior close to open) have been persistently positive while intraday returns (open to close) are persistently negative, institutions are buying into the close and passively into the open while day-traders and arbitrageurs sell the open. A stock that then closes down intraday on a day with a flat/up overnight leg gives a liquidity-provider-friendly entry because the overnight bid is sticky; the next sessions' overnight premium restores price. The constraint is mutual-fund and index flow that settles at the close and opens next day.
Killed by costs
There is something there before trading costs; after them, too little is left to count (under 0.04R a trade).
- +0.103R a trade before costs, +0.006R after the spread and the selection haircut.
42 large US stocks, 15 years
Before costs +0.103R
By trade and by day, sized to 362 rules
What the numbers say
Across 1498 laggard trades the idea made +0.103R before costs but only +0.006R after costs, far below the 2.95 bar. By market: bull −0.003R, flat +0.055R, bear −0.031R, with t values of −0.58, 0.12 and −0.36 by day. In bear markets it beat only 5% of random-date draws. The edge is eaten by costs.
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.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 997 | −0.003R | −0.05 | −0.58 · 680d | −0.043R · beats 90% | +0.072R |
| Flat | 325 | +0.055R | 0.61 | 0.12 · 194d | −0.028R · beats 90% | +0.128R |
| Bear | 176 | −0.031R | −0.25 | −0.36 · 96d | +0.134R · beats 5% | +0.213R |
| All | 1,498 | +0.006R | −0.019R | +0.096R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 11.1 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 codeHide
from decimal import Decimal
from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate
class OvernightIntradayDivergenceLong:
name = "overnight_intraday_divergence_long"
description = "Long at close after an intraday selloff on a flat/up gap, in a name with persistent positive overnight and negative intraday drift."
def __init__(self, lookback: int = 20, overnight_sum_min: float = 0.02, intraday_sum_max: float = -0.02, today_intraday_max: float = -0.01, swing_lookback: int = 10, atr_buffer: float = 0.25, min_stop_atr: float = 1.0, max_stop_atr: float = 2.5, min_rr: float = 1.6) -> None:
self._lookback = lookback
self._on_min = overnight_sum_min
self._id_max = intraday_sum_max
self._today_id_max = today_intraday_max
self._swing = swing_lookback
self._buf = atr_buffer
self._min_stop = min_stop_atr
self._max_stop = max_stop_atr
self._min_rr = min_rr
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
n = len(bars)
if n < max(60, self._lookback + 2):
return None
cur = bars[-1]
prev = bars[-2]
o = float(cur.open)
c = float(cur.close)
pc = float(prev.close)
if o <= 0 or pc <= 0 or c <= 0:
return None
on_today = o / pc - 1.0
id_today = c / o - 1.0
if on_today < 0 or id_today >= self._today_id_max:
return None
on_sum = 0.0
id_sum = 0.0
on_pos = 0
id_neg = 0
for k in range(n - self._lookback, n):
b = bars[k]
p = bars[k - 1]
bo = float(b.open)
bpc = float(p.close)
bc = float(b.close)
if bo <= 0 or bpc <= 0:
return None
r_on = bo / bpc - 1.0
r_id = bc / bo - 1.0
on_sum += r_on
id_sum += r_id
if r_on > 0:
on_pos += 1
if r_id < 0:
id_neg += 1
if on_sum <= self._on_min or id_sum >= self._id_max:
return None
atr_val = atr(bars, 14)
if atr_val is None or float(atr_val) <= 0:
return None
a = Decimal(str(atr_val))
entry = cur.close
swing_low = min(b.low for b in bars[-self._swing:])
stop = swing_low - Decimal(str(self._buf)) * a
lo_stop = entry - Decimal(str(self._max_stop)) * a
hi_stop = entry - Decimal(str(self._min_stop)) * a
if stop < lo_stop:
stop = lo_stop
if stop > hi_stop:
stop = hi_stop
risk = entry - stop
if risk <= 0 or stop <= 0:
return None
prior_high = max(b.high for b in bars[-(self._lookback + 1):-1])
target = prior_high
floor_t = entry + Decimal(str(self._min_rr)) * risk
if target < floor_t:
target = floor_t
cap_t = entry + Decimal("3") * risk
if target > cap_t:
target = cap_t
rr = (target - entry) / risk
if rr < Decimal("1.5") or target <= entry:
return None
div = on_sum - id_sum
div_score = min(40, max(0, int((div - 0.04) * 400) + 10))
cons = (on_pos + id_neg) / (2.0 * self._lookback)
cons_score = min(30, max(0, int((cons - 0.5) * 100)))
sell_score = min(15, max(0, int((-id_today - 0.01) * 500)))
vols = [float(b.volume) for b in bars[-21:-1]]
avg_vol = sum(vols) / max(len(vols), 1)
vr = float(cur.volume) / avg_vol if avg_vol > 0 else 1.0
vol_score = 15 if vr <= 1.0 else max(0, int(15 - (vr - 1.0) * 10))
strength = max(0, min(100, div_score + cons_score + sell_score + vol_score))
thesis = (
f"20d overnight sum {on_sum*100:.1f}% vs intraday sum {id_sum*100:.1f}%; today gapped {on_today*100:.1f}% "
f"then sold {id_today*100:.1f}% intraday. Sticky overnight bid (close-settled flow) expected to restore price toward prior 20d high."
)
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.
Describe it in plain words and get the same honest test in about a minute.