Skip to content
The Casebook · An idea an AI invented

Long dip-buy the Monday after monthly options expiry

Entry at latest close if the latest bar is the Monday immediately after the third Friday of a month, the stock closed below its 10-day SMA by at least 1.0x ATR(14) on the prior Friday, and today's close is above the prior Friday's close. Stop = entry minus 1.4x ATR(14). Target = entry plus 1.8x ATR(14).
Why the AI thought it might work

Dealers hedging near large open interest strikes dampen moves into expiration week, and once options expire (third Friday), gamma pinning is released. Stocks that drifted down during the pinned week are released the Monday after, so the following Monday and Tuesday show mean reversion in stocks sitting below their 10-day average. The third Friday is determined from dates; the stock-specific dip condition makes it independent per name.

VerdictTested Nov 22, 2026

Loses money

After costs it lost money on the stocks that decide the verdict.

  • −0.147R a trade after costs on the laggard stocks.
Trades on the laggards
343

42 large US stocks, 15 years

Per trade, after costs
−0.147R

Before costs −0.030R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks the rule averaged −0.147R a trade after costs over 343 trades; before costs it was −0.031R. Bull markets (−0.195R) and bear markets (−0.467R) were both negative, beating only 15% and 5% of random-date draws. Flat markets showed +0.235R, but only 66 trades on 18 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
Bull233−0.195R−1.95−0.26 · 82d−0.080R · beats 15%+0.211R
Flat66+0.235R1.120.58 · 18d−0.058R · beats 95%−0.242R
Bear44−0.467R−2.60−2.33 · 11d−0.105R · beats 5%−0.184R
All343−0.147R−0.079R+0.057R

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.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 datetime import datetime, timedelta
import math

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


class OpexMondayGammaReleaseDipLong:
    name = "opex_monday_gamma_release_dip_long"
    description = "Long the first session after monthly opex when the stock closed >=1 ATR below its 10-SMA on expiration day and today closes higher."

    def __init__(self, sma_len: int = 10, atr_len: int = 14, dip_atr: float = 1.0, stop_buffer_atr: float = 0.25, max_risk_atr: float = 1.15, min_risk_atr: float = 0.6, target_atr: float = 1.8, require_opex: bool = True, min_bars: int = 60) -> None:
        self._sma_len = sma_len
        self._atr_len = atr_len
        self._dip_atr = dip_atr
        self._stop_buffer_atr = stop_buffer_atr
        self._max_risk_atr = max_risk_atr
        self._min_risk_atr = min_risk_atr
        self._target_atr = target_atr
        self._require_opex = require_opex
        self._min_bars = min_bars

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

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

    def _is_post_opex_session(self, prev_d, cur_d) -> bool:
        tf = self._third_friday(cur_d.year, cur_d.month)
        # Current session is the first trading day after expiration (Monday, or Tuesday if Monday is a holiday)
        if not (cur_d > tf and (cur_d - tf).days <= 4):
            return False
        # Prior session is expiration day itself (Friday) or Thursday if Friday was a holiday (e.g. Good Friday)
        if not (prev_d <= tf and (tf - prev_d).days <= 1):
            return False
        return True

    def _is_control_session(self, prev_d, cur_d) -> bool:
        # Random-Monday control: first session of the week, prior session late in the prior week
        if cur_d.weekday() > 1:
            return False
        if prev_d.weekday() < 3:
            return False
        return 0 < (cur_d - prev_d).days <= 4

    def scan(self, ticker: str, bars: list) -> Candidate | None:
        if len(bars) < max(self._min_bars, self._sma_len + self._atr_len + 25):
            return None
        cur = bars[-1]
        prev = bars[-2]
        try:
            cur_d = self._to_date(cur.timestamp)
            prev_d = self._to_date(prev.timestamp)
        except Exception:
            return None
        if cur_d is None or prev_d is None:
            return None

        if self._require_opex:
            if not self._is_post_opex_session(prev_d, cur_d):
                return None
        else:
            if not self._is_control_session(prev_d, cur_d):
                return None

        prior_bars = bars[:-1]
        prior_closes = [b.close for b in prior_bars]
        sma_prev = sma(prior_closes, self._sma_len)
        atr_prev = atr(prior_bars, self._atr_len)
        if sma_prev is None or atr_prev is None:
            return None
        sma_prev_d = Decimal(str(sma_prev))
        atr_prev_d = Decimal(str(atr_prev))
        if atr_prev_d <= 0:
            return None

        dip = sma_prev_d - prev.close
        dip_atr = dip / atr_prev_d
        if dip_atr < Decimal(str(self._dip_atr)):
            return None

        if cur.close <= prev.close:
            return None

        atr_now = atr(bars, self._atr_len)
        if atr_now is None or atr_now <= 0:
            return None
        atr_d = Decimal(str(atr_now))

        entry = cur.close
        swing_low = min(cur.low, prev.low)
        struct_stop = swing_low - Decimal(str(self._stop_buffer_atr)) * atr_d
        max_risk = Decimal(str(self._max_risk_atr)) * atr_d
        min_risk = Decimal(str(self._min_risk_atr)) * atr_d
        risk = entry - struct_stop
        if risk > max_risk:
            risk = max_risk
        if risk < min_risk:
            risk = min_risk
        stop = entry - risk
        if stop <= 0 or risk <= 0:
            return None
        target = entry + Decimal(str(self._target_atr)) * atr_d
        if not (stop < entry < target):
            return None
        rr = (target - entry) / risk
        if rr <= Decimal("1.5"):
            return None

        # Strength: dip depth (0-40), close location (0-30), reversal size vs ATR (0-15), volume (0-15)
        depth_score = int(max(0.0, min(40.0, (float(dip_atr) - self._dip_atr) * 40.0 + 15.0)))
        rng = cur.high - cur.low
        if rng <= 0:
            close_pos = 0.5
        else:
            close_pos = float((cur.close - cur.low) / rng)
        close_score = int(max(0.0, min(30.0, close_pos * 30.0)))
        rev = float((cur.close - prev.close) / atr_d)
        rev_score = int(max(0.0, min(15.0, rev * 20.0)))
        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 = int(max(0.0, min(15.0, (vr - 0.8) * 25.0)))
        strength = max(0, min(100, depth_score + close_score + rev_score + vol_score))

        mode = "post-opex" if self._require_opex else "CONTROL random-Monday"
        thesis = (
            f"[{mode}] Expiration-day close sat {float(dip_atr):.2f} ATR below the {self._sma_len}-SMA, "
            f"consistent with a hedging-dampened drift. Today closed above that level, "
            f"suggesting reversion now that the pin is released. Stop is under the 2-day low, capped at {self._max_risk_atr} ATR; "
            f"target is +{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=strength,
            thesis=thesis,
            asset_class="equity",
        )

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 dip-buy the Monday after monthly options expiry: Loses money · EdgeProven