RSI divergence is one of the most powerful signals in technical analysis. When price makes a new high but RSI doesn't, it often signals an impending reversal. Here's how to detect and trade it programmatically.
What is RSI Divergence?
Divergence occurs when the price and an indicator move in opposite directions. There are two types:
Bullish Divergence
Price makes a lower low, but RSI makes a higher low. Signals weakening downward momentum — potential reversal upward.
Bearish Divergence
Price makes a higher high, but RSI makes a lower high. Signals weakening upward momentum — potential reversal downward.
Detecting Divergence with the API
Use the TickAtlas API to fetch historical RSI and price data, then compare peaks and troughs:
GET /v1/indicator/history?symbol=EURUSD&indicator=RSI_14&timeframe=H1&limit=50
# -> {"data": {"series": [{"time": "...", "value": 41.2}, ...]}}
# Compare the last two RSI troughs against the last two price lows
# If price_low_2 < price_low_1 but rsi_low_2 > rsi_low_1
# = Bullish divergence detected Trading Rules
- Entry: After bullish divergence confirmed on H1, enter long when RSI crosses above 30
- Confirmation: Look for MACD histogram turning positive for additional confluence
- Stop loss: Below the most recent swing low (the second lower low)
- Take profit: Previous resistance level or 2:1 reward-to-risk ratio
- Timeframe: Most reliable on H1 and H4. Avoid M1/M5 (too noisy)
Common Mistakes
Trading divergence against the trend
Bullish divergence in a strong downtrend often fails. Always check ADX and higher timeframe trend first.
Entering too early
Divergence signals the potential for reversal, not the reversal itself. Wait for confirmation (RSI crossing key levels).
Ignoring the timeframe
Divergence on M5 is far less reliable than on H4 or D1. Higher timeframes give stronger signals.
Run this against live data.
Every account starts pay-as-you-go with $2.50 of credit and no card. Paste the key into the samples above and the requests work unchanged.