relative strength indicator
The Relative Strength Index (RSI) is a momentum oscillator used in technical analysis to measure the speed and change of price movements. It helps traders identify overbought or oversold conditions, potential reversals, and trend strength. Developed by J. Welles Wilder, RSI is calculated using price data over a specified period, typically 14 periods (e.g., days, hours, or other timeframes).
How RSI is Calculated
The RSI formula is:
RSI = 100 - (100 / (1 + RS))
Where:
- RS (Relative Strength) = Average Gain / Average Loss over the specified period.
- Average Gain = Sum of gains over the period / Number of periods.
- Average Loss = Sum of losses over the period / Number of periods.
Steps:
- Calculate price changes (gains or losses) for each period.
- Separate gains (positive changes) and losses (negative changes, taken as absolute values).
- Compute the average gain and average loss over the chosen period (e.g., 14 periods).
- Calculate RS = Average Gain / Average Loss.
- Plug RS into the RSI formula to get a value between 0 and 100.
Default Settings:
- Period: 14 (most common, adjustable to 9, 21, etc., for sensitivity).
- Overbought Threshold: RSI ≥ 70.
- Oversold Threshold: RSI ≤ 30.
RSI Signals
RSI provides several types of signals for trading decisions:
1. Overbought and Oversold Conditions
- Overbought (RSI ≥ 70): Asset may be overvalued, signaling a potential downward correction or reversal.
- Oversold (RSI ≤ 30): Asset may be undervalued, indicating a potential upward bounce or reversal.
- Trading Action: Overbought: Consider selling or shorting, especially with confirmation from bearish candlestick patterns or resistance levels; Oversold: Consider buying or going long, ideally with bullish candlestick patterns or support levels; Caution: Overbought/oversold conditions can persist in strong trends, so avoid trading solely on RSI without confirmation.
2. Centerline Crossovers (RSI around 50)
- RSI crossing above 50 indicates bullish momentum (potential buy signal).
- RSI crossing below 50 suggests bearish momentum (potential sell signal).
- Trading Action: Use centerline crossovers to confirm trend direction, often with moving averages or trendlines.
3. Divergences
- Bullish Divergence: Price makes a lower low, but RSI makes a higher low, indicating weakening bearish momentum and a potential upward reversal.
- Bearish Divergence: Price makes a higher high, but RSI makes a lower high, signaling weakening bullish momentum and a potential downward reversal.
- Trading Action:
- Bullish Divergence: Look for buying opportunities near support levels; Bearish Divergence: Consider selling or shorting near resistance levels; Note: Divergences are more reliable on longer timeframes (e.g., daily or weekly charts).
4. Trend Confirmation
- RSI between 40 and 60 indicates a neutral zone with no strong trend.
- RSI consistently above 50 (especially 60; 70) confirms an uptrend.
- RSI consistently below 50 (especially 30; 40) confirms a downtrend.
- Trading Action: Use RSI to confirm trends before entering trend-following trades (e.g., with moving averages or ADX).
5. Failure Swings
- Bullish Failure Swing: RSI drops below 30, rises above 30, pulls back without breaking below 30, then breaks above the previous RSI high. Signals a bullish reversal.
- Bearish Failure Swing: RSI rises above 70, drops below 70, rallies without breaking above 70, then breaks below the previous RSI low. Signals a bearish reversal.
- Trading Action: Trade failure swings as reversal signals, confirmed by price action or other indicators.
How to Trade RSI Signals
General Guidelines
- Combine RSI with Other Indicators: Use with support/resistance, moving averages, candlestick patterns, or volume analysis to avoid false signals.
- Timeframe Matters: Shorter timeframes (e.g., 5-minute) produce more signals but are noisier; longer timeframes (e.g., daily) are more reliable.
- Risk Management: Use stop-loss orders and proper position sizing to manage risk.
- Market Context: RSI works best in range-bound markets. In strong trends, use trend indicators (e.g., ADX or MACD) to filter signals.
Trading Strategies
- Overbought/Oversold Reversal Strategy:
- Buy Setup:
- RSI drops below 30 (oversold).
- Wait for RSI to cross above 30, confirmed by a bullish candlestick (e.g., hammer) or support level.
- Enter long position with stop-loss below recent lows.
- Target: Next resistance or 1:2 risk-reward ratio.
- Sell Setup:
- RSI rises above 70 (overbought).
- Wait for RSI to cross below 70, confirmed by a bearish candlestick (e.g., shooting star) or resistance level.
- Enter short position with stop-loss above recent highs.
- Target: Next support or 1:2 risk-reward ratio.
- Buy Setup:
- Divergence Trading Strategy:
- Bullish Divergence:
- Identify lower low in price with higher low in RSI.
- Confirm with support level or bullish price action (e.g., double bottom).
- Enter long position with stop-loss below recent low.
- Target: Next resistance or Fibonacci retracement level.
- Bearish Divergence:
- Identify higher high in price with lower high in RSI.
- Confirm with resistance level or bearish price action (e.g., double top).
- Enter short position with stop-loss above recent high.
- Target: Next support or Fibonacci retracement level.
- Bullish Divergence:
- Trend-Following with RSI:
- Buy in Uptrend:
- RSI stays above 50, ideally 50; 70.
- Wait for pullback to support or moving average (e.g., 20 EMA).
- Enter long when RSI crosses above 50, confirmed by price breaking above moving average.
- Stop-loss: Below recent swing low.
- Target: Next resistance or trailing stop.
- Sell in Downtrend:
- RSI stays below 50, ideally 30; 50.
- Wait for rally to resistance or moving average.
- Enter short when RSI crosses below 50, confirmed by price breaking below moving average.
- Stop-loss: Above recent swing high.
- Target: Next support or trailing stop.
- Buy in Uptrend:
- Failure Swing Strategy:
- Bullish Failure Swing:
- RSI drops below 30, rises above 30, pulls back, and breaks above prior RSI high.
- Enter long on RSI breakout, confirmed by price breaking above recent high.
- Stop-loss: Below recent price low.
- Target: Next resistance level.
- Bearish Failure Swing:
- RSI rises above 70, drops below 70, rallies, and breaks below prior RSI low.
- Enter short on RSI breakdown, confirmed by price breaking below recent low.
- Stop-loss: Above recent price high.
- Target: Next support level.
- Bullish Failure Swing:
Tips
Adjust Period for Sensitivity:
- Shorter periods (e.g., 9) for scalping.
- Longer periods (e.g., 21) for swing trading.
Backtest Strategies: Use historical data with Python libraries like backtrader
or zipline
.
Market Type:
- RSI excels in range-bound markets (e.g., stocks or forex in consolidation).
- In trending markets, use RSI for trend confirmation or pullback entries.
Divergence Confirmation: Wait for price action or volume confirmation to avoid premature entries.