RSI on raw closes jitters; RSI on a smoothed baseline shows the underlying pace. The RSIMA baseline divergence indicator smooths price with a 10-bar exponential average, runs a 14-bar RSI on that line, and marks divergence when price makes a new swing extreme that the RSIMA refuses to confirm.
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 | 4: RSIMA, Signal, Bull Div, Bear Div |
| Alerts | popup, push notification, email, sound |
| Inputs | 14 |
What you get on the chart
Two lines and two marks in a pane.
`RSIMA` traces medium orchid at width 2.
`Signal` traces gold at width 1.
`Bull Div` prints lime with arrow 233.
`Bear Div` prints red with arrow 234.
Guides sit at 30, 50 and 70.
- RSIMA: line, medium orchid, width 2
- Signal: line, gold, width 1
- Bull Div: arrow, lime, width 2, arrow code 233
- Bear Div: arrow, red, width 2, arrow code 234

What happens on each bar
The baseline
`BaselinePeriod` `10` with `BaselineMethod` `MODE_EMA` smooths the closes. The RSI then reads this line instead of raw price.
The RSIMA
`RsiPeriod` `14` applies Wilder’s averaging to the baseline’s changes. `SignalPeriod` `5` averages the result into the gold line.
Divergence
`PivotSpan` `5` bars each side confirm a swing. A lower price low with a higher RSIMA reading at that low prints Bull Div; the mirror prints Bear Div.
How to follow it
The orchid line is smoother than a plain RSI.
Gold crossing orchid shows momentum turning.
A lime mark flags a bullish divergence.
A red mark flags a bearish one.
Marks appear five bars after the swing.
`ArrowOffset` `5.0` spaces marks from the line.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
A confirmed divergence at a swing sends one message. `EnableAlerts` switches it; the popup is the single route live out of the box, with mobile, email and sound left off.
Every RSIMA Baseline Divergence Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
BaselinePeriod |
Baseline MA period (price smoothing). Smoothing length for price, `10`. | 10 |
BaselineMethod |
0=SMA,1=EMA,2=SMMA,3=LWMA. Smoothing recipe, `MODE_EMA`. | MODE_EMA |
RsiPeriod |
RSI period applied to baseline. RSI length on the baseline, `14`. | 14 |
SignalPeriod |
MA period of RSIMA (signal line). Signal line length, `5`. | 5 |
PivotSpan |
Bars each side of a swing pivot. Bars each side of a swing, `5`. | 5 |
OverboughtLevel |
Overbought reference. Upper guide, `70.0`. | 70.0 |
OversoldLevel |
Oversold reference. Lower guide, `30.0`. | 30.0 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffset |
Arrow gap from RSIMA (in RSI units). Mark gap in RSI units, `5.0`. | 5.0 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Switch for divergence messages, `true`. | on |
EnablePopup |
Popup, `true`. | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Where to run it
Divergence between five-bar swings is a slow signal. EURUSD H1 is the reference chart, with a divergence every few days. On M15 marks come more often but mean less. On D1 each one is worth a close look.
The limits
Divergence can repeat several times in a trend.
Each mark is five bars late.
Smoothing hides fast turns.
Only a popup reports by default.
Copy the compiled RSIMA Baseline 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 RSIMA Baseline Divergence Indicator for MT4 and MT5
The zip holds the compiled RSIMA Baseline 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
Why run RSI on BaselinePeriod 10 instead of closes?
The ten-bar average removes most single-bar noise first, so the RSI tracks the pace of the move rather than every spike. The result is a smoother, slower line.
What does Bull Div compare?
Two confirmed swing lows. If the newer low is lower in price but the RSIMA reading at it is higher, momentum has not confirmed the new low.
Why does PivotSpan 5 delay the marks?
A swing needs five closed bars on each side before it counts. The divergence test runs on confirmed swings only, so every mark is at least five bars late.
Is the gold Signal line used for the marks?
No. It is a five-bar average for reading momentum turns by eye. The divergence marks compare RSIMA values at confirmed swings and ignore the signal line completely.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the RSIMA Baseline 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
- The core method is documented in Inet on Wikipedia.
- Additional market context is at Why And How To Use Correlation at StockCharts ChartSchool.
