Skip to content
The Casebook · An idea an AI invented

Breakout above a 250-day high, twice tested, on volume

Latest close > highest high of the previous 250 bars, which itself was set at least 20 bars ago; volume > 1.3x 20-day average; at least 2 prior touches within 3% of that high in the last 120 bars. Enter long at close. Stop = entry - 2.0*ATR(14). Target = entry + 4.0*ATR(14).
Why the AI thought it might work

Investors anchor to the 52-week high and are reluctant to bid above it; when price finally clears it on volume, the anchoring constraint releases and underreaction to good news produces drift. Distinct from tight consolidation (already failed) because it requires an actual close above a long-standing 52-week high that had been tested at least twice.

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

42 large US stocks, 15 years

Per trade, after costs
+0.226R

Before costs +0.308R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggards, 33 trades averaged +0.226R after costs. The gain came from bull markets (+0.393R over 27 trades, t 1.60), which beat 100% of random-date draws. Flat markets (5 trades) averaged −0.414R and the single bear trade lost −1.059R. No market reached the t of 2.95 needed, so luck is not ruled out.

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
Bull27+0.393R1.601.60 · 27d−0.036R · beats 100%+0.399R
Flat5−0.414R−0.69−0.69 · 5d+0.103R · beats 25%+0.874R
Bear1−1.059R—— · 1d+0.187R · beats 0%−1.292R
All33+0.226R−0.008R+0.422R

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.4 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 Week52HighAnchorBreakLong:
    name = "week52_high_anchor_break_long"
    description = "Volume-confirmed close above an aged 52-week high that was re-tested in 2+ distinct episodes after it formed"

    def __init__(self, high_lookback: int = 250, min_high_age: int = 20, touch_window: int = 120,
                 touch_pct: float = 0.03, min_touches: int = 2, episode_buffer: int = 5,
                 recent_exclude: int = 5, min_gap_bars: int = 3, vol_mult: float = 1.3,
                 stop_atr: float = 2.0, target_atr: float = 4.0, max_extension_atr: float = 1.5) -> None:
        self._lb = high_lookback
        self._min_age = min_high_age
        self._tw = touch_window
        self._tp = touch_pct
        self._min_touches = min_touches
        self._ep_buf = episode_buffer
        self._recent_ex = recent_exclude
        self._gap = min_gap_bars
        self._vol_mult = vol_mult
        self._stop_atr = stop_atr
        self._target_atr = target_atr
        self._max_ext = max_extension_atr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < max(self._lb + 2, 222):
            return None
        last = n - 1
        cur = bars[last]
        close = float(cur.close)
        if close <= 0:
            return None

        # 52-week high over the previous 250 bars (current bar excluded)
        start = last - self._lb
        high_val = None
        high_idx = -1
        for i in range(start, last):
            h = float(bars[i].high)
            if high_val is None or h >= high_val:
                high_val = h
                high_idx = i  # most recent occurrence of the max
        if high_val is None or high_val <= 0:
            return None
        if close <= high_val:
            return None
        if last - high_idx < self._min_age:
            return None

        # Trend filter for the bull regime
        closes = [float(b.close) for b in bars]
        sma200 = sma(closes, 200)
        if sma200 is None or close < float(sma200):
            return None

        atr_val = atr(bars, 14)
        if atr_val is None or float(atr_val) <= 0:
            return None
        a = float(atr_val)

        # Skip chasing breakouts that are already too extended
        if close - high_val > self._max_ext * a:
            return None

        # Volume confirmation against the prior 20 bars
        prior_vols = [float(b.volume) for b in bars[last - 20:last]]
        avg_vol = sum(prior_vols) / 20.0
        if avg_vol <= 0:
            return None
        vol_ratio = float(cur.volume) / avg_vol
        if vol_ratio < self._vol_mult:
            return None

        # Close strength: close in the upper half of the day's range
        rng = float(cur.high) - float(cur.low)
        close_pos = (close - float(cur.low)) / rng if rng > 0 else 1.0
        if close_pos < 0.5:
            return None

        # ---- Touch counting ----
        # The window only contains bars AFTER the high's own episode,
        # so the high itself and its formation cannot count as tests.
        thresh = high_val * (1.0 - self._tp)
        win_start = max(high_idx + self._ep_buf + 1, last - self._tw)

        # Exclude the final pre-break approach: at least recent_exclude bars,
        # extended back through any contiguous run of bars near the high.
        win_end = last - self._recent_ex  # exclusive
        j = last - 1
        while j >= win_start and float(bars[j].high) >= thresh:
            j -= 1
        win_end = min(win_end, j + 1)
        if win_end - win_start < 10:
            return None

        # Count distinct episodes. A new episode requires price to have backed
        # off below the band for at least min_gap_bars bars.
        episodes = 0
        in_ep = False
        below_run = self._gap
        for k in range(win_start, win_end):
            if float(bars[k].high) >= thresh:
                if not in_ep and below_run >= self._gap:
                    episodes += 1
                in_ep = True
                below_run = 0
            else:
                below_run += 1
                if below_run >= self._gap:
                    in_ep = False
        if episodes < self._min_touches:
            return None

        # ---- Trade plan (operator-specified ATR levels) ----
        entry = cur.close
        a_dec = Decimal(str(a))
        stop = entry - Decimal(str(self._stop_atr)) * a_dec
        target = entry + Decimal(str(self._target_atr)) * a_dec
        if stop <= 0 or not (stop < entry < target):
            return None
        risk = entry - stop
        if risk <= 0:
            return None
        rr = (target - entry) / risk
        if rr < Decimal("1.5"):
            return None

        # ---- Signal strength ----
        vol_score = min(35.0, max(0.0, (vol_ratio - 1.0) / 1.7 * 35.0))
        touch_score = min(25.0, 10.0 + (episodes - 2) * 7.5)
        close_score = max(0.0, min(20.0, (close_pos - 0.5) * 40.0))
        age = last - high_idx
        age_score = min(10.0, age / 120.0 * 10.0)
        trend_gap = (close - float(sma200)) / float(sma200)
        trend_score = max(0.0, min(10.0, trend_gap * 50.0))
        strength = int(max(0, min(100, round(vol_score + touch_score + close_score + age_score + trend_score))))

        thesis = (
            f"Closed {((close / high_val) - 1) * 100:.1f}% above a {age}-bar-old 52-week high "
            f"({high_val:.2f}) that was re-tested in {episodes} distinct episodes, on {vol_ratio:.1f}x volume. "
            "Anchoring supply at the high has been absorbed; expect underreaction drift."
        )

        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
Breakout above a 250-day high, twice tested, on volume: Indistinguishable from luck · EdgeProven