Skip to content
The Casebook · An idea an AI invented

Rising swing lows near highs, 3-ATR target

Find last 3 swing lows (lowest low among 5-bar windows) spaced at least 5 bars apart, each higher than the previous. Price is above 50-day SMA and close is within 5% of the highest high of the last 30 bars. Today's close > prior close. Long at close. Stop = most recent swing low minus 0.3*ATR(14). Target = entry + 3*ATR(14).
Why the AI thought it might work

Rising successive swing lows while price is below resistance show buyers stepping in at progressively higher prices; institutions accumulating a position must scale in over weeks, creating persistent demand that does not chase price. Break of the shelf tends to follow as supply is absorbed.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.209R a trade after costs on the laggard stocks.
Trades on the laggards
3,030

42 large US stocks, 15 years

Per trade, after costs
−0.209R

Before costs −0.060R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggard stocks, 3030 trades averaged −0.209R after costs (−0.060R before costs). Results were negative in bull (−0.156R), flat (−0.447R) and bear (−0.256R) markets, and in each the idea beat only 30%, 0% and 10% of random-date draws. The 20 winners averaged 0.076R, but the laggards decide the verdict.

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
Bull2,372−0.156R−4.09−3.46 · 1,312d−0.125R · beats 30%+0.039R
Flat507−0.447R−5.68−4.98 · 298d−0.086R · beats 0%+0.274R
Bear151−0.256R−1.62−1.00 · 87d−0.110R · beats 10%−0.050R
All3,030−0.209R−0.118R+0.076R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 12.7 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 HigherLowSequenceAccumulationLong:
    name = "higher_low_sequence_accumulation_long"
    description = "Three rising confirmed swing lows under a nearby 30-bar high, above the 50-SMA, with an up close: accumulation before a shelf break."

    def __init__(self, swing_half: int = 2, min_spacing: int = 5, lookback: int = 90, sma_len: int = 50, high_lookback: int = 30, near_high_pct: float = 0.05, atr_len: int = 14, stop_atr: float = 0.3, target_atr: float = 3.0, min_rr: float = 1.55) -> None:
        self._h = swing_half
        self._spacing = min_spacing
        self._lookback = lookback
        self._sma_len = sma_len
        self._high_lb = high_lookback
        self._near = near_high_pct
        self._atr_len = atr_len
        self._stop_atr = stop_atr
        self._target_atr = target_atr
        self._min_rr = min_rr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < max(self._sma_len, self._lookback) + 20:
            return None
        cur = bars[-1]
        prev = bars[-2]
        if cur.close <= prev.close:
            return None

        closes = [float(b.close) for b in bars]
        sma_v = sma(closes, self._sma_len)
        if sma_v is None or closes[-1] <= float(sma_v):
            return None

        hh = max(float(b.high) for b in bars[-self._high_lb:])
        if hh <= 0 or closes[-1] < hh * (1.0 - self._near):
            return None

        lows = [float(b.low) for b in bars]
        h = self._h
        swings = []
        i = n - 1 - h
        start = max(h, n - self._lookback)
        while i >= start and len(swings) < 3:
            li = lows[i]
            window = lows[i - h:i + h + 1]
            if li == min(window) and all(lows[j] > li for j in range(i - h, i)):
                if not swings or swings[-1] - i >= self._spacing:
                    swings.append(i)
            i -= 1
        if len(swings) < 3:
            return None
        c_idx, b_idx, a_idx = swings[0], swings[1], swings[2]
        l1, l2, l3 = lows[a_idx], lows[b_idx], lows[c_idx]
        if not (l1 < l2 < l3):
            return None

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

        entry = cur.close
        stop = Decimal(str(bars[c_idx].low)) - Decimal(str(self._stop_atr)) * atr_dec
        risk = entry - stop
        if risk <= 0:
            return None
        target = entry + Decimal(str(self._target_atr)) * atr_dec
        if target <= entry:
            return None
        rr = (target - entry) / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        rise = ((l2 - l1) + (l3 - l2)) / atr_f
        trend_score = min(35, max(0, int(rise * 12)))
        dist = (hh - closes[-1]) / (hh * self._near)
        prox_score = min(30, max(0, int((1.0 - dist) * 30)))
        vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(vols) / max(len(vols), 1)
        vol_ratio = float(cur.volume) / max(avg_vol, 1.0)
        vol_score = min(20, max(0, int((vol_ratio - 0.5) * 20)))
        rng = float(cur.high - cur.low)
        close_pos = (float(cur.close) - float(cur.low)) / rng if rng > 0 else 0.5
        close_score = min(15, max(0, int(close_pos * 15)))
        strength = max(0, min(100, trend_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"Three rising swing lows ({l1:.2f} < {l2:.2f} < {l3:.2f}) under a 30-bar high of {hh:.2f}, "
                f"above the 50-SMA, with an up close: accumulation absorbing supply ahead of a shelf break. "
                f"Stop below the latest swing low; target is 3 ATR."
            ),
        )

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
Rising swing lows near highs, 3-ATR target: Loses money · EdgeProven