Skip to content
The Casebook · An idea an AI invented

Long after volatility calms, above rising 20-day average

Entry at latest close if the 10-day realized close-to-close vol is below 0.6x the maximum 10-day realized vol over the prior 40 bars, price is above its 20-day SMA, and the 20-day SMA is not falling. Stop = entry minus 1.6*ATR(14). Target = entry + 2.2*ATR(14).
Why the AI thought it might work

Volatility-targeting and risk-parity funds cut exposure when realized vol spikes, then re-add as vol decays. When a stock's 10-day realized vol drops below 60% of its 30-day-ago peak 10-day vol, mechanical re-leveraging creates a persistent bid. Fully computable from closes.

VerdictTested Nov 22, 2026

Survivorship mirage

It clears the bar on today's winners, the stocks everyone wishes they had bought, but not on the laggards, which is where hindsight can't help.

  • It clears the bar on today's winners but not on the laggards: the winners' own rise did the work.
Trades on the laggards
3,371

42 large US stocks, 15 years

Per trade, after costs
−0.054R

Before costs +0.043R

Bar to clear
t > 2.95

By trade and by day, sized to 362 rules

What the numbers say

On the 22 laggards the rule averaged −0.054R per trade after costs over 3371 trades, against 0.098 on today's winners. Bull markets (−0.070) and flat markets (−0.123) were negative; only bear markets were positive (0.208). The gain appears where the stocks themselves rose, not on the laggards.

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,475−0.070R−2.53−3.17 · 1,331d−0.040R · beats 5%+0.100R
Flat586−0.123R−2.21−1.98 · 302d−0.031R · beats 0%−0.093R
Bear310+0.208R2.751.87 · 141d+0.015R · beats 90%+0.476R
All3,371−0.054R−0.033R+0.098R

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
import math
from decimal import Decimal

from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate


class VolSpikeDecayReexposureLong:
    name = "vol_spike_decay_reexposure_long"
    description = "Fresh vol contraction after a genuine vol spike, above a non-falling 20-SMA"

    def __init__(self, vol_len: int = 10, peak_lookback: int = 40, baseline_len: int = 100,
                 contraction: float = 0.6, spike_mult: float = 1.5, fresh_bars: int = 5,
                 sma_len: int = 20, slope_bars: int = 5, stop_atr_max: float = 1.6,
                 stop_atr_min: float = 0.8, target_atr: float = 2.2, min_rr: float = 1.6) -> None:
        self._n = vol_len
        self._pk = peak_lookback
        self._bl = baseline_len
        self._c = contraction
        self._sm = spike_mult
        self._fresh = fresh_bars
        self._sma = sma_len
        self._slope = slope_bars
        self._smax = stop_atr_max
        self._smin = stop_atr_min
        self._tatr = target_atr
        self._minrr = min_rr

    def _vol(self, rets, end):
        n = self._n
        w = rets[end - n + 1:end + 1]
        if len(w) < n:
            return None
        m = sum(w) / n
        var = sum((x - m) ** 2 for x in w) / (n - 1)
        return math.sqrt(var)

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        need = self._n + self._pk + self._bl + self._fresh + 20
        if len(bars) < max(need, 60):
            return None
        closes = [float(b.close) for b in bars]
        if min(closes) <= 0:
            return None
        rets = [0.0] + [math.log(closes[i] / closes[i - 1]) for i in range(1, len(closes))]
        last = len(bars) - 1
        start = last - self._pk - self._bl - self._fresh - 2
        vols = {}
        for j in range(start, last + 1):
            v = self._vol(rets, j)
            if v is None:
                return None
            vols[j] = v

        cur = vols[last]
        peak = max(vols[j] for j in range(last - self._pk, last))
        if peak <= 0 or cur <= 0:
            return None
        ratio = cur / peak
        if ratio >= self._c:
            return None

        base_vals = sorted(vols[j] for j in range(last - self._pk - self._bl, last - self._pk))
        if not base_vals:
            return None
        mid = len(base_vals) // 2
        baseline = base_vals[mid] if len(base_vals) % 2 else 0.5 * (base_vals[mid - 1] + base_vals[mid])
        if baseline <= 0:
            return None
        spike_ratio = peak / baseline
        if spike_ratio < self._sm:
            return None

        fresh = False
        for j in range(last - self._fresh, last):
            pj = max(vols[k] for k in range(j - self._pk, j))
            if pj > 0 and vols[j] / pj >= self._c:
                fresh = True
                break
        if not fresh:
            return None

        sma_now = sum(closes[-self._sma:]) / self._sma
        sma_prev = sum(closes[-self._sma - self._slope:-self._slope]) / self._sma
        if closes[-1] <= sma_now or sma_now < sma_prev:
            return None

        atr_val = atr(bars, 14)
        if atr_val is None or float(atr_val) <= 0:
            return None
        a = float(atr_val)
        entry_f = closes[-1]
        swing_low = min(float(b.low) for b in bars[-10:])
        risk = entry_f - (swing_low - 0.25 * a)
        risk = max(self._smin * a, min(self._smax * a, risk))
        stop_f = entry_f - risk
        if stop_f <= 0:
            return None
        reward = max(self._tatr * a, self._minrr * risk)

        entry = bars[-1].close
        stop = Decimal(str(round(stop_f, 4)))
        target = Decimal(str(round(entry_f + reward, 4)))
        if not (stop < entry < target):
            return None
        rr = (target - entry) / (entry - stop)
        if rr < Decimal("1.5"):
            return None

        spike_score = max(0.0, min(40.0, (spike_ratio - self._sm) / 1.5 * 30 + 10))
        contr_score = max(0.0, min(30.0, (self._c - ratio) / 0.3 * 30))
        dist = (entry_f - sma_now) / a
        trend_score = max(0.0, min(30.0, 30 - max(0.0, dist - 1.0) * 10))
        if sma_now <= sma_prev * 1.0005:
            trend_score *= 0.6
        strength = int(max(0, min(100, spike_score + contr_score + trend_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"10d realized vol fell to {ratio:.2f}x its 40-bar peak, and that peak was a real spike "
                    f"({spike_ratio:.2f}x the 100-bar median). Vol-targeting funds should re-lever into the "
                    f"decay while price holds above a non-falling 20-SMA."),
        )

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
Long after volatility calms, above rising 20-day average: Survivorship mirage · EdgeProven