Divergence Signal Alerts
- インディケータ
- バージョン: 1.0
Divergence Signal Alerts is a free indicator for MetaTrader 5. It finds RSI and MACD divergences on the chart, draws a line between the two price pivots and puts an arrow on the bar where the divergence became known, with alerts.
Signals come from closed bars only. A pivot is known only a few bars after it forms, so the arrow goes on that later bar and never moves or disappears.
What you see on the chart
- A line between the two price pivots: green for bullish, red for bearish; solid for regular, dashed for hidden
- An arrow on the closed bar that confirmed the divergence
- Tooltip on each line: type, direction and which oscillators diverged
How a divergence is found
- Pivots on price: a swing low has 5 higher lows before it and 3 bars after it that are not lower (both adjustable); swing highs mirror it.
- Regular bullish: price makes a lower low while RSI or the MACD histogram makes a higher low. Regular bearish is the mirror at swing highs.
- Hidden bullish (optional): price makes a higher low while the oscillator makes a lower low. Hidden bearish mirrors it.
- The two pivots must be 5 to 60 bars apart, and with clean lines on, no bar between them may cross the line on price or on the oscillator.
- Optional: only when RSI and MACD both diverge.
Who it is for
For traders who use divergence to spot a possible turn or the continuation of a trend, on any symbol and timeframe. To watch many symbols and timeframes at once, with Stochastic, CCI and OBV too, see Divergence Scanner MT5. It places no orders.
Inputs
- RSI divergence / RSI period - on / 14
- MACD histogram divergence / fast, slow, signal - on / 12, 26, 9
- Regular / hidden divergence - on / off
- Pivot: bars on the left / right - 5 / 3 (the right side is the confirmation delay)
- Pivots at least / at most this many bars apart - 5 / 60
- Clean lines - on
- Only when RSI and MACD both diverge - off
- Closed bars to scan - 2000; draw the line between the pivots - on; colours
- Alerts: pop-up (on), sound, push notification, e-mail
Starting settings
The defaults work on every timeframe; what changes is how often they signal. Divergences per month per symbol on EURUSD, GBPUSD, USDJPY and XAUUSD, October 2023 to October 2026, closed bars (a code count, not a trading result):
| Timeframe | Divergences per month |
| M15 | about 36 to 43 |
| H1 | about 8 to 11 |
| H4 | about 2 to 3 |
| D1 | about 0.2 to 0.4 |
Fewer signals: switch on "only when RSI and MACD both diverge", or raise the bars on the left.
How it was checked
- Non-repainting: in the Strategy Tester on XAUUSD H1, every tick, January to October 2026 (91 million ticks, 4,406 bars), 75 arrows appeared and none changed after its bar closed or was drawn on the forming bar.
- Code check: RSI, MACD and every arrow were compared bar by bar with an independent Python calculation on EURUSD, GBPJPY, XAUUSD and BTCUSD, M15, H1 and H4: identical on every bar.
Alerts and Expert Advisors
One alert per new divergence, on the bar that confirms it: pop-up, sound, push notification and e-mail, each switched separately. Nothing is sent while history loads, never twice for the same bar, and not in the Strategy Tester.
Buffers: 0 bullish arrow (price), 1 bearish arrow, 2 and 3 their type (1 regular, 2 hidden), 4 RSI, 5 MACD histogram.
Questions
- Does it repaint? No. It uses closed bars only, and the arrow goes on the bar that confirmed the divergence, a few bars after the pivot.
- Why is the arrow a few bars after the low or high? A pivot can only be confirmed once the next bars have closed. Drawing it earlier would mean redrawing later.
- Does a divergence mean price will turn? No. It shows that momentum and price disagree; many divergences are followed by more of the same trend.
- Does it work on gold and crypto? Yes, on any symbol with history.
Questions: use the comments on this page or send me a message on MQL5.
Trading involves risk. The indicator shows a technical pattern; it does not predict the market, and past signals do not guarantee future results.
