RSI Divergence Strategy
Learn to build a mean-reversion strategy that detects RSI divergences - powerful signals that often precede trend reversals. This advanced tutorial teaches you to identify when price and momentum are misaligned.
Strategy Overview
RSI divergence occurs when:
- Bullish Divergence: Price makes lower lows, but RSI makes higher lows (reversal up likely)
- Bearish Divergence: Price makes higher highs, but RSI makes lower highs (reversal down likely)
Expected Performance
- Win Rate: 55-65% (higher than trend-following)
- Profit Factor: 1.6-2.2
- Best Markets: Range-bound or consolidating stocks
- Timeframe: 1h to 4h (divergences need time to develop)
- Risk-Reward: 1:2 to 1:3
Understanding RSI Divergence
What is RSI?
Relative Strength Index (RSI) measures momentum on a scale of 0-100:
- Above 70: Overbought (potential reversal down)
- Below 30: Oversold (potential reversal up)
- 50: Neutral
Formula: RSI = 100 - (100 / (1 + RS))
- RS = Average Gain / Average Loss over period (typically 14)
Bullish Divergence Example
Price: ↓ Lower Low ↓ Even Lower Low
$95 $90
RSI: ↓ Low ↑ Higher Low
25 28
Signal: Bullish divergence → Expect price reversal UP
Why It Works: Price is making new lows, but momentum (RSI) is weakening. Sellers are losing strength, buyers may take control.
Bearish Divergence Example
Price: ↑ Higher High ↑ Even Higher High
$110 $115
RSI: ↑ High ↓ Lower High
75 72
Signal: Bearish divergence → Expect price reversal DOWN
Why It Works: Price is making new highs, but momentum is weakening. Buyers are losing strength, sellers may take control.
Step 1: Basic Configuration
{
"name": "RSI Divergence Hunter",
"description": "Mean reversion strategy using RSI divergence detection",
"strategyType": "mean_reversion",
"timeframe": "1h",
"symbols": ["NSE:RELIANCE", "NSE:HDFC", "NSE:ICICIBANK"]
}
- 1h: Good balance, enough time for divergences to form
- 4h: More reliable signals, fewer false positives
- 15m: Too noisy, many false divergences
- 1d: Very reliable but infrequent signals
Step 2: Position Sizing
Use percentage-based with conservative sizing:
{
"method": "percentage",
"percentage": 2.5
}
Mean reversion strategies can have lower win rates initially, so start conservative.
Step 3: Entry Conditions - Bullish Divergence
Condition 1: RSI Oversold
{
"type": "indicator_value",
"indicator": "RSI",
"period": 14,
"operator": "below",
"value": 35
}
RSI must be in oversold territory (below 35, not the extreme 30).
Condition 2: Price Making Lower Low
{
"type": "price_indicator",
"priceType": "low",
"indicator": "SMA",
"period": 5,
"operator": "below",
"lookback": 10
}
Current low is below the lowest low of the past 10 candles.
Condition 3: RSI Making Higher Low (Divergence)
{
"type": "indicator_indicator",
"indicator1": "RSI",
"period1": 14,
"indicator2": "RSI",
"period2": 14,
"operator": "above",
"lookback": 10
}
Current RSI low is higher than RSI low from 10 candles ago, while price made a lower low.
Condition 4: Price Action Confirmation
{
"type": "candlestick_pattern",
"pattern": "hammer",
"or": "bullish_engulfing"
}
Wait for a bullish candlestick pattern to confirm reversal.
Complete Entry Configuration
{
"positionType": "both",
"logicalOperator": "AND",
"confirmationCandles": 1,
"conditions": [
{
"type": "indicator_value",
"indicator": "RSI",
"period": 14,
"operator": "below",
"value": 35
},
{
"type": "price_indicator",
"priceType": "low",
"indicator": "SMA",
"period": 5,
"operator": "below",
"lookback": 10
},
{
"type": "indicator_indicator",
"indicator1": "RSI",
"period1": 14,
"indicator2": "RSI",
"period2": 14,
"operator": "above",
"lookback": 10
},
{
"type": "candlestick_pattern",
"patterns": ["hammer", "bullish_engulfing"]
}
]
}
Step 4: Exit Conditions
Stop Loss: Below Recent Low
{
"type": "indicator",
"indicator": "Low",
"period": 5,
"offset": -0.5
}
Place stop 0.5% below the lowest low of the past 5 candles.
Example:
Entry: ₹2,000
Lowest low (5 candles): ₹1,980
Stop loss: ₹1,980 - 0.5% = ₹1,970
Risk: ₹30 per share (1.5%)
Take Profit: Multiple Targets
{
"type": "multiple_targets",
"targets": [
{
"percentage": 2,
"exitPercentage": 50,
"moveStopTo": "breakeven"
},
{
"percentage": 4,
"exitPercentage": 50
}
]
}
Exit Strategy:
- First Target (2%): Exit 50%, move stop to breakeven
- Second Target (4%): Exit remaining 50%
This gives a 1:2.67 average risk-reward ratio.
RSI Exit Signal
{
"type": "indicator_value",
"indicator": "RSI",
"period": 14,
"operator": "above",
"value": 70
}
Exit when RSI reaches overbought (70), indicating reversal is complete.
Time-Based Exit
{
"maxHoldTime": 480
}
Exit after 480 minutes (8 hours on 1h timeframe) if targets not hit. Prevents holding losing positions too long.
Step 5: Risk Parameters
{
"maxPositionSize": 10,
"maxDailyLoss": 3,
"maxOpenPositions": 3,
"riskRewardRatio": 2
}
Conservative parameters for mean reversion:
- Smaller position sizes (10% max)
- Tighter daily loss limit (3%)
- Fewer concurrent positions (3 max)
Complete Strategy Configuration
{
"name": "RSI Divergence Hunter",
"description": "Mean reversion using RSI divergence with price action confirmation",
"strategyType": "mean_reversion",
"timeframe": "1h",
"symbols": ["NSE:RELIANCE", "NSE:HDFC", "NSE:ICICIBANK"],
"positionSizing": {
"method": "percentage",
"percentage": 2.5
},
"entryConditions": {
"positionType": "both",
"logicalOperator": "AND",
"confirmationCandles": 1,
"conditions": [
{
"type": "indicator_value",
"indicator": "RSI",
"period": 14,
"operator": "below",
"value": 35
},
{
"type": "price_indicator",
"priceType": "low",
"indicator": "SMA",
"period": 5,
"operator": "below",
"lookback": 10
},
{
"type": "indicator_indicator",
"indicator1": "RSI",
"period1": 14,
"indicator2": "RSI",
"period2": 14,
"operator": "above",
"lookback": 10
},
{
"type": "candlestick_pattern",
"patterns": ["hammer", "bullish_engulfing"]
}
]
},
"exitConditions": {
"stopLoss": {
"type": "indicator",
"indicator": "Low",
"period": 5,
"offset": -0.5
},
"takeProfit": {
"type": "multiple_targets",
"targets": [
{
"percentage": 2,
"exitPercentage": 50,
"moveStopTo": "breakeven"
},
{
"percentage": 4,
"exitPercentage": 50
}
]
},
"additionalExits": [
{
"type": "indicator_value",
"indicator": "RSI",
"period": 14,
"operator": "above",
"value": 70
}
],
"maxHoldTime": 480
},
"riskParameters": {
"maxPositionSize": 10,
"maxDailyLoss": 3,
"maxOpenPositions": 3,
"riskRewardRatio": 2
}
}
Backtesting and Interpretation
Expected Backtest Results
Good Performance:
Total Trades: 35-50
Win Rate: 58%
Profit Factor: 1.9
Average Win: ₹85
Average Loss: ₹45
Max Drawdown: -6.5%
Key Metrics to Watch:
- Win Rate: Should be 55-65% (higher than trend-following)
- Average Win/Loss Ratio: Should be 1.5-2.0
- Max Consecutive Losses: Should be ≤ 5
Trade Analysis
Look at individual trades:
- Winning Trades: Should cluster around support levels
- Losing Trades: Often occur during strong trends (divergence fails)
- Best Performers: Trades with clear divergence + strong candlestick pattern
Advanced Enhancements
1. Add MACD Confirmation
{
"type": "indicator_indicator",
"indicator1": "MACD",
"indicator2": "Signal",
"operator": "crosses_above"
}
MACD crossing above signal line confirms bullish momentum shift.
2. Volume Spike Filter
{
"type": "indicator_value",
"indicator": "Volume",
"period": 20,
"operator": "above",
"multiplier": 1.5
}
Volume should be 1.5× average, confirming genuine reversal interest.
3. Support/Resistance Levels
{
"type": "price_level",
"level": "support",
"tolerance": 1
}
Enter only near identified support levels (within 1%).
4. Trend Filter
{
"type": "price_indicator",
"priceType": "close",
"indicator": "SMA",
"period": 200,
"operator": "above"
}
Only take bullish divergences when price is above 200 SMA (long-term uptrend).
Common Pitfalls
1. False Divergences
Problem: Not all divergences lead to reversals.
Solution:
- Require candlestick pattern confirmation
- Check for support/resistance nearby
- Avoid divergences in strong trends
- Use longer timeframes (4h instead of 1h)
2. Entering Too Early
Problem: Divergence forms but price continues lower.
Solution:
- Wait for confirmation candle
- Require RSI to start rising (not just diverging)
- Check for volume increase
- Use tighter stops
3. Holding Too Long
Problem: Reversal completes but position not exited.
Solution:
- Use RSI overbought exit (70 level)
- Implement time-based exit (8 hours max)
- Take partial profits early
- Trail stop after first target
4. Ignoring Market Context
Problem: Strategy fails during strong trends.
Solution:
- Add trend filter (200 SMA)
- Pause during high-momentum periods
- Check ADX (avoid when ADX > 30)
- Monitor market regime
Optimization Guidelines
If Win Rate Too Low (<50%)
- Tighten RSI threshold: Use 30 instead of 35
- Require stronger patterns: Only hammer or bullish engulfing
- Add volume confirmation: Volume must be above average
- Use longer lookback: 15 candles instead of 10
If Profit Factor Low (<1.5)
- Widen targets: Use 3% and 6% instead of 2% and 4%
- Tighten stops: Use 3-candle low instead of 5
- Exit faster on RSI: Exit at 65 instead of 70
- Add trailing stop: Trail by 1% after 2% profit
If Too Few Signals
- Relax RSI threshold: Use 40 instead of 35
- Reduce lookback period: 7 candles instead of 10
- Add more symbols: Trade 5-7 stocks
- Use shorter timeframe: 30m instead of 1h
When to Use This Strategy
Best Conditions
- ✅ Range-bound markets
- ✅ After strong trends (exhaustion)
- ✅ Near support/resistance levels
- ✅ Low volatility periods
Avoid When
- ❌ Strong trending markets
- ❌ High volatility (VIX > 30)
- ❌ News-driven moves
- ❌ Low liquidity stocks
Next Steps
1. Combine with Trend-Following
Run both strategies:
- RSI Divergence for reversals
- EMA Crossover for trends
- Diversifies signal types
- Smooths equity curve
2. Add Multi-Timeframe
Confirm divergences on higher timeframe:
- 1h divergence + 4h trend alignment
- Increases reliability
- Reduces false signals
Learn more: Multi-Timeframe Strategy
3. Optimize Parameters
Test different settings:
- RSI periods (9, 14, 21)
- Lookback periods (7, 10, 15)
- RSI thresholds (30, 35, 40)
Learn more: Strategy Optimization
4. Deploy Carefully
Mean reversion requires patience:
- Paper trade for 4-6 weeks
- Start with 1-2 symbols
- Monitor false divergences
- Track win rate closely
Learn more: Paper to Live Transition
Summary
You've learned to build an RSI divergence strategy with:
- ✅ Bullish and bearish divergence detection
- ✅ Price action confirmation (candlestick patterns)
- ✅ Multiple exit targets for optimal profit-taking
- ✅ RSI-based exit signals
- ✅ Time-based risk management
- ✅ Conservative position sizing
Key Concepts:
- Divergences signal momentum shifts before price
- Confirmation is critical (candlestick patterns, volume)
- Mean reversion works best in ranging markets
- Higher win rates than trend-following
- Requires patience and discipline
This strategy excels at catching reversals but struggles in strong trends. Consider combining with a trend-following strategy for a balanced approach.
Ready to add timeframe confirmation? Try the Multi-Timeframe Strategy next!