Skip to content
The Casebook · An idea an AI invented

Buy month-end big drops, stop under low, 2 ATR target

Entry at latest close if it is the last trading day of the month, the 21-day return is below -8%, and the day's return is below -1.0*ATR(14)/close. Stop = day's low minus 0.3*ATR(14). Target = entry + 2.0*ATR(14).
Why the AI thought it might work

On the last trading day of a month, funds mark positions and some dump losers to tidy their books; close prices of stocks that fell over the month and fell again that day carry a temporary discount, which reverses as flows normalize at the start of the next month. Pairing with stock-level monthly decline keeps trades name-specific.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.087R a trade after costs on the laggard stocks.
Trades on the laggards
36

42 large US stocks, 15 years

Per trade, after costs
−0.087R

Before costs +0.005R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the laggard stocks, 36 trades averaged −0.087R after costs (about 0.005R before costs). Bull markets gave −0.088R over 25 trades and flat markets −0.177R over 6. Bear markets showed 0.025R, but from only 5 trades on 2 days, and no market type beat random dates reliably (shares beaten: 40%, 35%, 60%).

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
Bull25−0.088R−0.32−0.17 · 17d+0.022R · beats 40%−0.043R
Flat6−0.177R−0.30−1.38 · 4d−0.059R · beats 35%+0.063R
Bear5+0.025R0.02−0.57 · 2d−0.136R · beats 60%−0.142R
All36−0.087R−0.013R−0.045R

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

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


class MonthEndLoserMarkdownReversalLong:
    name = "month_end_loser_markdown_reversal_long"
    description = "Long the close of the month's last session for 21-day losers that dumped >1 ATR that day"

    def __init__(self, ret_lookback: int = 21, min_month_drop: float = -0.08, day_drop_atr: float = 1.0, atr_period: int = 14, low_buffer_atr: float = 0.3, min_risk_atr: float = 1.1, target_atr: float = 2.0, min_bars: int = 60) -> None:
        self._lb = ret_lookback
        self._min_month_drop = min_month_drop
        self._day_drop_atr = day_drop_atr
        self._atr_period = atr_period
        self._low_buffer = low_buffer_atr
        self._min_risk_atr = min_risk_atr
        self._target_atr = target_atr
        self._min_bars = min_bars

    @staticmethod
    def _is_memorial_day(d) -> bool:
        # last Monday of May
        return d.month == 5 and d.weekday() == 0 and d.day + 7 > 31

    def _is_last_session_of_month(self, d) -> bool:
        nxt = d + timedelta(days=1)
        # skip weekends and Memorial Day (the only common month-end holiday)
        for _ in range(7):
            if nxt.weekday() >= 5 or self._is_memorial_day(nxt):
                nxt = nxt + timedelta(days=1)
                continue
            break
        return nxt.month != d.month

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < max(self._min_bars, self._lb + self._atr_period + 2):
            return None
        cur = bars[-1]
        prev = bars[-2]
        try:
            d = cur.timestamp
            if not self._is_last_session_of_month(d):
                return None
        except Exception:
            return None

        close = cur.close
        if close <= 0 or prev.close <= 0:
            return None
        base = bars[-(self._lb + 1)].close
        if base <= 0:
            return None
        month_ret = float(close / base) - 1.0
        if month_ret >= self._min_month_drop:
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None:
            return None
        atr_f = float(atr_val)
        if not math.isfinite(atr_f) or atr_f <= 0:
            return None
        atr_dec = Decimal(str(atr_f))
        day_ret = float(close / prev.close) - 1.0
        thresh = -self._day_drop_atr * atr_f / float(close)
        if day_ret >= thresh:
            return None

        entry = close
        # Stop: under the day's low with a buffer, but never tighter than min_risk_atr below entry
        stop_struct = cur.low - Decimal(str(self._low_buffer)) * atr_dec
        stop_floor = entry - Decimal(str(self._min_risk_atr)) * atr_dec
        stop = min(stop_struct, stop_floor)
        if stop <= 0:
            return None
        target = entry + Decimal(str(self._target_atr)) * atr_dec
        risk = entry - stop
        if risk <= 0 or target <= entry:
            return None
        rr = (target - entry) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength: monthly decline depth, day dump size in ATRs, volume surge
        month_score = min(35, max(0, int((-month_ret - 0.08) / 0.17 * 35)))
        dump_atr = (-day_ret * float(close)) / atr_f
        dump_score = min(35, max(0, int((dump_atr - 1.0) / 1.5 * 35)))
        vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        vr = float(cur.volume) / avg_vol if avg_vol > 0 else 1.0
        vol_score = min(30, max(0, int((vr - 0.8) / 1.2 * 30)))
        strength = max(0, min(100, month_score + dump_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"Month-end markdown: last session of the month, 21d return {month_ret*100:.1f}%, day drop {dump_atr:.2f} ATR on {vr:.1f}x volume; "
                    f"expect window-dressing discount to reverse as new-month flows normalize."),
            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
Buy month-end big drops, stop under low, 2 ATR target: Loses money · EdgeProven