Divergence Signal Alerts
- Indicateurs
-
Allan Aparece Ninal
Je développe des indicateurs et des Expert Advisors pour MetaTrader 5.
Ma façon de travailler :
- Chaque indicateur est vérifié contre le repaint : les signaux sont décidés uniquement sur des barres clôturées, et un test sur chaque tick confirme qu'ils ne changent plus ensuite. - Version: 1.0
Divergence Signal Alerts is a free indicator for MetaTrader 5 that finds RSI and MACD divergences on the chart. It draws a line between the two price pivots. It puts an arrow on the bar where the divergence became known, and it can send alerts.
Signals come from closed bars only. A pivot is known only a few bars after it forms. The arrow goes on that later bar and never moves or disappears. It places no orders.
Quick start
- Attach the indicator to any chart and timeframe. It scans the last 2000 closed bars.
- Start with the defaults: RSI and MACD divergence on, regular on, hidden off.
- Look for the arrows. Each one sits on the bar that confirmed a divergence, a few bars after the pivot, with a line between the two price pivots.
- Keep the pop-up alert on (default) or add sound, push notification or e-mail.
Standalone: everything is built in. You do not need to buy or install any other product named on this page.
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.
- A 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 numbers are adjustable. Swing highs mirror it.
- Regular bullish: price makes a lower low while RSI or the MACD histogram makes a higher low. Regular bearish mirrors it 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. 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
It is for traders who use divergence to spot a possible turn or the continuation of a trend, on any symbol and timeframe.
Inputs
| Input | Default |
|---|---|
| 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. The table counts divergences per month per symbol on EURUSD, GBPUSD, USDJPY and XAUUSD, October 2023 to October 2026, on closed bars. It is 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. None changed after its bar closed, and none 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. They were identical on every bar.
Alerts and Expert Advisors
You get one alert per new divergence, on the bar that confirms it. Pop-up, sound, push notification and e-mail are each switched separately. Nothing is sent while history loads. Nothing is sent twice for the same bar, or 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.
Related products
- Divergence Scanner MT5 - a separate scanner panel that scans the same rule over many symbols and timeframes. It adds Stochastic, CCI and OBV, and shows how many oscillators agree.
- Candlestick Signal Alerts - a free indicator with the same closed-bar approach and the same alert options, for candlestick patterns.
- All my products on MQL5
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.
If you find it useful, a short review on this page helps other traders find it.
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 may not repeat.
