Divergence IndicatorPro
- Indicatori
-
Musa Khunarikov
Trader professionista dal 2014 (oltre 10 anni di esperienza). Mercati: Forex, azioni, MOEX, metalli.
Sviluppatore MQL4-MQL5. Specializzazione: analisi dei volumi, analisi dei cluster, footprints, delta, profilo dei volumi.
Esperienza e approccio: - Versione: 1.0
- Attivazioni: 5
Divergence Indicator Pro
Divergence Indicator Pro is a professional divergence indicator for MetaTrader 5 that automatically detects divergences between price and oscillator right on the chart.
No more manual pivot hunting or checking whether price direction matches RSI or MACD. The indicator does it for you — on every new bar, accurately and without repaint.
🎯 What the indicator shows
1. Regular Divergence — classic reversal signal:
-
🟢 Bullish regular — price makes Lower Low, oscillator — Higher Low. Possible reversal up.
-
🔴 Bearish regular — price makes Higher High, oscillator — Lower High. Possible reversal down.
2. Hidden Divergence — trend continuation signal:
-
🟢 Bullish hidden — price makes Higher Low, oscillator — Lower Low. Uptrend continues.
-
🔴 Bearish hidden — price makes Lower High, oscillator — Higher High. Downtrend continues.
Lines connect price pivots, arrows mark the signal direction. Regular uses a solid line, hidden uses dashed.
📊 Supported Oscillators
One parameter — four oscillators:
| Oscillator | Settings |
|---|---|
| RSI | Period (14 default) |
| MACD | Fast (12), Slow (26), Signal (9) |
| Stochastic | %K (5), %D (3), Slowing (3) |
| CCI | Period (14) |
Switching — one input field. Works equally well on each.
✨ Key features
🔍 Automatic Pivot Detection
Scans last N bars (300 by default) and finds local price highs/lows with configurable confirmation window (5 bars left/right by default).
📐 Four Divergence Types
Both directions and both types are checked:
-
Regular (reversal) — both directions
-
Hidden (continuation) — both directions
Each type can be disabled separately.
🎨 Chart Visualization
-
Colored lines between pivots
-
Arrows at signal points
-
Solid for regular, dotted for hidden
-
Configurable colors, widths, arrow sizes, price offset
🔔 Smart Alerts
-
Push notifications to phone
-
Sound alert
-
Journal logging
-
60-min cooldown — alert doesn't repeat across multiple charts
⚡ New-bar processing
Recalculates layout only on new bar formation. Saves resources and guarantees stability after bar close.
🛠 Installation — MetaTrader 5
-
Copy DivergenceIndicatorPro.mq5 to MQL5/Indicators/ folder
-
Open MetaEditor (F4), compile (F7) — must be 0 errors, 0 warnings
-
Restart MT5 or refresh Navigator
-
Drag the indicator from Navigator onto chart
-
Configure oscillator, pivot window, and alerts
Typical file path:
C:\Users\{User}\AppData\Roaming\MetaQuotes\Terminal\{ID}\MQL5\Indicators\
📌 Recommended Settings
| Instrument | Timeframe | Oscillator | Pivot Lookback | Scan Bars |
|---|---|---|---|---|
| EURUSD, GBPUSD | H1 | RSI(14) | 5 | 300 |
| XAUUSD | H4 | MACD(12,26,9) | 5 | 200 |
| BTCUSD | H4 | RSI(14) | 5 | 200 |
| US500 | M15 | Stochastic(5,3,3) | 3 | 500 |
Timeframes:
-
M5–M15 — scalping, fast signals (Pivot Lookback = 3)
-
H1–H4 — swing trading, balanced signals (Pivot Lookback = 5)
-
D1 — medium-term, strong signals (Pivot Lookback = 8)
📌 Trading scenarios
1. Reversal trading (regular divergence)
-
Bullish regular signal + confirmation (engulfing candle, level bounce) → BUY
-
Bearish regular signal + confirmation → SELL
2. Trend continuation (hidden divergence)
-
In uptrend: bullish hidden on pullback → trend-following entry
-
In downtrend: bearish hidden on pullback → trend-following entry
3. Combined with levels
-
Divergence near Pivot Point / Daily Range — stronger signal
-
Divergence on strong support/resistance — higher probability
4. Multi-timeframe
-
Signal on H4 + confirmation on H1 — entry
-
Signal on H1 without higher TF confirmation — observe only
⚙️ Parameters
| Parameter | Description | Default |
|---|---|---|
| InpOscillator | Oscillator type (RSI/MACD/Stoch/CCI) | OSC_RSI |
| InpRSIPeriod | RSI period | 14 |
| InpMACDFast / Slow / Signal | MACD parameters | 12 / 26 / 9 |
| InpStochK / D / Slowing | Stochastic parameters | 5 / 3 / 3 |
| InpCCIPeriod | CCI period | 14 |
| InpPivotLookback | Bars left/right to confirm pivot | 5 |
| InpScanBars | How many last bars to scan | 300 |
| InpMaxPivots | Max pivots to compare | 5 |
| InpShowRegular | Show regular divergences | true |
| InpShowHidden | Show hidden divergences | true |
| InpShowLines | Draw lines | true |
| InpShowArrows | Draw arrows | true |
| InpBullColor / BearColor | Bullish/bearish colors | Lime / Red |
| InpLineWidth | Line width | 2 |
| InpArrowSize | Arrow size | 2 |
| InpAlert | Enable alerts | true |
| InpAlertPush | Push notifications | true |
| InpAlertSound | Sound alert | true |
| InpAlertCooldownMin | Cooldown between alerts (min) | 60 |
| InpSoundFile | Sound file name | alert.wav |
📋 Implementation notes (MT5)
-
Pure MQL5 — no DLLs, no external dependencies
-
Uses indicator handles ( iRSI , iMACD , iStochastic , iCCI ) + CopyBuffer — efficient data access
-
No repaint — signals stable after bar close
-
Works on any instrument: Forex, metals, indices, crypto
-
All timeframes: M1 — MN1
-
Correct behavior on timeframe switch
-
Operation logging to terminal journal
⚠️ Important warning
Divergence Indicator Pro is an analysis tool, not a trading system. The indicator shows divergences between price and oscillator, but does not generate ready-made entry signals. All trading decisions are made by the trader.
Using the indicator does not guarantee profit. Test on a demo account before live trading.
🏆 About the developer
Musa Khunarikov — trader with 12 years of live experience (Forex, stocks, MOEX, metals). 51 certifications from "Finam" training center in trading, algo trading, and MetaTrader.
Live trading:
👉 https://developer-mql4-mql5.netlify.app/
Services: EA development, indicators, panels, trading system audit.
📞 Support
30 days of free support after purchase. Bug fixes within 48 hours.
