What does the RSI measure?
The Relative Strength Index was introduced by J. Welles Wilder in 1978 in New Concepts in Technical Trading Systems. It compares the average size of positive periods with the average size of negative periods and converts the ratio into a value between 0 and 100.
RS = avg_gain(n) / avg_loss(n)
RSI = 100 − 100 / (1 + RS)
The standard period is 14 (but can vary by timeframe).
Interpretation
- RSI > 70 — overbought: a pullback becomes more likely, but in strong trends the RSI can stay above 70 for weeks.
- RSI < 30 — oversold: a counter-reaction is possible; in downtrends, do not mistake it for a buy signal.
- Divergences — when price makes a new high/low but the RSI no longer follows, that is a warning sign of trend exhaustion.
- The 50 line — often used as a trend filter: RSI > 50 = upward bias, < 50 = downward bias.
How Botty uses RSI
indicators/compute.py computes RSI(14) with Wilder's EMA smoothing (com=13). Strategies can use it as a filter (EMA_RSI: long only when RSI > 50).
Implemented as a standalone entry condition rsi_mean_reversion in strategies/conditions.py — long when RSI crosses up from below 30, short when RSI crosses down from above 70. Parameters: rsi_oversold (default 30), rsi_overbought (default 70), rsi_min_bars_in_extreme (minimum number of bars in the extreme zone before the crossover, default 1).
Empirical test: RSI as a mean-reversion entry (BTC 1h, 2022–2025)
Question: Does an RSI14 crossover at 30/70 have a statistical edge as an entry signal in sideways markets?
Forward-return analysis (N=521 long events / N=503 short events)
RSI30 long crossover:
| Market regime | N | Win@1h | Win@12h | Win@48h | Median@24h |
|---|---|---|---|---|---|
| All markets | 521 | 51.6% | 51.1% | 54.9% | +0.13% |
| Range (ADX < 25) | 16 | 56.2% | 62.5% | 62.5% | +0.68% |
RSI70 short crossover (range markets ADX < 25):
| Horizon | Win% |
|---|---|
| 1h | 53.6% |
| 12h | 41.1% |
| 48h | 44.6% |
Key findings: - The RSI30 long signal has a weak but real edge: ~51–55% across all markets, ~62.5% in range markets (N=16, small). - The RSI70 short signal in range markets is actively wrong (41% win@12h) — after an RSI overbought crossdown in sideways markets, price frequently recovers because there is no trend. - The edge is real but small — and gets overridden by stops that are too tight.
Backtest result (range_filter ADX<25 + atr_trailing_stop×1.5)
| Configuration | Trades | Win rate | Profit factor | Return |
|---|---|---|---|---|
| No filter | 863 | 26% | 0.41 | −41% |
| Range filter (ADX<25) | 128 | 23% | 0.41 | −6% |
| + profit target 1:1 | 128 | 27% | 0.39 | −6% |
| + profit target 1:2 | 128 | 23% | 0.42 | −6% |
| Convergence ≥2 bars | 48 | 21% | 0.20 | −4% |
Diagnosis: 98% of exits are stop-losses. The ATR×1.5 stop (≈1.2%) gets taken out by normal BTC intrabar noise before the bounce arrives. The p10 of the 4h forward return sits at −1.26% — i.e. 10% of the signals see an interim drawdown of more than 1.26% before the recovery.
Conclusion: The problem is not the signal but the stop placement. A wider stop (ATR×3+) or a time-based exit could change the picture.
Wider-stop + long-only test (step 3)
| Variant | Stop | Trades | Win rate | Profit factor | Return |
|---|---|---|---|---|---|
| Baseline | ATR×1.5 | 128 | 22.7% | 0.41 | −6.2% |
| ATR×2.5 | ATR×2.5 | 127 | 31.5% | 0.60 | −5.7% |
| ATR×3.5 | ATR×3.5 | 126 | 32.5% | 0.77 | −4.4% |
| ATR×2.5 + TP×2.5 | ATR×2.5 | 127 | 33.9% | 0.69 | −4.5% |
| Long-only | ATR×2.5 | 51 | 43.1% | 0.93 | −0.4% |
Key finding: Wider stops improve the PF systematically. The real lever is disabling the short signal — long-only delivers a 43.1% win rate and PF 0.93 (nearly break-even over 4 years). The short signal was the main destroyer, consistent with the forward-return analysis (RSI70 short in range markets only 41% win@12h).
Status after step 4 — long-only + profit target:
| Variant | Trades | Win rate | PF | Return |
|---|---|---|---|---|
| LO + ATR×2.5 trail | 51 | 43.1% | 0.93 | −0.40% |
| LO + ATR×3.5 trail | 51 | 37.3% | 0.92 | −0.56% |
| LO + ATR×2.5 + PT×2.5 | 51 | 47.1% | 1.05 | +0.26% |
| LO + ATR×3.5 + PT×3.5 | 51 | 43.1% | 0.94 | −0.41% |
| LO + ADX<20 + ATR×2.5 + PT×2.5 | 15 | 46.7% | 1.36 | +0.48% |
The symmetric profit target (ATR×2.5 stop + ATR×2.5 target = 1:1 R:R) is the decisive lever — not the wider stop alone. A trailing stop without a target stays below PF 1.0 no matter how wide it is. ADX<20 shows PF 1.36 but has only 15 trades in 4 years.
Overall verdict (2026-05-16): Not a deploy candidate. PF 1.05 is too marginal, N=51 too small (~13 trades/year). The combination RSI30 long-only + ADX<25 + ATR×2.5 + PT×2.5 has a weak but real edge. For comparison: BB_EXTREME reaches PF >1.5 with 7/9 OOS windows profitable and far more trades.
Common mistakes
- Overbought ≠ sell signal. In trending markets, "overbought" is the rule, not the exception.
- Period too short. Below 7 the RSI becomes extremely noisy and produces false signals.
- Overrating the short signal in range markets. Empirically (BTC 1h 2022–2025): an RSI70 crossdown in sideways markets leads to rising prices in ~59% of cases — the SHORT signal is counterproductive in this regime.