A bounded 0-100 momentum oscillator that measures the speed and magnitude of recent price changes. RSI is the default starting point for momentum analysis in technical trading — well-understood thresholds, single-line simplicity, balanced smoothing. Developed by J. Welles Wilder in 1978.
RSI(14) on MES 5m — full cycle through both extremes
What it measures
- Momentum balance. Average size of recent gains divided by the average size of recent losses, normalized to a 0-100 scale.
- Potential exhaustion. Extreme readings (above 70 or below 30) flag conditions that often — but not always — precede mean reversion.
- Momentum acceleration. RSI's slope tells you whether the momentum reading itself is strengthening or weakening.
Formula
How AlgoLift computes it
Step 1 — per-bar gains and losses:
if Close[t] > Close[t-1]: Gain[t] = Close[t] − Close[t-1], Loss[t] = 0
if Close[t] < Close[t-1]: Gain[t] = 0, Loss[t] = Close[t-1] − Close[t]
if Close[t] = Close[t-1]: Gain[t] = 0, Loss[t] = 0
Step 2 — Wilder smoothing (seeded with SMA of first period bars, then iterative):
AvgGain[t] = (AvgGain[t-1] × (period − 1) + Gain[t]) / period
AvgLoss[t] = (AvgLoss[t-1] × (period − 1) + Loss[t]) / period
Step 3 — Relative Strength and RSI:
RS = AvgGain / AvgLoss
RSI = 100 − (100 / (1 + RS))
The Wilder smoothing is roughly equivalent to an EMA with a smoothing factor of 1/period (slower than a same-period EMA, faster than an SMA). This is the original Wilder method — most other RSI implementations use it.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 14 | 2–100 | Wilder's original. Lookback for the average gains and losses. |
Recommended periods
- 2–9 (fast): Short-term scalping and aggressive mean-reversion. Connie Brown's 2-period RSI is a known short-window variant. Very reactive, more whipsaws.
- 14 (default): Wilder's original. The most-used setting across timeframes.
- 20–25: Slower readings for swing trading and regime classification on daily bars.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| RSI Value | Numeric | Always | The 0-100 oscillator. The primary reading. |
| Slope | Numeric | On select | Bar-over-bar change in RSI. Rising = momentum strengthening; falling = weakening. |
| Average Win | Numeric | On select | The smoothed average of recent gains — the numerator of RS. |
| Average Loss | Numeric | On select | The smoothed average of recent losses — the denominator of RS. |
RSI node — default state with all four outputs
How to read it
- RSI > 70: Recent gains have been substantial relative to losses. Conventionally called "overbought" — but in strong trends RSI can stay above 70 for many bars.
- RSI < 30: Recent losses have been substantial. "Oversold" with the same caveat.
- RSI near 50: Roughly balanced momentum.
- Rising RSI: Upside momentum strengthening relative to downside.
- Falling RSI: Downside momentum strengthening relative to upside.
- RSI crossing 50: A clean midline cross — net momentum has shifted direction.
- Divergence with price: Price makes a new high but RSI doesn't (bearish), or new low but RSI doesn't (bullish) — common reversal warning.
RSI's extremes do not automatically mean reversal. In a strong uptrend, RSI > 70 confirms the uptrend is working — selling every overbought reading loses money continuously. Always read RSI alongside a regime check before interpreting extremes as reversal signals.
Best in / worst in
Best in range-bound markets and as a confirmation tool alongside trend indicators. The midline cross (RSI through 50) is one of the cleanest single-bar momentum signals in technical analysis.
Worst in strong sustained trends where RSI can stay above 70 (or below 30) for many bars at a time. Pure "fade the extremes" strategies bleed continuously during these periods. Always combine with a regime filter.
Three setups
1. Mean reversion with regime filter
The textbook RSI entry, with a regime check that prevents the most common failure mode.
- Long: RSI < 30 AND RSI Slope > 0 (turning back up) AND KAMA ER < 0.3 (range regime confirmed).
- Short: RSI > 70 AND RSI Slope < 0 AND ER < 0.3.
The KAMA ER filter is what makes this setup safe — fading RSI extremes in trending regimes is the textbook way to lose money continuously.
RSI mean-reversion gated by range regime
2. Pullback to the 50-line in a trend
Use the RSI 50-line as a pullback timing signal in established trends.
- Long pullback (uptrend): Price > EMA(50) AND RSI was > 60 in the last 10 bars AND RSI now pulls back to between 40 and 55 AND RSI Slope > 0 (turning back up).
- Short pullback (downtrend): Symmetric.
The trend filter ensures direction; the RSI pullback-to-midline times the entry. Captures continuation moves with better R:R than chasing breakouts.
3. Divergence detection
Price makes a new high but RSI makes a lower high (bearish divergence), or price makes a new low but RSI makes a higher low (bullish divergence).
- Bearish divergence: Price's 10-bar high > price's 10-bar high from 10 bars ago AND RSI's 10-bar high < RSI's 10-bar high from 10 bars ago.
- Bullish divergence: Symmetric for lows.
Wire via BarsAgo Modifier comparisons. Pair with a range-regime filter for best results.
Advanced patterns in AlgoLift
RSI midline as a regime gate for unrelated strategies. Use RSI > 50 / RSI < 50 as a binary direction flag in front of a price-action or breakout strategy. When the regime gate disagrees with the entry direction, skip the trade. A simple, no-tuning filter that improves most strategies.
RSI/MFI confluence for high-conviction entries. Run both indicators in parallel. Trade extremes only when both agree (RSI < 30 AND MFI < 20 for longs). The volume confirmation built into MFI eliminates many false RSI signals at zero extra cost.
Multi-timeframe RSI agreement. Add a 1h data series alongside your 5m execution chart. Only allow 5m RSI entries when the 1h RSI is in the corresponding state (1h RSI < 40 for long entries, 1h RSI > 60 for short entries). The higher-timeframe context filters most noise on the execution timeframe. See the multi-series Visual Builder pattern.
RSI Slope for trade-management timing. Once in a long position, watch the RSI Slope output. When the slope flips from positive to negative for 3+ consecutive bars (use a Tally node), momentum is exhausting — take partial profits via Set Target Profit on a fractional position size. Captures the cyclical-exit timing more precisely than fixed price targets.
Multi-timeframe RSI agreement — 1h gate on 5m entries
Common mistakes
- Treating every overbought / oversold reading as a reversal. RSI > 70 in a strong uptrend isn't a sell signal — it's confirmation the uptrend is working. Always check trend context before fading.
- Using RSI alone on trending instruments. A pure RSI-extreme strategy on a sustained-trend instrument (NQ during the 2020-2021 rally, BTC during late-2020) lost money continuously because every "overbought" reading was followed by more upside.
- Optimizing the period too aggressively. A strategy that works at exactly RSI(13) but fails at RSI(14) is fit to a coincidence. See overfitting in trading for the diagnostic — the parameter surface should be a plateau, not a spike.
- Ignoring the Slope output. Slope flips often precede RSI's level changes by 1-2 bars. Strategies that only read the value miss the earliest signal in the indicator.