Skip to content
The Casebook · An idea an AI invented

Buy year-to-date losers near 52-week lows in late December

Condition: latest bar date between December 18 and December 29, year-to-date return (vs first close of the year) is below -20%, and the stock is within 8% of its 52-week low. Entry long at close. Stop 1.2x ATR(14) below close. Target 2.5x ATR(14) above close.
Why the AI thought it might work

Taxable holders dump year-to-date losers into mid-to-late December for tax-loss harvesting, a compelled and price-insensitive supply that ends at year-end. The ultimate sellers are exhausted, and prices of heavily sold losers rebound into the first days of January as supply vanishes and window dressing ends.

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

42 large US stocks, 15 years

Per trade, after costs
+0.267R

Before costs +0.370R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

Across 31 laggard trades the result was +0.267R after costs, but the evidence is thin. Bull markets showed +0.597R (t 1.36 by trade, 1.23 by day, 10 distinct days), and bear markets −0.005R. No market reached the 2.95 bar, so the result can't be told apart 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
Bull14+0.597R1.361.23 · 10d−0.281R · beats 100%−1.093R
Flat0—————
Bear17−0.005R−0.010.91 · 8d−0.004R · beats 55%+0.772R
All31+0.267R−0.129R+0.603R

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


class DecemberTaxLossExhaustionFirstFire:
    name = "december_tax_loss_exhaustion_first_fire"
    description = "First late-December bar where a YTD loser (< -20%) sits within 8% of its 52-week low; long into the January supply vacuum."

    def __init__(self, start_day: int = 18, end_day: int = 29, ytd_max: float = -0.20, near_low_pct: float = 0.08, stop_atr: float = 1.2, target_atr: float = 2.5, lookback_52w: int = 252) -> None:
        self._start_day = start_day
        self._end_day = end_day
        self._ytd_max = Decimal(str(ytd_max))
        self._near_low = Decimal(str(near_low_pct))
        self._stop_atr = Decimal(str(stop_atr))
        self._target_atr = Decimal(str(target_atr))
        self._lb = lookback_52w

    def _in_window(self, b: Bar, year: int) -> bool:
        d = b.timestamp
        return d.year == year and d.month == 12 and self._start_day <= d.day <= self._end_day

    def _qualifies(self, bars: list[Bar], i: int):
        if i < self._lb:
            return None
        cur = bars[i]
        year = cur.timestamp.year
        if not self._in_window(cur, year):
            return None
        k = i
        while k > 0 and bars[k - 1].timestamp.year == year:
            k -= 1
        if k == 0:
            return None  # cannot confirm the true first close of the year
        first_close = bars[k].close
        if first_close <= 0:
            return None
        ytd = cur.close / first_close - Decimal(1)
        if ytd >= self._ytd_max:
            return None
        low52 = min(b.low for b in bars[i - self._lb + 1:i + 1])
        if low52 <= 0:
            return None
        if cur.close > low52 * (Decimal(1) + self._near_low):
            return None
        dist = cur.close / low52 - Decimal(1)
        return ytd, dist

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < self._lb + 30:
            return None
        i = len(bars) - 1
        q = self._qualifies(bars, i)
        if q is None:
            return None
        ytd, dist = q
        year = bars[i].timestamp.year
        # Once-per-season guard: fire only on the first qualifying bar of this December window
        j = i - 1
        while j >= 0 and self._in_window(bars[j], year):
            if self._qualifies(bars, j) is not None:
                return None
            j -= 1

        atr_val = atr(bars, 14)
        if atr_val is None or atr_val <= 0:
            return None
        a = Decimal(str(atr_val))
        cur = bars[-1]
        entry = cur.close
        stop = entry - self._stop_atr * a
        target = entry + self._target_atr * a
        if stop <= 0 or not (stop < entry < target):
            return None
        risk = entry - stop
        rr = (target - entry) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength: depth of YTD loss (0-35), proximity to 52w low (0-25),
        # capitulation volume over last 10 bars vs prior 50 (0-25), close location (0-15)
        depth = float(-ytd)
        depth_score = max(0, min(35, int((depth - 0.20) / 0.40 * 35)))
        prox_score = max(0, min(25, int((1 - float(dist) / float(self._near_low)) * 25)))
        recent = bars[-10:]
        base = bars[-60:-10]
        rv = sum(float(b.volume) for b in recent) / len(recent)
        bv = sum(float(b.volume) for b in base) / max(len(base), 1)
        vol_ratio = rv / bv if bv > 0 else 1.0
        vol_score = max(0, min(25, int((vol_ratio - 1.0) * 50)))
        rng = cur.high - cur.low
        close_pos = float((cur.close - cur.low) / rng) if rng > 0 else 0.5
        close_score = max(0, min(15, int(close_pos * 15)))
        strength = max(0, min(100, depth_score + prox_score + vol_score + close_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"Tax-loss exhaustion: YTD {float(ytd)*100:.1f}%, {float(dist)*100:.1f}% above 52w low on first qualifying late-December bar; "
                f"compelled harvesting supply ends at year-end, expect January rebound. 10d/50d vol {vol_ratio:.2f}."
            ),
        )

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