ADX trend entry, exit when +DI falls below -DI
Buy when ADX(14) rises above 25 with +DI above -DI, and exit when +DI crosses below -DI.
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.
42 large US stocks, 15 years
Before costs −0.013R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards, 649 trades averaged −0.09R after costs (−0.013 before costs), while the 20 winners averaged 0.1. In bull markets (534 trades) it was −0.09R, with t −2.03, and it beat only 0.1 of random-date draws. The edge appears only where stocks already rose.
How it was tested
Buy when ADX(14) crosses up through 25 while +DI(14) is above -DI(14), and exit when +DI(14) crosses below -DI(14).
- Side
- Long
- Its own exit
- At each close after entry, exit at that close if +DI(14) crossed below -DI(14) that day, meaning +DI > -DI on the prior day and +DI < -DI today., checked at each close
- 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.01, by trade and by day, sized to a first try (one idea, tested once)
- Prices
- 15 years of daily bars through 2026-11-20; judged 2026-11-22
- 'Rises above 25' means ADX(14) crosses from at or below 25 to above 25 on the signal day.
- +DI above -DI is checked on the same day as the ADX cross.
- ADX, +DI and -DI use Wilder smoothing with period 14.
- Because the idea's own exit is the DI cross, the stop (3 x ATR(14)) and target (6 x ATR(14)) are wide protective choices I made.
- The 30-day time limit is a backstop since the idea names no hold limit.
- Entry is at the signal day close, per the harness.
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 | 534 | −0.090R | −2.03 | −2.12 · 459d | −0.045R · beats 10% | +0.108R |
| Flat | 90 | −0.159R | −1.67 | −1.79 · 82d | −0.060R · beats 10% | +0.138R |
| Bear | 25 | +0.144R | 0.89 | 0.74 · 24d | +0.174R · beats 45% | −0.239R |
| All | 649 | −0.090R | −0.039R | +0.100R |
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.5 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 core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate
class AdxTrendStartDiCrossExit:
name = "adx_trend_start_di_cross_exit"
description = "Long when ADX(14) crosses up through 25 with +DI above -DI; exit on +DI/-DI bearish cross."
def __init__(self, period: int = 14, adx_level: float = 25.0, stop_mult: float = 3.0, target_mult: float = 6.0) -> None:
self._p = period
self._level = adx_level
self._stop_mult = stop_mult
self._target_mult = target_mult
def _series(self, bars):
p = self._p
n = len(bars)
if n < 2 * p + 1:
return None
tr = []
pdm = []
mdm = []
for i in range(1, n):
h = float(bars[i].high)
l = float(bars[i].low)
pc = float(bars[i - 1].close)
ph = float(bars[i - 1].high)
pl = float(bars[i - 1].low)
tr.append(max(h - l, abs(h - pc), abs(l - pc)))
up = h - ph
dn = pl - l
pdm.append(up if (up > dn and up > 0) else 0.0)
mdm.append(dn if (dn > up and dn > 0) else 0.0)
m = len(tr)
pdi = [None] * m
mdi = [None] * m
adx = [None] * m
dx = [None] * m
s_tr = sum(tr[:p])
s_p = sum(pdm[:p])
s_m = sum(mdm[:p])
for j in range(p - 1, m):
if j > p - 1:
s_tr = s_tr - s_tr / p + tr[j]
s_p = s_p - s_p / p + pdm[j]
s_m = s_m - s_m / p + mdm[j]
if s_tr > 0:
pdi[j] = 100.0 * s_p / s_tr
mdi[j] = 100.0 * s_m / s_tr
else:
pdi[j] = 0.0
mdi[j] = 0.0
tot = pdi[j] + mdi[j]
dx[j] = 100.0 * abs(pdi[j] - mdi[j]) / tot if tot > 0 else 0.0
first = 2 * p - 2
if first >= m:
return None
adx[first] = sum(dx[p - 1:first + 1]) / p
for j in range(first + 1, m):
adx[j] = (adx[j - 1] * (p - 1) + dx[j]) / p
return adx, pdi, mdi
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
res = self._series(bars)
if res is None:
return None
adx, pdi, mdi = res
if adx[-1] is None or adx[-2] is None or pdi[-1] is None or mdi[-1] is None:
return None
if not (adx[-1] > self._level and adx[-2] <= self._level):
return None
if not (pdi[-1] > mdi[-1]):
return None
atr_val = atr(bars, self._p)
if atr_val is None or atr_val <= 0:
return None
a = Decimal(str(atr_val))
entry = bars[-1].close
stop = entry - Decimal(str(self._stop_mult)) * a
target = entry + Decimal(str(self._target_mult)) * a
risk = entry - stop
if risk <= 0 or stop <= 0:
return None
rr = (target - entry) / risk
return Candidate(
ticker=ticker,
side="buy",
entry=entry,
stop=stop,
target=target,
risk_reward_ratio=rr.quantize(Decimal("0.01")),
signal_strength=50,
thesis="ADX(14) crossed up through 25 with +DI above -DI.",
)
def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal, side: str, bars_held: int) -> bool:
res = self._series(bars)
if res is None:
return False
adx, pdi, mdi = res
if pdi[-1] is None or mdi[-1] is None or pdi[-2] is None or mdi[-2] is None:
return False
return pdi[-2] > mdi[-2] and pdi[-1] < mdi[-1]
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.