Loading…

RSI Divergence Detector

Spotting RSI divergence by eye means holding two price swings and two RSI readings in your head at once, and it is easy to convince yourself of a divergence that a stricter definition would reject. This indicator finds confirmed swing highs and lows in price using a symmetric fractal check - InpPivotBars bars lower (or higher) on both sides - then compares each new confirmed pivot against the immediately preceding one of the same type. A lower price low paired with a higher RSI low is marked as bullish divergence; a higher price high paired with a lower RSI high is marked as bearish divergence. A trendline is drawn connecting the two RSI pivot values directly in the RSI subwindow, so the divergence is visible on the oscillator itself rather than only as an arrow. Every pivot requires InpPivotBars of already-closed bars on both sides before it counts, so a divergence call is never made on a still-forming swing and never gets revised once made - it can only be "not yet confirmed", never "confirmed then withdrawn a few bars later" the way a same-bar or unconfirmed pivot method can be. The comparison itself walks the chart once, oldest to newest, keeping a running note of the last confirmed swing low and swing high rather than re-searching the chart backward for every new pivot. That single pass keeps the indicator responsive even on a chart with years of history loaded, where a naive "search backward for the previous pivot" approach would slow down sharply the more history is on screen. Notes and limitations - Only regular divergence is detected (price extreme vs. RSI extreme moving opposite directions) - hidden divergence, used for continuation reads, is not covered by this version. - A pivot needs InpPivotBars bars to have already printed on its right side, so every divergence confirms InpPivotBars bars after the swing itself, not on the swing bar in real time. This delay is the cost of a confirmed, non-repainting signal. - Divergence detection and drawing runs once per newly closed bar, not on every tick, since pivot confirmation cannot change intrabar. - This flags a condition, not a trade signal on its own - it does not account for the prevailing trend, support and resistance, or risk management.

Indicator · MT5 · v1.0 · Free

About RSI Divergence Detector

RSI Divergence Detector is an indicator for MetaTrader 5 based on Divergence and RSI. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Rsi period, Pivot bars and Draw lines. MQL source code included.

Files in the download: RsiDivergence.ex5, RsiDivergence.mq5, RsiDivergence.txt.

Settings

SettingDefaultWhat it does
Rsi period14RSI period
Pivot bars3Bars required on each side to confirm a swing pivot
Draw linestrueDraw a trendline between the two RSI pivots on a confirmed divergence
AlertstrueAlert once when a new divergence confirms

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: RSI · Pivot Points · Divergence · Fractals · Oscillator · Trend · Buy/Sell Arrows · Alerts · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria