TickAtlas
Trading Strategies 10 min read · March 15, 2026

Understanding RSI Divergence for Better Trade Entries

How to identify and trade RSI divergence patterns using real-time API data. Includes code examples and backtesting results.

CG
By the TickAtlas team

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:

http
GET /v1/indicator?symbol=EURUSD&indicator=RSI_14&timeframe=H1&bars=50

# 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.

Related Reading

Try this with live data

Every account gets $2.50 in free PAYG credits. No card required — paste your API key and run the code above against live broker data.