Skip to content
The Casebook · An idea an AI invented

Third-Friday strong close above 50-day average, long

Fire on the third Friday of any month if the close is in the top 25% of the day's range and above the prior close by at least 0.5 ATR(14), and the stock is above its 50-day SMA. Enter long at close. Stop 1.5x ATR below; target 2x ATR above.
Why the AI thought it might work

On monthly expiration Friday, dealer hedges unwind and stocks closing in the top of their range after being pinned reflect released buying pressure. Residual demand from re-established positions continues into the next session as the new options cycle begins.

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

42 large US stocks, 15 years

Per trade, after costs
+0.041R

Before costs +0.151R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggards, 145 trades averaged +0.041R after costs, but no market reached the 2.95 t bar: bull showed t 0.15 by trade and −0.49 by day, flat 0.24 and 0.26. Bear's 0.634R rests on 3 trades (t 0.70). The 20 winners averaged −0.119R, so the edge 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
Bull123+0.020R0.15−0.49 · 63d−0.086R · beats 75%−0.077R
Flat19+0.079R0.240.26 · 9d−0.035R · beats 55%−0.442R
Bear3+0.634R0.700.70 · 3d−0.105R · beats 70%+0.530R
All145+0.041R−0.080R−0.119R

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.3 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 core.domain import Bar
from strategies.indicators import atr, sma
from scanners.base import Candidate


class OpexPinReleaseCloseLong:
    name = "opex_pin_release_close_long"
    description = "Third-Friday opex: strong close releasing from a compressed pre-expiry range, above 50-SMA; tight structural stop, near 1.6R target."

    def __init__(self, atr_period: int = 14, trend_period: int = 50, thrust_atr: float = 0.5, close_pos_min: float = 0.75, pin_lookback: int = 3, pin_max_range_atr: float = 0.95, min_vol_ratio: float = 1.0, stop_buffer_atr: float = 0.25, max_risk_atr: float = 1.5, min_risk_atr: float = 0.6, reward_mult: float = 1.6) -> None:
        self._atr_period = atr_period
        self._trend_period = trend_period
        self._thrust_atr = Decimal(str(thrust_atr))
        self._close_pos_min = close_pos_min
        self._pin_lookback = pin_lookback
        self._pin_max_range_atr = pin_max_range_atr
        self._min_vol_ratio = min_vol_ratio
        self._stop_buffer_atr = Decimal(str(stop_buffer_atr))
        self._max_risk_atr = Decimal(str(max_risk_atr))
        self._min_risk_atr = Decimal(str(min_risk_atr))
        self._reward_mult = Decimal(str(reward_mult))

    @staticmethod
    def _is_third_friday(ts) -> bool:
        try:
            return ts.weekday() == 4 and 15 <= ts.day <= 21
        except Exception:
            return False

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < max(self._trend_period, 30) + 10:
            return None
        current = bars[-1]
        prev = bars[-2]
        if not self._is_third_friday(current.timestamp):
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None or atr_val <= 0:
            return None
        atr_dec = Decimal(str(atr_val))

        # Trend filter
        sma_val = sma([b.close for b in bars], self._trend_period)
        if sma_val is None:
            return None
        sma_dec = Decimal(str(sma_val))
        if current.close <= sma_dec:
            return None

        # Thrust vs prior close
        thrust = current.close - prev.close
        if thrust < self._thrust_atr * atr_dec:
            return None

        # Close in top of range
        rng = current.high - current.low
        if rng <= 0:
            return None
        close_pos = float((current.close - current.low) / rng)
        if close_pos < self._close_pos_min:
            return None

        # Pin signature: compressed realized range in the sessions before expiry
        pin_window = bars[-(self._pin_lookback + 1):-1]
        if len(pin_window) < self._pin_lookback:
            return None
        pin_avg_range = sum(float(b.high - b.low) for b in pin_window) / len(pin_window)
        pin_ratio = pin_avg_range / float(atr_dec)
        if pin_ratio > self._pin_max_range_atr:
            return None
        pin_high = max(b.high for b in pin_window)

        # Expiration-level participation
        vol_window = bars[-21:-1]
        avg_vol = sum(float(b.volume) for b in vol_window) / len(vol_window)
        if avg_vol <= 0:
            return None
        vol_ratio = float(current.volume) / avg_vol
        if vol_ratio < self._min_vol_ratio:
            return None

        # Structural stop: below the expiration-day low, clamped in ATR terms
        entry = current.close
        stop = current.low - self._stop_buffer_atr * atr_dec
        floor_stop = entry - self._max_risk_atr * atr_dec
        if stop < floor_stop:
            stop = floor_stop
        ceil_stop = entry - self._min_risk_atr * atr_dec
        if stop > ceil_stop:
            stop = ceil_stop
        risk = entry - stop
        if risk <= 0 or stop <= 0:
            return None
        target = entry + self._reward_mult * risk
        rr = (target - entry) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength: pin tightness, release decisiveness, volume, close position
        pin_score = max(0.0, min(30.0, (self._pin_max_range_atr - pin_ratio) / max(self._pin_max_range_atr - 0.4, 0.05) * 30.0))
        thrust_atr = float(thrust / atr_dec)
        release_score = max(0.0, min(20.0, (thrust_atr - 0.5) * 20.0))
        if current.close > pin_high:
            release_score = min(30.0, release_score + 10.0)
        vol_score = max(0.0, min(25.0, (vol_ratio - 1.0) * 25.0))
        close_score = max(0.0, min(15.0, (close_pos - 0.75) / 0.25 * 15.0))
        strength = int(max(0, min(100, round(pin_score + release_score + vol_score + close_score))))

        thesis = (
            f"Monthly opex Friday: after a pinned pre-expiry range ({pin_ratio:.2f}x ATR over {self._pin_lookback} sessions), "
            f"closed +{thrust_atr:.2f} ATR in the top {int((1 - close_pos) * 100)}% of range on {vol_ratio:.1f}x volume above the {self._trend_period}-SMA; "
            f"hedge roll-off releases demand expected to carry into the new cycle. Stop under expiry-day low, near 1.6R target for a short hold."
        )

        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