Relative Strength Index
systemic:core-rsiIndicatorsInputs
| Name | Type | Description |
|---|---|---|
| Window | Whole number | The number of bars used to average gains and losses. |
| Price | Number series | The price series to analyze. |
Outputs
| Name | Type | Description |
|---|---|---|
| RSI | Number series | The Relative Strength Index for each bar, from 0 to 100. |
Cost
0.213 + 0.00568·n credits for n bars, rounded up. The marks are each plan's limit of bars.
The Relative Strength Index (RSI) is one of the most widely used momentum oscillators in technical analysis. J. Welles Wilder Jr. introduced it in his 1978 book New Concepts in Technical Trading Systems. The RSI measures the speed and size of price moves to identify overbought and oversold conditions.
Price can trend without limit, but RSI is bounded between 0 and 100. This makes it easy to read and to compare across assets and periods.
Where RS (Relative Strength) is the ratio of smoothed average gains to smoothed average losses:
Understanding RSI: The Intuition
RSI asks a simple question: "How strong are the bulls compared to the bears?"
- When prices keep rising, gains grow and losses shrink → RS increases → RSI approaches 100
- When prices keep falling, losses grow and gains shrink → RS approaches 0 → RSI approaches 0
- When buying and selling pressure are balanced → RS ≈ 1 → RSI ≈ 50
flowchart TD
subgraph Input["📊 Price Data"]
P["Closing Prices"]
end
subgraph Changes["Δ Price Changes"]
D["Calculate Bar-to-Bar Changes<br/>ΔP = Pₜ − Pₜ₋₁"]
end
subgraph Separate["Separate Movements"]
G["Gains: Δ > 0"]
L["Losses: Δ < 0"]
end
subgraph Smooth["Wilder Smoothing"]
AG["Average Gain"]
AL["Average Loss"]
end
subgraph Calculate["RSI Calculation"]
RS["RS = Avg Gain / Avg Loss"]
RSI["RSI = 100 − 100 / (1 + RS)"]
end
P --> D
D --> G & L
G --> AG
L --> AL
AG & AL --> RS --> RSI
The Mathematics in Detail
The RSI calculation, step by step.
Step 1: Calculate Price Changes
For each bar , compute the change from the previous bar:
Step 2: Separate Gains and Losses
Separate upward moves (gains) from downward moves (losses):
Note: Losses are expressed as positive values. A price drop of $5 produces a Loss of 5, not -5.
Step 3: Apply Wilder's Smoothing
This is where RSI differs from a simple moving average. Wilder's smoothing is an exponential moving average (EMA) with a smoothing factor :
First bar: it has no earlier price, so its gain and loss are 0 and both averages start at 0.
Every later bar (Wilder Smoothing):
The average loss uses the same formula. The formula gives earlier values more weight, so the indicator is smooth. Unlike a simple moving average, Wilder's smoothing remembers all past data, not just the last bars. RSI is empty for the first bars.
Step 4: Calculate RSI
Edge Case: If Average Loss = 0 (no price has fallen, including a flat price), RSI = 100. If Average Gain = 0 and prices have fallen, RSI = 0.
RSI Zones and Interpretation
The RSI scale divides into zones:
| RSI Range | Zone | Interpretation |
|---|---|---|
| 70–100 | 🔴 Overbought | Strong bullish momentum; potential exhaustion. Watch for reversal signals. |
| 50–70 | 🟢 Bullish | Upward momentum dominates. Trend followers stay long. |
| 30–50 | 🟠 Bearish | Downward momentum dominates. Trend followers stay short or in cash. |
| 0–30 | 🔵 Oversold | Strong bearish momentum; potential exhaustion. Watch for bounce signals. |
The 50 Line: The Momentum Divider
The 50 level is the balance point between gains and losses:
- RSI > 50: Gains outweigh losses
- RSI < 50: Losses outweigh gains
- RSI crossing 50: A possible shift in momentum
flowchart LR
subgraph Bearish["🐻 Bear Territory"]
OS["Oversold<br/>RSI < 30"]
B["Bearish<br/>30 ≤ RSI < 50"]
end
subgraph Neutral["⚖️ Equilibrium"]
EQ["RSI = 50"]
end
subgraph Bullish["🐂 Bull Territory"]
BU["Bullish<br/>50 < RSI ≤ 70"]
OB["Overbought<br/>RSI > 70"]
end
OS --> B --> EQ --> BU --> OB
Adjusting RSI Thresholds for Different Markets
The classic 30/70 thresholds were designed for stock markets. Other markets may need different levels:
| Market Type | Suggested Oversold | Suggested Overbought | Rationale |
|---|---|---|---|
| Stocks (normal) | 30 | 70 | Classic Wilder thresholds |
| Strong uptrend | 40 | 80 | Overbought persists longer in bull markets |
| Strong downtrend | 20 | 60 | Oversold persists longer in bear markets |
| Cryptocurrency | 20 | 80 | Higher volatility requires wider bands |
| Forex (major pairs) | 30 | 70 | Classic thresholds work well |
Tip: Do not change thresholds arbitrarily. Look at where your asset tends to reverse. A backtest shows which zones worked for each instrument.
Window Selection
The Window input sets how many bars are used in the RSI calculation:
| Window | Sensitivity | Best For |
|---|---|---|
| 7 | Very High | Scalping, day trading, catching quick reversals |
| 9 | High | Short-term swing trading |
| 14 | Balanced ⭐ | Wilder's original; works well for most uses |
| 21 | Low | Position trading, filtering noise |
| 25+ | Very Low | Long-term trend analysis |
The Trade-off
flowchart LR
subgraph Short["Short Window 7-9"]
S1["✓ More signals"]
S2["✓ Faster response"]
S3["✗ More false signals"]
S4["✗ Whipsaws in choppy markets"]
end
subgraph Long["Long Window 21+"]
L1["✓ Fewer false signals"]
L2["✓ Smoother line"]
L3["✗ Slower to react"]
L4["✗ May miss opportunities"]
end
Short -.->|"Trade-off"| Long
Trading Strategies with RSI
Strategy 1: Classic Overbought/Oversold
The simplest RSI strategy:
| Signal | Condition | Action |
|---|---|---|
| Oversold bounce | RSI drops below 30, then rises back above 30 | Consider buying |
| Overbought reversal | RSI rises above 70, then falls back below 70 | Consider selling |
⚠️ Warning: In strong trends, RSI can stay overbought or oversold for a long time. In a strong bull run, RSI may stay above 70 for weeks. Use this strategy in ranging markets, or combine it with a trend filter.
Strategy 2: RSI Divergence
Divergence occurs when price and RSI move in opposite directions. It is often a reversal signal:
| Type | Price Action | RSI Action | Signal |
|---|---|---|---|
| Bullish Divergence | Lower low | Higher low | Selling pressure weakening → potential upward reversal |
| Bearish Divergence | Higher high | Lower high | Buying pressure weakening → potential downward reversal |
Divergence works because it shows shifts in momentum before they appear in price.
Strategy 3: The 50-Line Cross
A trend-following approach:
- Bullish: RSI crosses above 50 → momentum shifting bullish, consider long positions
- Bearish: RSI crosses below 50 → momentum shifting bearish, consider short positions
This gives fewer signals than overbought/oversold, but it is more reliable for trend confirmation.
Strategy 4: Failure Swings (Andrew Cardwell's Method)
A failure swing is a pattern that gives early reversal signals without divergence:
Bullish Failure Swing:
- RSI falls below 30 (oversold)
- RSI bounces above 30
- RSI pulls back but holds above 30
- RSI breaks above the prior bounce high → Buy signal
The pattern shows that sellers could not push RSI back into the oversold zone, a sign of returning strength.
Combining RSI with Other Indicators
RSI works alone, but it is more effective when combined with other indicators:
flowchart TD
subgraph Data["📈 Price Data"]
P["Closing Prices"]
end
subgraph Trend["Trend Filter"]
SMA["SMA-200<br/>Trend Direction"]
end
subgraph Momentum["Momentum"]
RSI["RSI-14<br/>Overbought/Oversold"]
end
subgraph Logic["🔀 Decision Logic"]
AND["AND Gate"]
C1["Price > SMA-200"]
C2["RSI crosses above 30"]
end
subgraph Signal["📍 Trade Signal"]
BUY["Buy Signal"]
end
P --> SMA & RSI
SMA --> C1
RSI --> C2
C1 & C2 --> AND --> BUY
Example System: Only buy when:
- Price is above the 200-bar SMA (confirming an uptrend)
- RSI crosses above 30 (oversold bounce in an uptrend)
This filters out oversold bounces in downtrends, which often fail.
Real-World Application: Sector Rotation
RSI is useful for relative strength analysis across several assets. By comparing RSI values across sectors or assets, you can identify:
- Emerging leaders: Assets with rising RSI while others stagnate
- Weakening sectors: Falling RSI despite overall market strength
- Rotation opportunities: When RSI of asset A peaks while asset B is bottoming
Traders use this approach to spot shifts before they are obvious on price charts.
Common Pitfalls to Avoid
| Pitfall | Why It's Dangerous | Solution |
|---|---|---|
| Buying purely on RSI < 30 | Oversold can get more oversold | Wait for RSI to cross back above 30 |
| Shorting at RSI > 70 | Overbought can persist in strong trends | Confirm with trend analysis |
| Using one period | Miss the bigger picture | Check the RSI of a longer period for context |
| Ignoring the trend | Mean reversion fails in trends | Combine with SMA or ADX |
Strengths and Limitations
✅ Strengths
- Bounded scale (0-100): Easy to interpret, comparable across assets
- Versatile: Works on any asset class and any period
- Multiple uses: Overbought/oversold, divergence, trend confirmation
- Well-researched: Decades of backtesting and academic study
⚠️ Limitations
- Lagging indicator: Based on past prices, so it reacts to moves and does not predict them
- False signals in trends: Can stay overbought or oversold for a long time
- Requires confirmation: Best used with other indicators or price action
Indicator Assessment
%%{init: {"quadrantChart": {"titleFontSize": 14}, "themeVariables": {"quadrant1Fill": "#e8f5e9", "quadrant2Fill": "#fff3e0", "quadrant3Fill": "#ffebee", "quadrant4Fill": "#e3f2fd"}}}%%
quadrantChart
title RSI Indicator Assessment
x-axis Low Popularity --> High Popularity
y-axis Low Reliability --> High Reliability
quadrant-1 High potential
quadrant-2 Established
quadrant-3 Niche
quadrant-4 Widely used
Stocks: [0.90, 0.70]
Crypto: [0.80, 0.60]
| Dimension | Stocks | Crypto | Explanation |
|---|---|---|---|
| Popularity | 9/10 | 8/10 | One of the most widely used indicators globally; taught in virtually every technical analysis course |
| Reliability | 7/10 | 6/10 | Highly reliable in ranging markets; less so in strong trends where it can stay overbought/oversold |
| Complexity | 3/10 | 3/10 | Simple concept (measuring gain vs. loss strength); Wilder smoothing adds minor complexity |
| Versatility | 9/10 | 8/10 | Works across all periods, all asset classes; multiple strategies (divergence, crossover, zones) |
| Recent Interest | 7/10 | 8/10 | Evergreen indicator with steady interest; crypto traders particularly favor momentum indicators |
Further Reading
- RSI - Investopedia — Comprehensive introduction
- RSI Divergence Trading - Investopedia — Understanding divergence patterns
- Trading Divergence and Momentum - Investopedia — Advanced divergence strategies
- RSI Buy and Sell Signals - Investopedia — Practical trading applications
- Wilder, J.W. (1978). New Concepts in Technical Trading Systems — The original source