Turn-of-month buy after a drop, 1.5 ATR stop, 2 ATR target
Latest bar is the last trading day of a month or first 2 trading days of the next month (detect via date). Require 15-day return < -6% and close in the lower 40% of the 20-day range. Enter long at close. Stop = entry - 1.5*ATR(14). Target = entry + 2.0*ATR(14).
Pension, mutual fund and payroll-driven contributions are invested in the first trading days of the month, creating predictable inflows concentrated at turn-of-month. Laggard/value names that sold off into month-end (tax and window-dressing selling of losers) get a mechanical bid when cash arrives. Dates are visible in the bars.
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.175R a trade), but no market clears t > 2.95 by trade and by day.
42 large US stocks, 15 years
Before costs +0.253R
By trade and by day, sized to 362 rules
What the numbers say
On laggards the idea averaged +0.175R a trade after costs over 1381 trades, and +0.222 on winners. Bull (3.54) and bear (3.18) clear the bar by trade, but by day every market sits far below the 2.95 bar (1.28 bull, 0.89 flat, 1.51 bear), since trades cluster on few days. So the result 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.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 755 | +0.178R | 3.54 | 1.28 · 281d | −0.036R · beats 100% | +0.282R |
| Flat | 377 | +0.107R | 1.54 | 0.89 · 95d | −0.022R · beats 90% | +0.218R |
| Bear | 249 | +0.266R | 3.18 | 1.51 · 44d | +0.052R · beats 100% | +0.095R |
| All | 1,381 | +0.175R | −0.017R | +0.222R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 8.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 codeHide
from decimal import Decimal
from datetime import datetime, timedelta
import math
from core.domain import Bar
from strategies.indicators import atr, rsi, highest_high, lowest_low
from scanners.base import Candidate
class TurnOfMonthLaggardLong:
name = "turn_of_month_laggard_long"
description = "Oversold laggard bought at turn-of-month (last day / first 2 days) to catch month-start contribution inflows."
def __init__(
self,
ret_lookback: int = 15,
max_ret: float = -0.06,
min_ret: float = -0.35,
range_lookback: int = 20,
max_range_pos: float = 0.40,
atr_period: int = 14,
stop_atr: float = 1.5,
target_atr: float = 2.5,
min_bars: int = 60,
) -> None:
self._ret_lb = ret_lookback
self._max_ret = max_ret
self._min_ret = min_ret
self._rng_lb = range_lookback
self._max_pos = max_range_pos
self._atr_p = atr_period
self._stop_atr = stop_atr
self._target_atr = target_atr
self._min_bars = min_bars
@staticmethod
def _next_weekday(d):
n = d + timedelta(days=1)
while n.weekday() >= 5:
n = n + timedelta(days=1)
return n
def _tom_day(self, bars):
# Returns -1 (last trading day), 1 (first), 2 (second), or None. No future bars used.
d0 = bars[-1].timestamp
d1 = bars[-2].timestamp
d2 = bars[-3].timestamp
if d0.month != d1.month:
return 1
if d1.month != d2.month:
return 2
nxt = self._next_weekday(d0)
if nxt.month != d0.month:
return -1
return None
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
if len(bars) < max(self._min_bars, self._rng_lb + 2, self._ret_lb + 2):
return None
try:
tom = self._tom_day(bars)
except Exception:
return None
if tom is None:
return None
cur = bars[-1]
entry = cur.close
if entry <= 0:
return None
base = bars[-(self._ret_lb + 1)].close
if base <= 0:
return None
ret = float(entry / base) - 1.0
if ret >= self._max_ret or ret <= self._min_ret:
return None
window = bars[-self._rng_lb:]
hi = max(b.high for b in window)
lo = min(b.low for b in window)
rng = hi - lo
if rng <= 0:
return None
pos = float((entry - lo) / rng)
if pos > self._max_pos:
return None
atr_val = atr(bars, self._atr_p)
if atr_val is None or atr_val <= 0:
return None
a = Decimal(str(atr_val))
stop = entry - Decimal(str(self._stop_atr)) * a
target = entry + Decimal(str(self._target_atr)) * a
if stop <= 0 or not (stop < entry < target):
return None
risk = entry - stop
rr = (target - entry) / risk
if rr < Decimal("1.5"):
return None
# Structural room: prior 20-day high must sit at or above ~2 ATR overhead,
# i.e. the target is a retrace inside the recent range, not a breakout.
if hi < entry + Decimal("2.0") * a:
return None
# --- signal strength ---
# 1) Timing: day +1 strongest inflow, -1 next, +2 weaker.
timing_score = {1: 30, -1: 25, 2: 18}.get(tom, 0)
# 2) Depth of selloff in ATR units (bigger month-end dump = more fuel).
drop_atr = float((base - entry) / a)
depth_score = int(min(30, max(0, (drop_atr - 1.5) * 8)))
# 3) Location within range (closer to low = more oversold).
loc_score = int(min(20, max(0, (self._max_pos - pos) / self._max_pos * 20)))
# 4) Exhaustion: RSI washed out, or close off the bar low (buyers showing up).
closes = [float(b.close) for b in bars]
r = rsi(closes, 14)
rsi_score = 0
if r is not None:
rsi_score = int(min(10, max(0, (40 - float(r)) / 2)))
bar_rng = cur.high - cur.low
cpos = float((cur.close - cur.low) / bar_rng) if bar_rng > 0 else 0.5
close_score = int(min(10, max(0, cpos * 10)))
strength = max(0, min(100, timing_score + depth_score + loc_score + rsi_score + close_score))
tom_label = {-1: "last trading day of month", 1: "1st trading day of month", 2: "2nd trading day of month"}[tom]
thesis = (
f"Turn-of-month ({tom_label}) laggard: {ret*100:.1f}% over {self._ret_lb}d, close at "
f"{pos*100:.0f}% of {self._rng_lb}d range. Month-start pension/payroll inflows should lift "
f"names dumped into month-end. Stop 1.5 ATR, target 2.5 ATR (inside 20d range). "
f"Edge is front-loaded in days -1..+3; consider exiting by ~5 bars if the bid fails to appear."
)
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.