Skip to content
The Casebook · An idea an AI invented

Buying a 4-8% dip near the 250-day high, 1.5 ATR stop

Entry at latest close if close is within 15% of 250-day high, the stock fell 4-8% from the 15-day high, and the close is above the 50-day SMA. Stop 1.5 ATR(14) below entry. Target 2.5 ATR above entry. Skip if the volume today exceeds 2x its 20-day average.
Why the AI thought it might work

Stocks that closed within the top 10% of their 250-day range have an anchored holder base that does not sell at small dips; mechanical dip-buyers and anchored holders reload after a controlled 4-8% pullback from the recent high. The bid persists because losses relative to the 52-week reference high feel small to holders while momentum funds hold. A single stock's bars show the pullback depth and the range position directly.

VerdictTested Nov 22, 2026

Loses money

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

  • −0.061R a trade after costs on the laggard stocks.
Trades on the laggards
1,114

42 large US stocks, 15 years

Per trade, after costs
−0.061R

Before costs +0.028R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggard stocks, the 1114 trades averaged −0.061R after costs (0.028R before), so costs turned a small gain into a loss. The winners averaged 0.117R. In bear markets the result was −0.448R across 97 trades (t −3.35), and none of the random-date draws did worse. The verdict follows from the negative laggard result.

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
Bull846−0.019R−0.38−0.60 · 649d−0.059R · beats 70%+0.102R
Flat171−0.051R−0.48−0.47 · 130d+0.002R · beats 30%+0.192R
Bear97−0.448R−3.35−2.26 · 65d−0.012R · beats 0%+0.058R
All1,114−0.061R−0.045R+0.117R

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.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 RangePositionLadderDipLong:
    name = "range_position_ladder_dip_long"
    description = "First-touch 4-8% dip from 15-day high in a stock within 15% of its 250-day high and above its 50-day SMA"

    def __init__(self, range_lookback: int = 250, near_high_pct: float = 0.15, dip_lookback: int = 15, dip_min: float = 0.04, dip_max: float = 0.08, sma_len: int = 50, atr_len: int = 14, stop_atr: float = 1.5, target_atr: float = 2.5, vol_lookback: int = 20, max_vol_mult: float = 2.0) -> None:
        self._range_lookback = range_lookback
        self._near_high_pct = near_high_pct
        self._dip_lookback = dip_lookback
        self._dip_min = dip_min
        self._dip_max = dip_max
        self._sma_len = sma_len
        self._atr_len = atr_len
        self._stop_atr = stop_atr
        self._target_atr = target_atr
        self._vol_lookback = vol_lookback
        self._max_vol_mult = max_vol_mult

    def _dip(self, window_bars, close):
        hi = max(float(b.high) for b in window_bars)
        if hi <= 0:
            return None, hi
        return (hi - float(close)) / hi, hi

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        need = max(self._range_lookback, self._sma_len, self._vol_lookback + 1, self._dip_lookback + 1) + 5
        if len(bars) < need:
            return None
        current = bars[-1]
        close_f = float(current.close)
        if close_f <= 0:
            return None

        # Range position: within near_high_pct of 250-day high
        range_win = bars[-self._range_lookback:]
        hi250 = max(float(b.high) for b in range_win)
        lo250 = min(float(b.low) for b in range_win)
        if hi250 <= 0 or close_f < hi250 * (1.0 - self._near_high_pct):
            return None

        # Dip from 15-day high (today included)
        dip, hi15 = self._dip(bars[-self._dip_lookback:], current.close)
        if dip is None or dip < self._dip_min or dip > self._dip_max:
            return None

        # First-touch: prior bar's dip (vs its own 15-day high) must be under dip_min
        prev_dip, _ = self._dip(bars[-self._dip_lookback - 1:-1], bars[-2].close)
        if prev_dip is None or prev_dip >= self._dip_min:
            return None

        # Trend filter: close above 50-day SMA
        closes = [float(b.close) for b in bars]
        sma50 = sma(closes, self._sma_len)
        if sma50 is None or close_f <= float(sma50):
            return None

        # Volume: skip climactic selling
        vol_window = bars[-(self._vol_lookback + 1):-1]
        avg_vol = sum(float(b.volume) for b in vol_window) / float(self._vol_lookback)
        if avg_vol <= 0:
            return None
        vol_ratio = float(current.volume) / avg_vol
        if vol_ratio > self._max_vol_mult:
            return None

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

        entry = current.close
        stop = entry - Decimal(str(self._stop_atr)) * atr_dec
        target = entry + Decimal(str(self._target_atr)) * atr_dec
        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 components
        rng = hi250 - lo250
        range_pos = (close_f - lo250) / rng if rng > 0 else 0.0
        range_score = max(0.0, min(35.0, (range_pos - 0.6) / 0.4 * 35.0))
        mid = (self._dip_min + self._dip_max) / 2.0
        half = (self._dip_max - self._dip_min) / 2.0
        dip_score = max(0.0, 25.0 * (1.0 - abs(dip - mid) / half)) if half > 0 else 0.0
        vol_score = max(0.0, min(20.0, (self._max_vol_mult - vol_ratio) / self._max_vol_mult * 20.0))
        sma50_prev = sma(closes[:-10], self._sma_len)
        trend_score = 0.0
        if sma50_prev is not None and float(sma50_prev) > 0:
            slope = (float(sma50) - float(sma50_prev)) / float(sma50_prev)
            trend_score = max(0.0, min(20.0, slope * 400.0))
        strength = int(max(0, min(100, round(range_score + dip_score + vol_score + trend_score))))

        thesis = (
            f"First close {dip * 100:.1f}% below 15-day high ({hi15:.2f}) while within "
            f"{(1 - close_f / hi250) * 100:.1f}% of 250-day high and above 50-SMA; vol {vol_ratio:.2f}x avg. "
            "Holders anchored to the 52-week high and dip-buyers should reload this controlled pullback."
        )

        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
Buying a 4-8% dip near the 250-day high, 1.5 ATR stop: Loses money · EdgeProven