Systemicbeta

Relative Strength Index

systemic:core-rsiIndicators

Inputs

NameTypeDescription
WindowWhole numberThe number of bars used to average gains and losses.
PriceNumber seriesThe price series to analyze.

Outputs

NameTypeDescription
RSINumber seriesThe Relative Strength Index for each bar, from 0 to 100.

Cost

6
credits per run
1,000
bars

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.

RSI=100−1001+RSRSI = 100 - \frac{100}{1 + RS}

Where RS (Relative Strength) is the ratio of smoothed average gains to smoothed average losses:

RS=Average GainAverage LossRS = \frac{\text{Average Gain}}{\text{Average Loss}}

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 tt, compute the change from the previous bar:

ΔPt=Pt−Pt−1\Delta P_t = P_t - P_{t-1}

Step 2: Separate Gains and Losses

Separate upward moves (gains) from downward moves (losses):

Gaint=max⁡(ΔPt,0)\text{Gain}_t = \max(\Delta P_t, 0) Losst=∣min⁡(ΔPt,0)∣\text{Loss}_t = |\min(\Delta P_t, 0)|

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 α=1/n\alpha = 1/n:

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):

Avg Gaint=(Avg Gaint−1)×(n−1)+Gaintn\text{Avg Gain}_t = \frac{(\text{Avg Gain}_{t-1}) \times (n-1) + \text{Gain}_t}{n}

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 nn bars. RSI is empty for the first n−1n - 1 bars.

Step 4: Calculate RSI

RS=Average GainAverage LossRS = \frac{\text{Average Gain}}{\text{Average Loss}} RSI=100−1001+RSRSI = 100 - \frac{100}{1 + RS}

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 RangeZoneInterpretation
70–100🔴 OverboughtStrong bullish momentum; potential exhaustion. Watch for reversal signals.
50–70🟢 BullishUpward momentum dominates. Trend followers stay long.
30–50🟠 BearishDownward momentum dominates. Trend followers stay short or in cash.
0–30🔵 OversoldStrong 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 TypeSuggested OversoldSuggested OverboughtRationale
Stocks (normal)3070Classic Wilder thresholds
Strong uptrend4080Overbought persists longer in bull markets
Strong downtrend2060Oversold persists longer in bear markets
Cryptocurrency2080Higher volatility requires wider bands
Forex (major pairs)3070Classic 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:

WindowSensitivityBest For
7Very HighScalping, day trading, catching quick reversals
9HighShort-term swing trading
14Balanced ⭐Wilder's original; works well for most uses
21LowPosition trading, filtering noise
25+Very LowLong-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:

SignalConditionAction
Oversold bounceRSI drops below 30, then rises back above 30Consider buying
Overbought reversalRSI rises above 70, then falls back below 70Consider 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:

TypePrice ActionRSI ActionSignal
Bullish DivergenceLower lowHigher lowSelling pressure weakening → potential upward reversal
Bearish DivergenceHigher highLower highBuying 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:

  1. RSI falls below 30 (oversold)
  2. RSI bounces above 30
  3. RSI pulls back but holds above 30
  4. 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:

  1. Price is above the 200-bar SMA (confirming an uptrend)
  2. 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

PitfallWhy It's DangerousSolution
Buying purely on RSI < 30Oversold can get more oversoldWait for RSI to cross back above 30
Shorting at RSI > 70Overbought can persist in strong trendsConfirm with trend analysis
Using one periodMiss the bigger pictureCheck the RSI of a longer period for context
Ignoring the trendMean reversion fails in trendsCombine 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]
DimensionStocksCryptoExplanation
Popularity9/108/10One of the most widely used indicators globally; taught in virtually every technical analysis course
Reliability7/106/10Highly reliable in ranging markets; less so in strong trends where it can stay overbought/oversold
Complexity3/103/10Simple concept (measuring gain vs. loss strength); Wilder smoothing adds minor complexity
Versatility9/108/10Works across all periods, all asset classes; multiple strategies (divergence, crossover, zones)
Recent Interest7/108/10Evergreen indicator with steady interest; crypto traders particularly favor momentum indicators

Further Reading

Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5