Skip to content
The Casebook · An idea an AI invented

Long after monthly expiry in stocks down three weeks

Fire on the trading day after the third Friday of any month (second business day after expiration Friday inclusive of Monday). Require that each of the last 3 weekly closes was lower than the preceding weekly close and the stock is more than 8% below its 50-SMA. 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

Into monthly options expiration, dealers who sold calls and bought puts delta-hedge and market-maker positioning in heavily shorted, falling stocks tends to unwind as strikes expire, producing a bid in the days right after expiration Friday. Stocks that fell for 3 straight weeks have accumulated put open interest that rolls off at expiry, removing the downward hedging flow and allowing price to rebound. The date of the third Friday is visible and the decline filter makes it stock-specific.

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

42 large US stocks, 15 years

Per trade, after costs
+0.548R

Before costs +0.655R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On 139 laggard trades the average is +0.548R after costs. Bull is +0.471R (t by day 1.18), flat +0.143R, bear +0.835R (t by day 0.99). None reaches the 2.95 bar by trade and by day, 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
Bull66+0.471R1.581.18 · 45d−0.104R · beats 95%+0.220R
Flat23+0.143R0.32−0.37 · 13d−0.089R · beats 80%−0.562R
Bear50+0.835R2.370.99 · 11d+0.168R · beats 100%+1.557R
All139+0.548R−0.004R+0.740R

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.4 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, lowest_low
from scanners.base import Candidate


class ThreeWeekDeclineOpexReboundLong:
    name = "three_week_decline_opex_rebound_long"
    description = "First session after monthly OPEX, 3 lower weekly closes, >8% below 50-SMA: buy the hedge-unwind rebound (with non-OPEX control modes)."

    def __init__(self, sma_period: int = 50, min_below_sma_pct: float = 0.08, weeks_down: int = 3, atr_period: int = 14, stop_atr_cap: float = 2.0, target_atr: float = 3.0, swing_lookback: int = 10, swing_buffer_atr: float = 0.25, min_rr: float = 1.6, calendar_mode: str = "opex") -> None:
        self._sma_period = sma_period
        self._min_below = min_below_sma_pct
        self._weeks_down = weeks_down
        self._atr_period = atr_period
        self._stop_cap = stop_atr_cap
        self._target_atr = target_atr
        self._swing_lb = swing_lookback
        self._swing_buf = swing_buffer_atr
        self._min_rr = min_rr
        self._mode = calendar_mode

    @staticmethod
    def _to_date(ts):
        if isinstance(ts, datetime):
            return ts.date()
        return ts

    @staticmethod
    def _nth_friday(y: int, m: int, n: int):
        wd = datetime(y, m, 1).weekday()
        first_fri = 1 + (4 - wd) % 7
        return datetime(y, m, first_fri + 7 * (n - 1)).date()

    def _calendar_ok(self, prev_d, today_d) -> bool:
        if self._mode == "any_day":
            return True
        n = 1 if self._mode == "control_first_friday" else 3
        anchor = self._nth_friday(today_d.year, today_d.month, n)
        # first trading session strictly after the anchor Friday
        return prev_d <= anchor < today_d and (today_d - anchor).days <= 6

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        need = max(self._sma_period + 10, 80)
        if len(bars) < need:
            return None
        current = bars[-1]
        today_d = self._to_date(current.timestamp)
        prev_d = self._to_date(bars[-2].timestamp)
        if not self._calendar_ok(prev_d, today_d):
            return None

        # Completed weekly closes (exclude the current, in-progress week)
        today_key = today_d.isocalendar()[:2]
        weekly = []
        last_key = None
        for b in bars[-60:-1]:
            k = self._to_date(b.timestamp).isocalendar()[:2]
            if k == today_key:
                continue
            if k != last_key:
                weekly.append(b.close)
                last_key = k
            else:
                weekly[-1] = b.close
        if len(weekly) < self._weeks_down + 1:
            return None
        tail = weekly[-(self._weeks_down + 1):]
        for i in range(1, len(tail)):
            if not tail[i] < tail[i - 1]:
                return None

        closes = [b.close for b in bars]
        sma_v = sma(closes, self._sma_period)
        if sma_v is None or sma_v <= 0:
            return None
        sma_d = Decimal(str(sma_v))
        below_pct = float((sma_d - current.close) / sma_d)
        if below_pct <= self._min_below:
            return None

        atr_v = atr(bars, self._atr_period)
        if atr_v is None or atr_v <= 0:
            return None
        atr_d = Decimal(str(atr_v))
        entry = current.close

        # Stop: recent swing low minus small buffer, capped at 2 ATR from entry
        swing_low = min(b.low for b in bars[-self._swing_lb:])
        structural_stop = swing_low - Decimal(str(self._swing_buf)) * atr_d
        cap_stop = entry - Decimal(str(self._stop_cap)) * atr_d
        stop = max(structural_stop, cap_stop)
        if stop >= entry or stop <= 0:
            return None
        risk = entry - stop
        if risk < atr_d * Decimal("0.5"):
            stop = entry - atr_d * Decimal("0.5")
            risk = entry - stop
        target = entry + Decimal(str(self._target_atr)) * atr_d
        min_rr_d = Decimal(str(self._min_rr))
        if (target - entry) / risk < min_rr_d:
            target = entry + min_rr_d * risk
        # do not aim past the 50-SMA reversion magnet by more than 1 ATR
        if target > sma_d + atr_d and (sma_d + atr_d - entry) / risk >= min_rr_d:
            target = sma_d + atr_d
        rr = (target - entry) / risk
        if rr <= Decimal("1.5"):
            return None

        # Strength components
        depth_score = min(35, max(0, int((below_pct - self._min_below) * 350)))
        decline = float((tail[0] - tail[-1]) / tail[0]) if tail[0] > 0 else 0.0
        decline_score = min(30, max(0, int(decline * 150)))
        rng = current.high - current.low
        close_pos = float((current.close - current.low) / rng) if rng > 0 else 0.5
        close_score = min(20, max(0, int(close_pos * 20)))
        prior = bars[-21:-1]
        avg_vol = sum(float(b.volume) for b in prior) / len(prior)
        vol_ratio = float(current.volume) / max(avg_vol, 1.0)
        vol_score = min(15, max(0, int((vol_ratio - 0.8) * 15)))
        strength = max(0, min(100, depth_score + decline_score + close_score + vol_score))

        return Candidate(
            ticker=ticker,
            side="buy",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=strength,
            thesis=(f"[{self._mode}] {self._weeks_down} straight lower weekly closes ({decline:.1%}) and "
                    f"{below_pct:.1%} below 50-SMA. On the first session after the calendar anchor, put-hedge "
                    f"unwind should lift price. Compare against the control modes to isolate the OPEX effect."),
        )

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
Long after monthly expiry in stocks down three weeks: Indistinguishable from luck · EdgeProven