Month-end short on stocks in a downtrend
Latest bar is the last trading day of a month. Require close < 50-SMA < 200-SMA, 20-day return < -5%, and close in the lower 30% of the 20-day range. Enter short at close. Stop = entry + 1.75*ATR(14). Target = entry - 2.5*ATR(14).
In bear regimes, month-end rebalancing and redemption-driven selling concentrates in the weakest names (funds liquidate losers to raise cash for redemptions, with window-dressing reinforcing the effect), and the selling pressure continues into the first sessions of the new month for downtrending stocks lacking natural buyers.
Loses money
After costs it lost money on the stocks that decide the verdict.
- −0.356R a trade after costs on the laggard stocks.
42 large US stocks, 15 years
Before costs −0.262R
By trade and by day, sized to 362 rules
What the numbers say
On the laggard stocks the 117 trades averaged −0.356R after costs, and −0.501R on the winners. The bear-market trades, where the idea should work best, did worst at −0.709R, and none of the random-date draws did worse. Only the flat market was positive (0.212R, 28 trades), too few to carry the verdict.
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.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 60 | −0.451R | −2.93 | −1.78 · 33d | −0.042R · beats 0% | −0.386R |
| Flat | 28 | +0.212R | 0.83 | 0.22 · 14d | −0.053R · beats 85% | −0.602R |
| Bear | 29 | −0.709R | −4.32 | −4.20 · 9d | −0.170R · beats 0% | −0.564R |
| All | 117 | −0.356R | −0.076R | −0.501R |
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.7 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
from decimal import Decimal
from datetime import datetime, timedelta
import math
from core.domain import Bar
from strategies.indicators import atr, sma
from scanners.base import Candidate
class MonthEndLaggardLiquidationShort:
name = "month_end_laggard_liquidation_short"
description = "Last-trading-day-of-month short of bear-trending laggards whose month-end tape shows unfinished liquidation."
def __init__(self, ret_lookback: int = 20, max_ret_20: float = -0.05, range_pct_max: float = 0.30, max_mtd: float = -0.03, min_rel_vol: float = 0.9, target_atr: float = 2.5, stop_atr_max: float = 1.6, stop_atr_min: float = 1.0, swing_lookback: int = 5, stop_buffer_atr: float = 0.25) -> None:
self._lb = ret_lookback
self._max_ret = max_ret_20
self._range_max = range_pct_max
self._max_mtd = max_mtd
self._min_rel_vol = min_rel_vol
self._target_atr = target_atr
self._stop_max = stop_atr_max
self._stop_min = stop_atr_min
self._swing_lb = swing_lookback
self._buf = stop_buffer_atr
@staticmethod
def _to_date(ts):
if isinstance(ts, datetime):
return ts.date()
return ts
def _is_last_trading_day_of_month(self, bars) -> bool:
try:
d = self._to_date(bars[-1].timestamp)
p = self._to_date(bars[-2].timestamp)
except Exception:
return False
if d is None or p is None:
return False
# previous bar must be same month (sanity: no data gap spanning months)
if (p.year, p.month) != (d.year, d.month):
return False
nxt = d + timedelta(days=1)
while nxt.weekday() >= 5:
nxt = nxt + timedelta(days=1)
return nxt.month != d.month
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
if len(bars) < 220:
return None
if not self._is_last_trading_day_of_month(bars):
return None
cur = bars[-1]
closes = [float(b.close) for b in bars]
c = closes[-1]
if c <= 0:
return None
sma50 = sma(closes, 50)
sma200 = sma(closes, 200)
if sma50 is None or sma200 is None:
return None
sma50 = float(sma50)
sma200 = float(sma200)
if not (c < sma50 < sma200):
return None
# 20-day return
base = closes[-(self._lb + 1)]
if base <= 0:
return None
ret20 = c / base - 1.0
if ret20 >= self._max_ret:
return None
# position in 20-day range
win = bars[-self._lb:]
hi = max(float(b.high) for b in win)
lo = min(float(b.low) for b in win)
if hi <= lo:
return None
range_pos = (c - lo) / (hi - lo)
if range_pos > self._range_max:
return None
# Month-to-date laggard: compare to last close of prior month
cur_d = self._to_date(cur.timestamp)
prior_month_close = None
for i in range(len(bars) - 2, max(len(bars) - 30, 0), -1):
di = self._to_date(bars[i].timestamp)
if (di.year, di.month) != (cur_d.year, cur_d.month):
prior_month_close = float(bars[i].close)
break
if prior_month_close is None or prior_month_close <= 0:
return None
mtd = c / prior_month_close - 1.0
if mtd >= self._max_mtd:
return None
# Liquidation still active into the close: weak final-day close and lower over last 3 sessions
day_rng = float(cur.high) - float(cur.low)
close_pos = (c - float(cur.low)) / day_rng if day_rng > 0 else 0.5
if close_pos > 0.5:
return None
if not (c < closes[-4]):
return None
vols = [float(b.volume) for b in bars[-21:-1]]
avg_vol = sum(vols) / len(vols) if vols else 0.0
if avg_vol <= 0:
return None
rel_vol = float(cur.volume) / avg_vol
if rel_vol < self._min_rel_vol:
return None
atr_val = atr(bars, 14)
if atr_val is None:
return None
a = float(atr_val)
if a <= 0 or math.isnan(a):
return None
# Structural stop: recent swing high + buffer, clipped to [min, max] ATR
swing_hi = max(float(b.high) for b in bars[-self._swing_lb:])
stop_dist = (swing_hi + self._buf * a) - c
stop_dist = max(self._stop_min * a, min(self._stop_max * a, stop_dist))
target_dist = self._target_atr * a
entry = cur.close
stop = entry + Decimal(str(round(stop_dist, 6)))
target = entry - Decimal(str(round(target_dist, 6)))
if target <= 0 or not (target < entry < stop):
return None
risk = stop - entry
if risk <= 0:
return None
rr = (entry - target) / risk
if rr < Decimal("1.5"):
return None
# Strength components
trend_spread = (sma200 - sma50) / sma200
trend_score = min(25, max(0, int(trend_spread * 250)))
mtd_score = min(25, max(0, int((-mtd - 0.03) * 250 + 5)))
vol_score = min(25, max(0, int((rel_vol - 0.9) * 30)))
weak_close = (1.0 - close_pos) * 0.6 + (1.0 - range_pos / self._range_max) * 0.4
close_score = min(25, max(0, int(weak_close * 25)))
strength = max(0, min(100, trend_score + mtd_score + vol_score + close_score))
thesis = (
f"Last trading day of month: bear-trend laggard (close<50SMA<200SMA, 20d ret {ret20*100:.1f}%, "
f"MTD {mtd*100:.1f}%) closed weak (day pos {close_pos:.2f}, 20d range pos {range_pos:.2f}) on "
f"{rel_vol:.2f}x volume, so liquidation looks unfinished into month-end. The bet is that redemption/rebalance "
f"selling of losers spills into the new month and overrides the turn-of-month bounce."
)
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=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.
Describe it in plain words and get the same honest test in about a minute.