RSI(14) buy above 30, sell above 70
Buy when the 14-day RSI crosses above 30 and sell when it crosses above 70.
Works in one market only
It holds up in one kind of market only.
- It clears the bar in the bear market only.
42 large US stocks, 15 years
Before costs +0.133R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards, 1026 trades averaged 0.063R after costs. By market, bull was −0.047R (t −1.04), flat 0.162R and bear 0.266R (t 3.61, by day 2.43). Only the bear market clears the 2.01 bar, so the verdict is one market only.
How it was tested
Buy at the close when the 14-day RSI crosses up through 30, and exit at the close when the RSI crosses up through 70.
- Side
- Long
- Its own exit
- At any close after entry, exit if RSI(14) at that close is at or above 70 while RSI(14) at the prior close was below 70 (upward cross through 70)., 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
- RSI(14) uses Wilder smoothing on daily closes
- 'Crosses above' means prior close RSI below the level and current close RSI at or above it
- Entry is at the close of the signal day
- The idea names no stop, so a wide protective stop of 3 x ATR(14) is used
- The idea names no target, so a wide protective target of 6 x ATR(14) is used so the RSI 70 cross is the main exit
- If the RSI 70 cross has not happened, the trade is closed after 30 trading days (the maximum)
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 | 584 | −0.047R | −1.04 | −0.80 · 410d | −0.039R · beats 45% | +0.149R |
| Flat | 244 | +0.162R | 2.33 | 2.09 · 140d | −0.077R · beats 100% | +0.055R |
| Bear | 198 | +0.266R | 3.61 | 2.43 · 85d | +0.162R · beats 95% | +0.122R |
| All | 1,026 | +0.063R | −0.009R | +0.115R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 11.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 core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate
def _wilder_rsi_last_two(closes, period):
# returns (rsi_prev, rsi_curr) using Wilder smoothing, or None
n = len(closes)
if n < period + 2:
return None
changes = [closes[i] - closes[i - 1] for i in range(1, n)]
gains = [c if c > 0 else 0.0 for c in changes]
losses = [-c if c < 0 else 0.0 for c in changes]
avg_g = sum(gains[:period]) / period
avg_l = sum(losses[:period]) / period
def to_rsi(g, l):
if l == 0:
if g == 0:
return 50.0
return 100.0
rs = g / l
return 100.0 - 100.0 / (1.0 + rs)
series = [to_rsi(avg_g, avg_l)]
for i in range(period, len(changes)):
avg_g = (avg_g * (period - 1) + gains[i]) / period
avg_l = (avg_l * (period - 1) + losses[i]) / period
series.append(to_rsi(avg_g, avg_l))
if len(series) < 2:
return None
return series[-2], series[-1]
class Rsi14CrossAbove30:
name = "rsi14_cross_above_30_exit_cross_above_70"
description = "Long when Wilder RSI(14) crosses up through 30; exit when RSI(14) crosses up through 70."
def __init__(self, period: int = 14, entry_level: float = 30.0, exit_level: float = 70.0,
stop_atr_mult: float = 3.0, target_atr_mult: float = 6.0) -> None:
self._period = period
self._entry_level = entry_level
self._exit_level = exit_level
self._stop_mult = stop_atr_mult
self._target_mult = target_atr_mult
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
if len(bars) < self._period + 16:
return None
closes = [float(b.close) for b in bars]
pair = _wilder_rsi_last_two(closes, self._period)
if pair is None:
return None
prev_rsi, cur_rsi = pair
if not (prev_rsi < self._entry_level and cur_rsi >= self._entry_level):
return None
atr_val = atr(bars, self._period)
if atr_val is None or atr_val <= 0:
return None
atr_dec = Decimal(str(atr_val))
entry = bars[-1].close
stop = entry - Decimal(str(self._stop_mult)) * atr_dec
target = entry + Decimal(str(self._target_mult)) * atr_dec
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=f"RSI(14) crossed up through {self._entry_level:g} (prev {prev_rsi:.1f}, now {cur_rsi:.1f}).",
)
def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal,
side: str, bars_held: int) -> bool:
if len(bars) < self._period + 2:
return False
closes = [float(b.close) for b in bars]
pair = _wilder_rsi_last_two(closes, self._period)
if pair is None:
return False
prev_rsi, cur_rsi = pair
return prev_rsi < self._exit_level and cur_rsi >= self._exit_level
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.