Skip to content
The Casebook · An idea an AI invented

Post-OpEx Tuesday long on stretched dip below 20-day average

Fire on the Tuesday after the third Friday of any month if the close is at least 1.5 ATR(14) below the 20-day SMA and the prior 5-day net change is negative. Enter long at close. Stop 1.5x ATR below; target at the 20-day SMA (but at least 1.2x ATR above entry).
Why the AI thought it might work

Monthly OpEx week suppresses single-stock moves via dealer hedging, then releases them. Stocks pinned below their 20-day mean through the expiration cycle snap back toward it once the options open interest rolls off, as dealers no longer need to sell into strength or buy into weakness.

VerdictTested Nov 22, 2026

Killed by costs

There is something there before trading costs; after them, too little is left to count (under 0.04R a trade).

  • +0.116R a trade before costs, +0.028R after the spread and the selection haircut.
Trades on the laggards
283

42 large US stocks, 15 years

Per trade, after costs
+0.028R

Before costs +0.116R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

Across 283 laggard trades, the result was 0.116R per trade before costs and 0.028 after costs, so the edge shrinks to almost nothing once costs are paid. It was −0.044 in bull markets and −0.337 in flat markets; only bear markets were positive, at 0.553, from 63 trades on 13 distinct days.

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
Bull161−0.044R−0.391.32 · 73d−0.082R · beats 65%−0.042R
Flat59−0.337R−2.00−0.69 · 18d+0.009R · beats 0%−0.077R
Bear63+0.553R3.060.27 · 13d+0.137R · beats 95%+0.506R
All283+0.028R−0.015R+0.113R

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

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


class SecondDayAfterExpiryBounceLong:
    name = "second_day_after_expiry_bounce_long"
    description = "Second session after monthly OpEx: long names pinned >=1.5 ATR below the 20-SMA after a down week, targeting the SMA."

    def __init__(self, atr_period: int = 14, sma_period: int = 20, min_atr_below: float = 1.5, stop_atr: float = 1.5, min_target_atr: float = 1.2, min_rr: float = 1.55, calendar_gate: bool = True, min_bars: int = 60) -> None:
        self._atr_period = atr_period
        self._sma_period = sma_period
        self._min_atr_below = min_atr_below
        self._stop_atr = stop_atr
        self._min_target_atr = min_target_atr
        self._min_rr = min_rr
        self._calendar_gate = calendar_gate
        self._min_bars = min_bars

    @staticmethod
    def _date(b: Bar) -> datetime:
        ts = b.timestamp
        return datetime(ts.year, ts.month, ts.day)

    @staticmethod
    def _third_friday(year: int, month: int) -> datetime:
        first = datetime(year, month, 1)
        offset = (4 - first.weekday()) % 7
        return first + timedelta(days=offset + 14)

    def _expiry_if_second_day(self, bars: list) -> datetime | None:
        t = self._date(bars[-1])
        fri = self._third_friday(t.year, t.month)
        if not (fri < t <= fri + timedelta(days=6)):
            return None
        prev = self._date(bars[-2])
        prev2 = self._date(bars[-3])
        if prev > fri and prev2 <= fri:
            return fri
        return None

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < max(self._min_bars, self._sma_period + 10, self._atr_period + 10):
            return None

        expiry = None
        if self._calendar_gate:
            expiry = self._expiry_if_second_day(bars)
            if expiry is None:
                return None

        current = bars[-1]
        closes = [b.close for b in bars]
        sma_val = sma(closes, self._sma_period)
        atr_val = atr(bars, self._atr_period)
        if sma_val is None or atr_val is None or atr_val <= 0:
            return None
        sma_dec = Decimal(str(sma_val))
        atr_dec = Decimal(str(atr_val))

        entry = current.close
        dist_atr = float((sma_dec - entry) / atr_dec)
        if dist_atr < self._min_atr_below:
            return None

        five_day_change = entry - bars[-6].close
        if five_day_change >= 0:
            return None

        stop = entry - Decimal(str(self._stop_atr)) * atr_dec
        if stop <= 0:
            return None
        target = max(sma_dec, entry + Decimal(str(self._min_target_atr)) * atr_dec)
        risk = entry - stop
        reward = target - entry
        if risk <= 0 or reward <= 0:
            return None
        rr = reward / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        # Depth beyond the threshold, 0-35
        depth_score = int(max(0.0, min(35.0, (dist_atr - self._min_atr_below) / 1.5 * 35.0)))

        # OpEx-week pin evidence, 0-30: compressed ranges during the expiry week
        pin_score = 10
        pin_ratio = None
        if expiry is not None:
            wk_start = expiry - timedelta(days=4)
            wk = [b for b in bars[-12:-2] if wk_start <= self._date(b) <= expiry]
            if len(wk) >= 3:
                avg_rng = sum(float(b.high - b.low) for b in wk) / len(wk)
                pin_ratio = avg_rng / float(atr_dec)
                pin_score = int(max(0.0, min(30.0, (1.1 - pin_ratio) / 0.5 * 30.0)))

        # Close strength today, 0-20
        rng = current.high - current.low
        close_pos = float((current.close - current.low) / rng) if rng > 0 else 0.5
        close_score = int(max(0.0, min(20.0, close_pos * 20.0)))

        # Down-week magnitude, 0-15
        drop_atr = float(-five_day_change / atr_dec)
        drop_score = int(max(0.0, min(15.0, drop_atr / 3.0 * 15.0)))

        strength = max(0, min(100, depth_score + pin_score + close_score + drop_score))

        pin_txt = f"OpEx-week range/ATR {pin_ratio:.2f}" if pin_ratio is not None else "no OpEx gate (baseline mode)"
        timing = "second session after monthly OpEx" if expiry is not None else "ungated oversold baseline"
        thesis = (
            f"{timing}: close {dist_atr:.2f} ATR below 20-SMA after a down week; "
            f"{pin_txt}. Dealer-hedging pin released as expiring OI rolls off -> "
            f"reversion toward the 20-SMA. Stop {self._stop_atr} ATR (spec), target at the SMA."
        )

        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,
        )

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
Post-OpEx Tuesday long on stretched dip below 20-day average: Killed by costs · EdgeProven