Skip to content
The Casebook · An idea an AI invented

Short after an up-streak and inside bar in a falling 200-day

Entry short at latest close if the 200-day SMA is falling, the stock rose in at least 4 of the last 5 days, yesterday was an inside bar (range within the prior bar's range), and today's close is below yesterday's low. Stop above the 5-day high. Target 2.5 ATR below.
Why the AI thought it might work

After an up-streak bounce in a downtrending stock, trapped buyers have bought into resistance; an inside bar shows buyers cannot extend, and the break of the inside bar low triggers their stops and fresh short sales by momentum funds that wait for confirmation.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.094R a trade after costs on the laggard stocks.
Trades on the laggards
101

42 large US stocks, 15 years

Per trade, after costs
−0.094R

Before costs +0.019R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggards, 101 trades averaged −0.094R after costs (0.019R before costs), and the winners fared worse at −0.388R. In bull markets the result was −0.148R, with only 45% of random-date draws beaten; the flat-market gain of 0.235R rests on 11 trades. The verdict follows from the negative result after costs.

How it was tested

The rule as written, coded once, run on every stock the same way.

Side
Short
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
Bull74−0.148R−0.79−0.83 · 73d−0.119R · beats 45%−0.450R
Flat11+0.235R0.500.49 · 10d−0.115R · beats 80%−0.112R
Bear16−0.074R−0.180.30 · 12d−0.047R · beats 45%−0.811R
All101−0.094R−0.107R−0.388R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 10.8 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 PostStreakInsideBarBreakdownShort:
    name = "post_streak_inside_bar_breakdown_short"
    description = "Falling 200-SMA, 4-of-5 up days, inside bar, then close below the inside bar low: short the failed bounce."

    def __init__(self, sma_len: int = 200, slope_lookback: int = 10, streak_window: int = 5,
                 min_up_days: int = 4, stop_lookback: int = 5, stop_buffer_atr: float = 0.1,
                 target_atr: float = 2.5, atr_len: int = 14) -> None:
        self._sma_len = sma_len
        self._slope_lb = slope_lookback
        self._streak_window = streak_window
        self._min_up = min_up_days
        self._stop_lb = stop_lookback
        self._stop_buf = stop_buffer_atr
        self._target_atr = target_atr
        self._atr_len = atr_len

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        need = self._sma_len + self._slope_lb + 10
        if len(bars) < need:
            return None
        cur = bars[-1]
        ib = bars[-2]
        mother = bars[-3]

        # 1) Falling 200-day SMA
        closes = [b.close for b in bars]
        sma_now = sma(closes, self._sma_len)
        sma_prev = sma(closes[:-self._slope_lb], self._sma_len)
        if sma_now is None or sma_prev is None:
            return None
        sma_now_d = Decimal(str(sma_now))
        sma_prev_d = Decimal(str(sma_prev))
        if sma_now_d >= sma_prev_d:
            return None

        # 2) Up-streak: rose in >= 4 of the 5 days ending yesterday (pre-breakdown)
        ups = 0
        for k in range(-(self._streak_window + 1), -1):
            if bars[k].close > bars[k - 1].close:
                ups += 1
        if ups < self._min_up:
            return None

        # 3) Yesterday was an inside bar
        if not (ib.high <= mother.high and ib.low >= mother.low):
            return None
        if ib.high == mother.high and ib.low == mother.low:
            return None

        # 4) Today closes below the inside bar low
        if cur.close >= ib.low:
            return None

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

        entry = cur.close
        hi5 = max(b.high for b in bars[-self._stop_lb:])
        stop = hi5 + Decimal(str(self._stop_buf)) * atr_d
        target = entry - Decimal(str(self._target_atr)) * atr_d
        if not (target < entry < stop) or target <= 0:
            return None
        risk = stop - entry
        if risk <= 0:
            return None
        rr = (entry - target) / risk
        if rr < Decimal("1.5"):
            return None

        # Strength: decisiveness, close position, volume, trend alignment
        dec = float((ib.low - cur.close) / atr_d)
        dec_score = min(35, max(0, int(dec * 50)))
        rng = cur.high - cur.low
        if rng <= 0:
            close_pos = 0.5
        else:
            close_pos = float((cur.high - cur.close) / rng)
        close_score = min(25, max(0, int(close_pos * 25)))
        vols = [float(b.volume) for b in bars[-21:-1]]
        avg_vol = sum(vols) / len(vols) if vols else 0.0
        vratio = float(cur.volume) / avg_vol if avg_vol > 0 else 1.0
        vol_score = min(25, max(0, int((vratio - 0.8) * 30)))
        trend_score = 15 if cur.close < sma_now_d else 5
        strength = max(0, min(100, dec_score + close_score + vol_score + trend_score))

        return Candidate(
            ticker=ticker,
            side="sell",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=int(strength),
            thesis=(f"200-SMA falling; {ups}/5 up days into resistance stalled in an inside bar, "
                    f"and today closed below its low ({ib.low}). Trapped bounce buyers' stops and "
                    f"confirmation shorts should resume the downtrend. Stop above 5-day high, target 2.5 ATR."),
            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
Short after an up-streak and inside bar in a falling 200-day: Loses money · EdgeProven