Divergence tools often redraw because they judge a pivot before it finishes. The non repaint RSI divergence indicator waits three closed bars to confirm each pivot, then compares it with an earlier pivot five to sixty bars back. If price made a new extreme and RSI did not, it marks the pivot.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 2: RSI Div BUY, RSI Div SELL |
| Alerts | popup, push notification, email, sound |
| Inputs | 14 |
The visual side
Two marks on price.
`RSI Div BUY` prints lime with arrow 233.
`RSI Div SELL` prints red with arrow 234.
Marks sit on the confirmed pivot bar.
A comment shows the RSI and pivot settings.
`ArrowOffsetPts` `25` sets the mark gap.
- RSI Div BUY: arrow, lime, width 2, arrow code 233
- RSI Div SELL: arrow, red, width 2, arrow code 234

What the code actually computes
The pivots
`PivotBars` `3` closed bars on each side confirm a swing. Once confirmed, it never moves.
The pairing
The earlier pivot must sit between `DivLookbackMin` `5` and `DivLookbackMax` `60` bars back.
The divergence
A lower price low with a higher `RSIPeriod` `14` RSI prints a buy, if the earlier RSI was under 50. Bearish divergence needs the earlier RSI above 50.
How to watch it
A lime mark is bullish divergence at a low.
A red mark is bearish divergence at a high.
Marks arrive three bars after the pivot.
`CooldownBars` `5` spaces same-side marks.
Messages ship switched off.
Warm-up needs about twenty bars.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Divergence messages exist, but `EnableAlerts` ships false, so nothing reports until you switch it on. Behind it, the popup and the sound playing `SoundFile` are ready; mobile and email are not.
Every Non Repaint Rsi Divergence Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
RSIPeriod |
RSI lookback. RSI length, `14`. | 14 |
PivotBars |
bars to the right to confirm a pivot. Bars that confirm a pivot, `3`. | 3 |
DivLookbackMin |
min bars between the two pivots. Nearest earlier pivot, `5`. | 5 |
DivLookbackMax |
max bars between the two pivots. Farthest earlier pivot, `60`. | 60 |
RSIOverbought |
RSI level used as bear context. Upper RSI context, `70.0`. | 70.0 |
RSIOversold |
RSI level used as bull context. Lower RSI context, `30.0`. | 30.0 |
CooldownBars |
bars to wait before another signal. Bars before another mark, `5`. | 5 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPts |
arrow offset in points. Mark gap in points, `25`. | 25 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master message switch, ships off, `false`. | off |
EnablePopup |
(see inputs panel) | on |
EnableSound |
Sound under that switch, `true`. | on |
EnablePush |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Which timeframe to use
Divergence between pivots up to sixty bars apart suits hourly and four-hour charts. EURUSD H1 is the reference chart, with a few marks a week. On M15 the sixty-bar window covers half a day. On D1 it covers a quarter.
Honest weaknesses
Divergence can repeat through a long trend.
Every mark is three bars late by design.
The 50 context rule skips some valid setups.
Messages ship off, so nothing reports by default.
Copy the compiled Non Repaint 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.
Download the Non Repaint Rsi Divergence Indicator for MT4 and MT5
The zip holds the compiled Non Repaint 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.
FAQ
How does PivotBars 3 stop an RSI Div BUY from moving?
Each pivot needs three closed bars on its right before it counts. Once those bars close, nothing later can move the pivot or the mark that sits on it.
How far apart can DivLookbackMin and DivLookbackMax pivots be?
Between five and sixty bars. Pivots closer than five bars sit too near to compare, and the build treats pivots beyond sixty as part of a different move.
Why must the earlier RSI sit below 50 for an RSI Div BUY?
It keeps bullish divergence to lows that formed in weak momentum. A higher low in RSI from an already strong reading says less about exhaustion.
Why do divergence messages start with EnableAlerts off?
Divergence marks come slowly and often repeat, so the build starts quiet. Switch it on when you want a message for each new confirmed divergence, with popup and sound behind it.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Non Repaint 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
- Learn more about the underlying method in Spot contract on Wikipedia.
- For wider market background, see the MetaTrader 5 user guide at MetaTrader.
