Skip to content
The Casebook · An idea an AI invented

Month-turn bounce in stocks down 6% over 20 days

Fire if the latest bar is among the last 2 trading days of a month or the first 3 of the next (infer from dates). Require 20-day return <= -6%, close below the 20-SMA, and today's close above the prior close. Enter long at the latest close; stop 2 x ATR(14) below; target 3 x ATR(14) above.
Why the AI thought it might work

Payroll, pension and 401(k) inflows concentrate in the last and first trading days of the month, which are invested pro-rata into index constituents regardless of price. Stocks that have fallen furthest over the past month see the same compelled bid but start from depressed prices with lighter selling pressure, so the relative bounce is larger. Pairing the calendar window with a stock-specific drawdown gives many independent trades across names and years.

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.082R a trade), but no market clears t > 2.95 by trade and by day.
Trades on the laggards
1,042

42 large US stocks, 15 years

Per trade, after costs
+0.082R

Before costs +0.155R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

Across 1042 laggard trades the average was 0.082R after costs (0.155R before). Only bull markets approached the bar, at t 2.38 by trade and 2.01 by day; flat was −0.046R and bear 0.143R. None reached 2.95, the bar set by the 362 rules searched, so the result sits within what luck produces.

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
Bull571+0.123R2.382.01 · 291d−0.025R · beats 100%+0.289R
Flat275−0.046R−0.63−0.53 · 102d−0.056R · beats 55%+0.080R
Bear196+0.143R1.661.20 · 51d+0.121R · beats 65%+0.229R
All1,042+0.082R−0.006R+0.207R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 9.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 datetime import datetime, timedelta
import math

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


class TurnOfMonthOversoldLaggardInflowLong:
    name = "turn_of_month_oversold_laggard_inflow_long"
    description = "Turn-of-month window long in a 20-day laggard below its 20-SMA that closes up; stop 2 ATR, fixed target 3.2 ATR."

    def __init__(self, ret_lookback: int = 20, max_ret: float = -0.06, sma_len: int = 20, atr_len: int = 14, stop_atr: float = 2.0, target_atr: float = 3.2, last_days: int = 2, first_days: int = 3, require_window: bool = True, min_bars: int = 60) -> None:
        self._ret_lookback = ret_lookback
        self._max_ret = max_ret
        self._sma_len = sma_len
        self._atr_len = atr_len
        self._stop_atr = stop_atr
        self._target_atr = target_atr
        self._last_days = last_days
        self._first_days = first_days
        self._require_window = require_window
        self._min_bars = min_bars

    def _window(self, bars):
        ts = bars[-1].timestamp
        y, m = ts.year, ts.month
        # first N trading days: count trailing bars in same month
        n = 0
        for b in reversed(bars):
            if b.timestamp.year == y and b.timestamp.month == m:
                n += 1
            else:
                break
            if n > self._first_days:
                break
        if n <= self._first_days and n < len(bars):
            return "first", n
        # last N trading days: weekdays remaining after today in month (holidays ignored)
        remaining = 0
        d = ts + timedelta(days=1)
        for _ in range(10):
            if d.month != m:
                break
            if d.weekday() < 5:
                remaining += 1
            d = d + timedelta(days=1)
        if d.month == m:
            return None, 0
        if remaining <= self._last_days - 1:
            return "last", remaining
        return None, 0

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < max(self._min_bars, self._ret_lookback + 2, self._sma_len + 1):
            return None
        cur = bars[-1]
        prev = bars[-2]
        phase, _ = self._window(bars)
        in_window = phase is not None
        if self._require_window and not in_window:
            return None

        base = bars[-(self._ret_lookback + 1)].close
        if base is None or base <= 0:
            return None
        ret = float((cur.close - base) / base)
        if ret > self._max_ret:
            return None
        closes = [b.close for b in bars]
        sma_v = sma(closes, self._sma_len)
        if sma_v is None:
            return None
        sma_d = Decimal(str(sma_v))
        if cur.close >= sma_d:
            return None
        if cur.close <= prev.close:
            return None

        atr_v = atr(bars, self._atr_len)
        if atr_v is None or atr_v <= 0 or math.isnan(float(atr_v)):
            return None
        a = Decimal(str(atr_v))
        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: drawdown depth (0-40), close location (0-30), volume (0-30)
        depth_score = min(40, max(0, int((-ret - 0.06) / 0.14 * 40)))
        rng = cur.high - cur.low
        if rng <= 0:
            rng = Decimal("0.01")
        close_pos = float((cur.close - cur.low) / rng)
        close_score = min(30, max(0, int(close_pos * 30)))
        vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(vols) / max(len(vols), 1)
        vr = float(cur.volume) / max(avg_vol, 1.0)
        vol_score = min(30, max(0, int((vr - 0.8) * 30)))
        strength = max(0, min(100, depth_score + close_score + vol_score))

        win_txt = ("turn-of-month window (" + phase + " days)") if in_window else "CONTROL run outside turn-of-month window"
        thesis = (
            f"{win_txt}: down {ret * 100:.1f}% over {self._ret_lookback} days, below 20-SMA, up-close today. "
            f"Month-end/start inflows meet thinner supply in a laggard; fixed {self._target_atr} ATR target "
            f"vs {self._stop_atr} ATR stop (calendar-timed oversold reversion)."
        )
        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
Month-turn bounce in stocks down 6% over 20 days: Indistinguishable from luck · EdgeProven