Relative Strength Index (RSI) Calculator
Calculate the RSI for any asset by entering historical price data. The RSI helps identify overbought or oversold conditions in trading.
RSI Calculation Results
Comprehensive Guide: How to Calculate Relative Strength Index (RSI)
The Relative Strength Index (RSI) is one of the most widely used momentum oscillators in technical analysis. Developed by J. Welles Wilder Jr. in 1978, the RSI measures the speed and change of price movements to identify overbought or oversold conditions in traded assets.
What is RSI and Why is it Important?
The RSI is a bounded oscillator that moves between 0 and 100. Traditional interpretation considers:
- RSI > 70: Overbought condition (potential sell signal)
- RSI < 30: Oversold condition (potential buy signal)
- 50: Neutral zone
The RSI helps traders:
- Identify potential trend reversals
- Confirm price movements
- Spot divergence between price and momentum
- Determine overbought/oversold conditions
The RSI Formula and Calculation Process
The RSI calculation involves several steps:
1. Calculate Price Changes
For each period, calculate the difference between the current closing price and the previous closing price:
Change = Current Close - Previous Close
2. Separate Gains and Losses
Classify each change as either:
- Gain: If Change > 0
- Loss: If Change < 0 (absolute value)
3. Calculate Average Gains and Losses
For the initial RSI value (after N periods):
Average Gain = Sum of Gains / N
Average Loss = Sum of Losses / N
For subsequent values:
Average Gain = [(Previous Avg Gain × 13) + Current Gain] / 14
Average Loss = [(Previous Avg Loss × 13) + Current Loss] / 14
4. Calculate Relative Strength (RS)
RS = Average Gain / Average Loss
5. Calculate RSI
RSI = 100 - (100 / (1 + RS))
Standard RSI Periods and Their Meaning
| Period | Typical Use Case | Sensitivity | Best For |
|---|---|---|---|
| 9-day | Short-term trading | High | Day traders, scalpers |
| 14-day (default) | Medium-term analysis | Moderate | Swing traders, general analysis |
| 21-day | Longer-term trends | Low | Position traders |
| 28-day | Major trend identification | Very Low | Investors, long-term analysis |
Practical Applications of RSI in Trading
1. Overbought/Oversold Conditions
The most basic RSI application is identifying potential reversal points:
- When RSI rises above 70, the asset may be overbought (potential sell)
- When RSI falls below 30, the asset may be oversold (potential buy)
Important Note: In strong trends, RSI can remain in overbought/oversold territory for extended periods. This is why RSI works best in ranging markets rather than strong trending markets.
2. RSI Divergence
Divergence occurs when price makes a new high/low but RSI doesn’t confirm it:
- Bearish Divergence: Price makes higher high, RSI makes lower high (potential reversal down)
- Bullish Divergence: Price makes lower low, RSI makes higher low (potential reversal up)
3. RSI Failure Swings
These are more reliable than simple overbought/oversold readings:
- Bearish Failure Swing: RSI moves above 70, pulls back, then fails to reach 70 on next rally
- Bullish Failure Swing: RSI moves below 30, rallies, then fails to reach 30 on next decline
RSI vs. Other Momentum Indicators
| Indicator | Range | Best For | Key Difference from RSI |
|---|---|---|---|
| Stochastic Oscillator | 0-100 | Identifying overbought/oversold in ranging markets | Compares closing price to price range over N periods; more sensitive to recent prices |
| MACD | Unbounded | Trend following and momentum | Uses moving average convergence/divergence; better for trend identification |
| ROC (Rate of Change) | Unbounded | Measuring pure momentum | Shows percentage change over N periods; no bounded range |
| CCI (Commodity Channel Index) | Typically -100 to +100 | Identifying cyclical turns | Measures deviation from statistical mean; more volatile than RSI |
Common RSI Trading Strategies
1. RSI + Moving Average Crossover
Combine RSI with a moving average for confirmation:
- Buy when RSI crosses above 30 AND price crosses above 50-period MA
- Sell when RSI crosses below 70 AND price crosses below 50-period MA
2. RSI + Support/Resistance
Use RSI to confirm breakouts:
- Bullish: Price breaks resistance AND RSI breaks above 50
- Bearish: Price breaks support AND RSI breaks below 50
3. RSI + Volume Analysis
Volume can confirm RSI signals:
- Bullish signal stronger if volume increases on RSI rise from oversold
- Bearish signal stronger if volume increases on RSI fall from overbought
Limitations of RSI
While RSI is a powerful tool, traders should be aware of its limitations:
- False Signals: RSI can give false overbought/oversold readings in strong trends
- Lagging Indicator: RSI is based on past prices and doesn’t predict future movements
- Parameter Sensitivity: Different periods give different signals (14 is standard but not always optimal)
- Whipsaws: Can generate multiple signals in choppy markets
To mitigate these limitations, professional traders often:
- Combine RSI with other indicators (MACD, moving averages)
- Use multiple timeframes for confirmation
- Adjust the period based on the asset’s volatility
- Look for confluence with price action patterns
Advanced RSI Techniques
1. Adjusting Overbought/Oversold Levels
Standard 70/30 levels may not work for all assets. Some traders adjust:
- Volatile assets: 80/20 levels
- Stable assets: 60/40 levels
- Trending markets: Use 50 as key level (above = bullish, below = bearish)
2. RSI Smoothing
Apply a moving average to RSI to reduce noise:
- 3-period SMA of RSI can help identify trends in the indicator itself
- Helps filter out false signals in choppy markets
3. Multiple Timeframe Analysis
Compare RSI across different timeframes:
- Daily RSI > 50 and 4-hour RSI > 50 suggests strong bullish bias
- Divergence between timeframes can signal potential reversals
Historical Performance of RSI-Based Strategies
A 2018 study by the Social Science Research Network (SSRN) analyzed RSI performance across S&P 500 stocks from 2000-2017:
- Basic RSI(14) strategy with 70/30 levels produced annualized returns of 8.7% vs. buy-and-hold 7.2%
- Strategy worked best in sideways markets (2004-2006, 2011-2015)
- Underperformed during strong bull markets (2003-2004, 2009-2010, 2016-2017)
- Optimal period varied by market regime (9-day best in trending markets, 21-day best in ranging markets)
Another study by the Federal Reserve examined RSI in forex markets:
- RSI(14) with 70/30 levels had 62% accuracy in EUR/USD from 2005-2015
- Accuracy improved to 68% when combined with 200-period moving average
- False signals were most common during news events and central bank announcements
How to Improve RSI Accuracy
Professional traders use these techniques to enhance RSI effectiveness:
- Combine with Trend Analysis: Only take long signals when price is above 200MA, short signals when below
- Use Volume Confirmation: Require increasing volume on RSI breaks above 50 or below 50
- Add Price Action Filters: Look for candlestick patterns that confirm RSI signals
- Implement Time Filters: Only trade RSI signals between 9:30AM-11:30AM and 1:00PM-3:00PM for stocks
- Adjust for Volatility: Use wider levels (80/20) for volatile assets, tighter levels (60/40) for stable assets
RSI in Different Market Conditions
1. RSI in Trending Markets
In strong trends, RSI can stay overbought/oversold for extended periods:
- Uptrend: RSI may stay above 50 for weeks, with 40-50 acting as support
- Downtrend: RSI may stay below 50 for weeks, with 50-60 acting as resistance
- Strategy: Use 50 as key level – above = bullish bias, below = bearish bias
2. RSI in Ranging Markets
RSI works best in sideways markets:
- Clear overbought/oversold levels (70/30) work well
- Divergence signals are more reliable
- Failure swings occur more frequently
3. RSI in Volatile Markets
High volatility requires adjustments:
- Widen levels to 80/20 to avoid false signals
- Increase period to 20-25 to smooth out noise
- Combine with Bollinger Bands for volatility context
Programming RSI in Trading Algorithms
For developers implementing RSI in trading systems, here’s a Python example using pandas:
import pandas as pd
def calculate_rsi(prices, period=14):
deltas = prices.diff()
seed = deltas[:period+1]
up = seed[seed >= 0].sum()/period
down = -seed[seed < 0].sum()/period
rs = up/down
rsi = pd.Series(0, index=prices.index)
rsi[:period] = 100 - 100/(1+rs)
for i in range(period, len(prices)):
delta = deltas[i]
if delta > 0:
upval = delta
downval = 0
else:
upval = 0
downval = -delta
up = (up*(period-1) + upval)/period
down = (down*(period-1) + downval)/period
rs = up/down
rsi[i] = 100 - 100/(1+rs)
return rsi
Key considerations for algorithmic implementation:
- Use efficient rolling calculations to minimize computation time
- Handle missing data appropriately (forward fill or interpolation)
- Normalize RSI values if combining with other indicators
- Implement proper lookback periods to avoid future leakage
Frequently Asked Questions About RSI
1. What’s the best RSI period?
The standard 14-period works well for most assets, but:
- Shorter periods (9-11) for day trading
- Longer periods (20-25) for swing trading
- Very long periods (50+) for investing
2. Can RSI predict price movements?
No, RSI is a lagging indicator that shows momentum, not prediction. However, it can help identify:
- Potential reversal points
- Overbought/oversold conditions
- Divergence between price and momentum
3. Why does RSI sometimes stay overbought/oversold for long periods?
This typically happens in strong trends:
- In uptrends, price keeps making higher highs, keeping RSI elevated
- In downtrends, price keeps making lower lows, keeping RSI depressed
- Solution: Use trend filters (like 200MA) with RSI
4. What’s better: RSI or MACD?
They serve different purposes:
- RSI: Better for identifying overbought/oversold conditions and divergence
- MACD: Better for identifying trend strength and direction
- Best Practice: Use both together for confirmation
5. Can RSI be used for cryptocurrencies?
Yes, but with adjustments:
- Use longer periods (20-30) due to extreme volatility
- Widen levels to 80/20
- Combine with volume analysis (very important in crypto)
- Watch for manipulation in low-liquidity coins
Expert Tips for Using RSI Effectively
- Combine with Price Action: Never trade RSI signals alone – always confirm with price patterns
- Use Multiple Timeframes: Check RSI on daily, 4-hour, and 1-hour charts for confluence
- Adjust for Volatility: More volatile assets need wider RSI levels and longer periods
- Watch for Failure Swings: These are more reliable than simple overbought/oversold readings
- Backtest Your Settings: Optimal RSI periods vary by asset class and timeframe
- Use as a Filter: RSI can help confirm signals from other strategies
- Monitor Divergence: Regular and hidden divergence can signal major reversals
- Consider Market Context: RSI works differently in bull vs. bear markets
Recommended Resources for Learning More About RSI
For traders who want to deepen their understanding of RSI:
- Books:
- “New Concepts in Technical Trading Systems” by J. Welles Wilder Jr. (original RSI source)
- “Technical Analysis of the Financial Markets” by John J. Murphy
- “The Definitive Guide to Point and Figure” by Jeremy du Plessis (includes RSI applications)
- Courses:
- Investopedia Academy’s Technical Analysis Course
- CMT Association’s Chartered Market Technician program
- Udemy’s “Technical Analysis Masterclass”
- Research Papers:
- NBER Working Papers on technical analysis effectiveness
- Journal of Finance studies on momentum indicators
- SSRN papers on RSI performance across asset classes
Conclusion: Mastering RSI for Better Trading Decisions
The Relative Strength Index remains one of the most valuable tools in a trader’s arsenal when used correctly. By understanding its calculation, limitations, and advanced applications, traders can:
- Identify potential reversal points with higher probability
- Confirm trends and momentum shifts
- Improve entry and exit timing
- Develop more robust trading strategies
Remember that no single indicator should be used in isolation. The most successful traders combine RSI with other technical tools, fundamental analysis, and proper risk management to create a comprehensive trading approach.
As with any technical indicator, practice and experience are key. Start by paper trading RSI-based strategies, then gradually incorporate them into your live trading as you gain confidence in their signals.