RSI Divergence Indicator: Pivot Pairs Inside One Pane

Written by Dominic Walsh · Published · Last updated

The rsi divergence indicator keeps everything in one pane. Price makes a lower low while the reading makes a higher one, and the mark lands on the reading rather than on the candle. That keeps the comparison visible.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Separate window (levels 30 / 50 / 70)
Plots 3: RSI, Bull Div, Bear Div
Alerts popup, push notification, email, sound
Inputs 13

What the RSI Divergence Indicator draws on the chart

A dodger blue `RSI` line fills the pane.

`Bull Div` uses arrow 233 and `Bear Div` uses 234.

Both marks sit on the reading itself, not beside price.

References sit at 30, 50 and 70.

  • RSI: line, dodger blue, width 2
  • Bull Div: arrow, lime, width 2, arrow code 233
  • Bear Div: arrow, red, width 2, arrow code 234
Rsi divergence indicator reading with divergence marks on the EURUSD H1 chart.
Rsi divergence indicator reading with divergence marks on the EURUSD H1 chart.

How the RSI Divergence Indicator calculates its values

The reading is built in the file

Average gain and average loss run at `RsiPeriod` `14` with Wilder’s smoothing. No terminal call appears, so the whole calculation stays visible in the source.

Pivots need bars on both sides

`PivotLeft` `5` and `PivotRight` `5` set how many bars a swing must beat. The right side is the delay, since those bars have to close before anything confirms.

The gap can be required

`MinRsiGap` `0.0` ships permissive, so any disagreement counts. Raising it demands a real difference between the two readings rather than a fractional one.

How to read the signals

Marks on the line let you see the two readings being compared.

`MaxBarsBetween` `60` bounds how far apart the paired pivots may sit.

Every mark confirms five bars after its pivot.

A disagreement can persist for a long time before price responds.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`EnableAlerts` is the parent toggle and starts true with `EnablePopup`. Set `EnablePushNotify` for a handset alert, `EnableEmail` for mail, or `EnableSound` to play `SoundFile`. Those three ship off. Only closed bars report.

Every RSI Divergence Indicator input

Core settings

Setting What it does Default
RsiPeriod RSI period. Bars in the reading, default `14`. 14
PivotLeft Bars left of a swing pivot. Bars a swing must beat on the older side, default `5`. 5
PivotRight Bars right of a swing pivot (confirm lag). Bars it must beat on the newer side, default `5`. 5
MinRsiGap Min RSI divergence gap (0 = permissive). Smallest reading difference that counts, default `0.0`. 0.0
OverboughtLevel Overbought reference. Upper reference in the pane, default `70`. 70
OversoldLevel Oversold reference. Lower reference in the pane, default `30`. 30

Display settings

Setting What it does Default
MaxBarsBetween Max spacing between the two compared pivots. Furthest apart two paired pivots may sit, default `60`. 60

Alert settings

Setting What it does Default
EnableAlerts Parent toggle for the divergence alerts, default `true`. on
EnablePopup Terminal box on a divergence, default `true`. on
EnablePushNotify Handset alert on a divergence, default `false`. off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Rsi divergence indicator inputs panel with RsiPeriod, PivotLeft and MinRsiGap.
Rsi divergence indicator inputs panel with RsiPeriod, PivotLeft and MinRsiGap.

Settings that fit your chart

Divergence needs swings worth pairing. EURUSD H1 is the reference chart, where `MaxBarsBetween` `60` reaches two and a half days back. On M5 the pairs come thick. H4 gives fewer and better ones.

When the RSI Divergence Indicator fails

`MinRsiGap` `0.0` accepts a difference of a fraction of a point.

A five-bar right side puts every mark five bars behind its pivot.

Divergence can run for weeks without price agreeing.

Copy the compiled RSI Divergence Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Background reading on the method behind the RSI Divergence Indicator: Dividend reinvestment plan on Wikipedia, Arms Index Trin at StockCharts ChartSchool.

Download the RSI Divergence Indicator for MT4 and MT5

The zip holds the compiled RSI Divergence Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Why does MinRsiGap 0.0 matter?

It sets how much the two readings must differ before a divergence counts. At zero a difference of a hundredth of a point qualifies, which lets a lot of noise through. Raising it to two or three tightens it considerably.

Where does a Bull Div mark appear?

On the reading itself, inside the pane, rather than beside the candle. That places it exactly at the value being compared, so you can check the higher low with your own eyes.

How late is a PivotRight 5 confirmation?

Five bars, always. The swing needs five newer bars to close without beating it, so the divergence is visible in hindsight before the tool draws anything.

Where does the RsiPeriod calculation live?

Inside this file. Average gain and average loss run with Wilder’s smoothing rather than through a terminal call. Keeping it in the source means the whole calculation stays auditable.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the RSI Divergence Indicator as one input. Always backtest before trading live.

Category: this is part of our Oscillators collection. Browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment