Skip to content
The Casebook · An idea an AI invented

Inside bar after a high-volume selloff, long

Entry at latest close if the prior bar had return below -2.0x ATR(14) percent with volume at least 2x its 20-day average, and the latest bar is an inside bar (high below prior high, low above prior low) with volume below the prior bar's volume. Stop = prior bar's low minus 0.25x ATR(14). Target = entry plus 1.8x ATR(14).
Why the AI thought it might work

After a forced-selling day (large down move on high volume), liquidity providers return once the next session shows an inside day with contracted volume: the selling pressure is exhausted and market makers re-quote tighter, letting price recover. The two-bar sequence is observed in one stock and reflects order-flow normalisation, not a chart shape.

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

42 large US stocks, 15 years

Per trade, after costs
+0.050R

Before costs +0.185R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggards the idea made +0.050R a trade after costs over 79 trades, down from 0.185R before costs. The best market t was 0.50, well short of the 2.95 bar, and flat markets were negative at −0.411R. With 362 rules in the search, that gap is why the verdict is indistinguishable 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
Bull53+0.122R0.500.50 · 53d−0.139R · beats 95%−0.006R
Flat13−0.411R−0.97−0.97 · 13d−0.181R · beats 40%+0.688R
Bear13+0.218R0.500.50 · 13d−0.213R · beats 90%+1.071R
All79+0.050R−0.158R+0.210R

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.0 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 PostSelloffInsideDayLiquidityReturnLong:
    name = "post_selloff_inside_day_liquidity_return_long"
    description = "Inside day on contracted volume after a high-volume selloff of more than 2 ATR; long on liquidity return."

    def __init__(self, atr_period: int = 14, drop_atr_mult: float = 2.0, vol_mult: float = 2.0, vol_lookback: int = 20, stop_atr_buffer: float = 0.25, target_atr_mult: float = 1.8, min_rr: float = 1.5, min_bars: int = 40) -> None:
        self._atr_period = atr_period
        self._drop_atr_mult = drop_atr_mult
        self._vol_mult = vol_mult
        self._vol_lookback = vol_lookback
        self._stop_atr_buffer = stop_atr_buffer
        self._target_atr_mult = target_atr_mult
        # Declared platform floor: the orchestrator discards any candidate with R:R < 1.5,
        # so this gate only mirrors the downstream filter rather than adding a new rule.
        self._min_rr = min_rr
        self._min_bars = min_bars

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < max(self._min_bars, self._vol_lookback + self._atr_period + 3):
            return None
        cur = bars[-1]
        sell = bars[-2]
        pre = bars[-3]
        if pre.close <= 0 or sell.close <= 0:
            return None

        # ATR measured before the selloff bar, so the shock does not inflate its own threshold
        atr_pre = atr(bars[:-2], self._atr_period)
        if atr_pre is None or atr_pre <= 0:
            return None
        atr_pct = float(atr_pre) / float(pre.close) * 100.0
        ret_pct = (float(sell.close) / float(pre.close) - 1.0) * 100.0
        if ret_pct >= -self._drop_atr_mult * atr_pct:
            return None

        # Volume spike on the selloff bar vs. the prior 20-day average
        vol_window = bars[-(self._vol_lookback + 2):-2]
        avg_vol = sum(float(b.volume) for b in vol_window) / len(vol_window)
        if avg_vol <= 0:
            return None
        sell_vol = float(sell.volume)
        vol_ratio = sell_vol / avg_vol
        if vol_ratio < self._vol_mult:
            return None

        # Inside bar with contracted volume
        if not (cur.high < sell.high and cur.low > sell.low):
            return None
        cur_vol = float(cur.volume)
        if sell_vol <= 0 or cur_vol >= sell_vol:
            return None

        # Adaptive levels (operator rules)
        atr_now = atr(bars, self._atr_period)
        if atr_now is None or atr_now <= 0:
            return None
        atr_dec = Decimal(str(atr_now))
        entry = cur.close
        stop = sell.low - Decimal(str(self._stop_atr_buffer)) * atr_dec
        target = entry + Decimal(str(self._target_atr_mult)) * atr_dec
        if not (stop < entry < target):
            return None
        risk = entry - stop
        if risk <= 0:
            return None
        rr = (target - entry) / risk
        if rr < Decimal(str(self._min_rr)):
            return None

        # Signal strength measures order-flow exhaustion, not close location, so it
        # does not compete with the R:R floor.
        # 1) Selloff severity beyond the threshold (0-30)
        sev = (-ret_pct / atr_pct) - self._drop_atr_mult if atr_pct > 0 else 0.0
        sev_score = int(max(0.0, min(30.0, sev * 15.0)))
        # 2) Capitulation volume (0-30)
        cap_score = int(max(0.0, min(30.0, (vol_ratio - self._vol_mult) * 10.0)))
        # 3) Volume contraction on the inside day (0-25)
        contraction = 1.0 - cur_vol / sell_vol
        con_score = int(max(0.0, min(25.0, contraction * 35.0)))
        # 4) Range compression of the inside bar vs. the selloff bar (0-15)
        sell_rng = float(sell.high - sell.low)
        cur_rng = float(cur.high - cur.low)
        comp = 1.0 - (cur_rng / sell_rng) if sell_rng > 0 else 0.0
        comp_score = int(max(0.0, min(15.0, comp * 20.0)))
        strength = max(0, min(100, sev_score + cap_score + con_score + comp_score))

        thesis = (
            f"Forced-selling day ({ret_pct:.1f}% vs {atr_pct:.1f}% ATR, {vol_ratio:.1f}x volume) "
            f"followed by an inside day on {cur_vol / sell_vol:.0%} of selloff volume: selling "
            f"exhausted and liquidity returning. Stop below selloff low, target +{self._target_atr_mult} ATR."
        )
        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,
            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
Inside bar after a high-volume selloff, long: Indistinguishable from luck · EdgeProven