Long after a volatility spike fades, above the 50-day
Fire when 10-day realized vol is below its 120-day median, was in the top 10% of its 120-day distribution 15 sessions ago, and close is above the 50-day SMA and above its 5-day high. Enter long at close. Stop 2x ATR(14) below; target 3x ATR above.
Volatility-targeting funds cut exposure when realized vol spikes and re-add as it declines. A stock whose 10-day realized volatility has fallen from a top-decile to below-median level while price holds above the 50-day SMA faces a gradual mechanical re-risking bid.
Loses money
After costs it lost money on the stocks that decide the verdict.
- −0.055R a trade after costs on the laggard stocks.
42 large US stocks, 15 years
Before costs +0.029R
By trade and by day, sized to 362 rules
What the numbers say
On the 22 laggard stocks, 1038 trades averaged −0.055R after costs; before costs it was 0.029R, so costs erased the small edge. Bull markets were −0.066R and flat markets −0.034R, with bull trades beating only 5% of random-date draws. Bear markets were 0.048R, the same as random dates (0.048R), so none of the three market types showed an edge.
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.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 784 | −0.066R | −1.47 | −1.45 · 528d | 0.000R · beats 5% | +0.070R |
| Flat | 209 | −0.034R | −0.40 | −1.27 · 127d | −0.002R · beats 40% | +0.128R |
| Bear | 45 | +0.048R | 0.26 | 0.26 · 36d | +0.048R · beats 50% | −0.151R |
| All | 1,038 | −0.055R | +0.002R | +0.072R |
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 codeHide
import math
from decimal import Decimal
from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate
class VolatilityPercentileReleaseTrendDriftLong:
name = "volatility_percentile_release_trend_drift_long"
description = "Long after 10d realized vol falls from top-decile to below its 120d median while price holds above the 50d SMA and breaks the 5d high."
def __init__(self, rv_len: int = 10, dist_len: int = 120, lag_min: int = 10, lag_max: int = 20, spike_pct: float = 0.90, sma_len: int = 50, breakout_len: int = 5, swing_len: int = 10, atr_buffer: float = 0.25, min_risk_atr: float = 1.5, max_risk_atr: float = 2.5, target_atr: float = 3.0, min_rr: float = 1.75) -> None:
self._rv_len = rv_len
self._dist_len = dist_len
self._lag_min = lag_min
self._lag_max = lag_max
self._spike_pct = spike_pct
self._sma_len = sma_len
self._bo_len = breakout_len
self._swing_len = swing_len
self._atr_buffer = atr_buffer
self._min_risk_atr = min_risk_atr
self._max_risk_atr = max_risk_atr
self._target_atr = target_atr
self._min_rr = min_rr
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
n = len(bars)
need = max(160, self._dist_len + self._lag_max + self._rv_len + 5, self._sma_len + 10)
if n < need:
return None
closes = [float(b.close) for b in bars]
if any(c <= 0 for c in closes):
return None
rets = [0.0] + [math.log(closes[i] / closes[i - 1]) for i in range(1, n)]
k = self._rv_len
cache = {}
def rv(t):
if t in cache:
return cache[t]
w = rets[t - k + 1:t + 1]
m = sum(w) / k
v = math.sqrt(sum((x - m) ** 2 for x in w) / (k - 1)) * math.sqrt(252.0)
cache[t] = v
return v
L = self._dist_len
last = n - 1
cur_rv = rv(last)
cur_dist = [rv(t) for t in range(last - L + 1, last + 1)]
srt = sorted(cur_dist)
median = (srt[L // 2] + srt[(L - 1) // 2]) / 2.0
if cur_rv >= median:
return None
cur_pct = sum(1 for x in cur_dist if x < cur_rv) / float(L)
best_pct = -1.0
peak_rv = 0.0
for lag in range(self._lag_min, self._lag_max + 1):
t = last - lag
dist = [rv(s) for s in range(t - L + 1, t + 1)]
val = rv(t)
pct = sum(1 for x in dist if x < val) / float(L)
if pct > best_pct:
best_pct = pct
if pct >= self._spike_pct and val > peak_rv:
peak_rv = val
if best_pct < self._spike_pct or peak_rv <= 0:
return None
cur = bars[-1]
sma_now = sum(closes[-self._sma_len:]) / self._sma_len
sma_prev = sum(closes[-self._sma_len - 5:-5]) / self._sma_len
if closes[-1] <= sma_now:
return None
prior_high = max(b.high for b in bars[-(self._bo_len + 1):-1])
if cur.close <= prior_high:
return None
atr_val = atr(bars, 14)
if atr_val is None or float(atr_val) <= 0:
return None
a = Decimal(str(float(atr_val)))
entry = cur.close
swing_low = min(b.low for b in bars[-self._swing_len:])
stop = swing_low - Decimal(str(self._atr_buffer)) * a
stop = min(stop, entry - Decimal(str(self._min_risk_atr)) * a)
stop = max(stop, entry - Decimal(str(self._max_risk_atr)) * a)
risk = entry - stop
if risk <= 0 or stop <= 0:
return None
target = entry + max(Decimal(str(self._target_atr)) * a, Decimal(str(self._min_rr)) * risk)
rr = (target - entry) / risk
if rr < Decimal("1.5"):
return None
# Scoring
ratio = peak_rv / max(cur_rv, 1e-9)
compress_score = int(min(35.0, max(0.0, (ratio - 1.0) * 20.0)))
compress_score += int(min(10.0, max(0.0, (0.5 - cur_pct) * 20.0)))
slope = (sma_now - sma_prev) / sma_prev
trend_score = 10 if slope > 0 else 0
ext = (closes[-1] - sma_now) / sma_now
trend_score += int(max(0.0, 15.0 - abs(ext - 0.04) * 200.0))
vols = [float(b.volume) for b in bars[-21:-1]]
avg_vol = sum(vols) / max(len(vols), 1)
vr = float(cur.volume) / max(avg_vol, 1.0)
vol_score = int(min(15.0, max(0.0, (vr - 0.8) * 20.0)))
rng = cur.high - cur.low
close_pos = float((cur.close - cur.low) / rng) if rng > 0 else 0.5
close_score = int(min(15.0, max(0.0, close_pos * 15.0)))
strength = max(0, min(100, compress_score + trend_score + vol_score + close_score))
thesis = (
f"10d realized vol fell from top-decile ({peak_rv:.0%} ann.) to {cur_rv:.0%}, below its 120d median ({median:.0%}); "
f"price holds above 50d SMA and closed above the prior {self._bo_len}d high. Vol-targeting re-risking bid should drive drift."
)
return Candidate(
ticker=ticker,
side="buy",
entry=entry,
stop=stop,
target=target,
risk_reward_ratio=rr.quantize(Decimal("0.01")),
signal_strength=int(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.
Describe it in plain words and get the same honest test in about a minute.