Divergence Scanner MT4
- Göstergeler
- Sürüm: 1.3
- Güncellendi: 4 Aralık 2026
- Etkinleştirmeler: 10
Divergence Scanner MT4 is a MetaTrader 4 indicator that shows the latest divergence of up to ten sources for many symbols and timeframes. One panel holds it all. Every cell uses closed bars only, so it never changes after its bar has closed. Run the free demo in the Strategy Tester on your own symbol before you decide.
It shows divergences and sends alerts. It places no orders.
What's new in 1.3
- Version number aligned with the free indicator (1.3). The scanner's cells, alerts and calculation are unchanged: the engine gives the same values, divergences and pivots as 1.2 (tests below).
In plain words
A divergence is a disagreement. Price makes a lower low, but a momentum line makes a higher low. Many traders read this as selling pressure that is fading.
A momentum line turns price changes into one line. RSI is the best known. The scanner calls each such line a source. It can use up to ten.
Watching one chart for divergence is easy. Watching 30 symbols on four timeframes is not. The scanner does that work and puts the result in one panel.
Each cell shows the latest divergence of one symbol and timeframe. It says bullish or bearish, how many closed bars ago it was confirmed and how many sources agreed.
Agreement is the useful part. A divergence on one source is common. The same divergence on four sources at the same two pivots is rarer. It is still not a promise of a turn.
What you see on the chart
A panel with symbols as rows and timeframes as columns. A cell shows one of these:
- BULL 3 x3 or BEAR 3 x3: the latest divergence was confirmed 3 closed bars ago, and 3 sources agreed. An "h" in front means hidden.
- A brighter cell while the divergence is fresh. You set how many bars count as fresh (3 by default).
- "loading": the history for this cell has not arrived yet. "-": no divergence in the bars loaded. "n/a": not enough bars.
Hover over a cell for a tooltip with the symbol, timeframe, the names of the sources that agreed and the time. Click a cell to open that chart.
Worked example
XAUUSD H4, all ten sources on, taken from the engine test (terminal history, bar times in server time). The older swing low was 3852.54 on 12 Nov 2026 at 16:00. The newer one was 3832.36 on 16 Nov at 04:00, a lower low. The bar that opened on 16 Nov at 16:00 confirmed it, so the cell read BULL 0 x5 after that bar closed. One bar later it read BULL 1 x5.
| Source | At the older low (12 Nov 16:00) | At the newer low (16 Nov 04:00) | Result |
|---|---|---|---|
| RSI | 25.11 | 25.52 | higher low: diverges |
| MACD histogram | -20.30 | -6.03 | higher, but a bar crossed its line: not counted |
| Stochastic %K | 6.99 | 9.64 | higher low: diverges |
| CCI | -185.55 | -97.33 | higher low: diverges |
| OBV | 1,115,979 | 913,373 | lower: no divergence |
| Awesome Oscillator | -115.66 | -126.38 | lower: no divergence |
| Momentum | 94.78 | 96.24 | higher low: diverges |
| MFI | 11.01 | 17.21 | higher low: diverges |
| CMF | -0.253 | -0.234 | higher, but a bar crossed its line: not counted |
| Volume-weighted MACD | -29.69 | -3.82 | higher, but a bar crossed its line: not counted |
Five of ten sources diverged: RSI, Stochastic, CCI, Momentum and MFI. The tooltip lists them. With "show when at least" set to 6, this cell would stay empty.
Key facts
| Type | Indicator on one chart with a panel of symbols x timeframes, for MetaTrader 4. |
| Shows | Per cell: the latest divergence (bullish or bearish, regular or hidden), its age in closed bars and the number of sources that agreed. |
| When a signal is final | When its bar closes. A cell uses closed bars only and never changes after its bar has closed. |
| Reload and timeframe change | The panel is built again and every cell starts from its closed bars. The values come out the same, with the same history. No alerts are sent for divergences found while loading. |
| Alerts | Pop-up and push are on. Sound and e-mail are off. One message per cell and bar. Alerts are silent in the Strategy Tester. |
| Trades | No. It places no orders. |
| Sources | Ten. RSI, MACD, Stochastic, CCI and OBV are on. Awesome Oscillator, Momentum, MFI, CMF and the volume-weighted MACD are off. |
| Volume | OBV, MFI, CMF and the volume-weighted MACD use tick volume, the number of price changes in a bar. No real volume is used. |
| Other products needed | None. The calculation is built in. |
| Symbols | Market Watch (up to 30 by default, at most 60) or your own list. A broker suffix is found automatically. |
| Timeframes | Up to 8 columns, any of the nine MetaTrader 4 timeframes. Default M15, H1, H4, D1. |
| Tested on | EURUSD, GBPJPY, XAUUSD and BTCUSD at M15, H1, H4 and D1. |
Quick start
- Attach the indicator to one chart. The panel lists your Market Watch symbols (up to 30) by M15, H1, H4 and D1.
- Choose Market Watch or your own list of symbols, the timeframes and the sources. The first five are on by default.
- Set how many sources must agree. A divergence is shown from 1 (default). An alert is sent from 2 (default).
- Pop-up and push alerts are on. Switch on sound or e-mail if you want them. Click a cell to open that chart.
Who it is for
For traders who use divergence on several symbols or timeframes and want one place to see them. If you watch one chart with RSI and MACD, the free indicator is enough.
Not for you if you want a ready-made trading system. The panel points you to a chart. It does not say what price will do.
How it works under the hood
Pivots and the divergence rule
Pivots are swing lows and highs of price. A swing low has a lower low than each of the 5 bars before it. None of the 3 bars after it is lower. Both numbers are inputs.
The 3 bars after the pivot are the confirmation delay. The pivot is known only when the third one has closed. That bar gets the mark.
At a new swing low, the indicator looks at the previous swing lows, newest first, 5 to 60 bars back. It tests up to three of them.
- Regular bullish: the new low is lower than the old low, and the source's value is higher.
- Hidden bullish (off by default): the new low is higher, and the source's value is lower.
- Bearish mirrors this at swing highs.
- Clean lines (on by default): no bar between the two pivots may cross the straight line between them, on price or on the source.
The sources
Each source is a line calculated from closed bars. A source that is switched off is not calculated. A divergence needs a value at both pivots, so a source says nothing until it has enough bars.
| Source | Formula | Periods |
|---|---|---|
| RSI | Wilder RSI of the close. The average gain and loss start as a simple average of the first n changes. After that, new = (old x (n - 1) + now) / n. | 14 |
| MACD histogram | EMA(fast) of the close minus EMA(slow), minus the EMA(signal) of that difference. Each EMA starts as a simple average of its first values. | 12, 26, 9 |
| Stochastic %K | Raw %K = 100 x (close - lowest low) / (highest high - lowest low) over the period. It is 50 when the range is zero. The source is the simple average of raw %K over the slowing period. | 14, 3 |
| CCI | (typical price - its simple average) / (0.015 x mean deviation from that average). Typical price = (high + low + close) / 3. | 20 |
| OBV | A running total of tick volume. Add the bar's volume when the close is above the previous close, subtract it when below, add nothing when equal. | - |
| Awesome Oscillator | Simple average of the median price (high + low) / 2 over the fast period, minus the same over the slow period. | 5, 34 |
| Momentum | 100 x close / the close n bars earlier. This is the platform's own Momentum. | 14 |
| MFI | Typical price x tick volume is a bar's money flow. Over the period, add the flows of bars whose typical price rose (positive) and fell (negative). MFI = 100 - 100 / (1 + positive / negative). It is 100 with no negative flow and 50 with no flow. A change under 1e-10 relative counts as no change. | 14 |
| CMF (Chaikin Money Flow) | Per bar: ((close - low) - (high - close)) / (high - low) x tick volume, and 0 when high equals low. CMF = the sum of that over the period / the sum of tick volume (0 when the volume is 0). | 20 |
| Volume-weighted MACD | VWMA = sum of (close x tick volume) / sum of tick volume. Line = VWMA(fast) - VWMA(slow). Signal = EMA of the line. The source is line - signal. With zero volume in a window, the plain average of the close is used. | 12, 26, 9 |
Tick volume. On forex and CFD symbols the platform gives the number of price changes in a bar, not traded lots. Brokers record it differently, so the volume-based sources differ from broker to broker.
How many sources must agree
Each source that is on is tested at the same two pivots. The cell shows how many diverged. "Show when at least" sets the number for a cell. "Alert when at least" sets it for an alert. Both count every source that is on. With ten on, "2 or more" is a looser test than with five.
Closed bars and loading
A cell reads its history once, then adds only the bars that closed since. Cells start a few at a time, so a long list fills in over some seconds. A gap or a changed bar restarts that cell. The forming bar is never used.
Reload, restart and timeframe change
After a reload or a restart, every cell loads its closed bars again. With the same inputs and the same history, the cells show the same values. No alerts are sent for divergences found while loading.
Inputs
| Input | Default | Description |
|---|---|---|
| Which symbols / most symbols shown | Market Watch / 30 | Market Watch or your own list. 1 to 60 symbols. |
| Timeframes | M15,H1,H4,D1 | Up to 8, comma separated. |
| RSI / MACD / Stochastic / CCI / OBV | on | RSI 14, MACD 12/26/9, Stochastic 14/3, CCI 20. OBV uses tick volume. |
| More sources: Awesome Oscillator, Momentum, MFI, CMF, volume-weighted MACD | off | AO 5/34, Momentum 14, MFI 14, CMF 20, volume-weighted MACD 12/26/9. |
| Regular / hidden | on / off | Reversal type and continuation type. |
| Pivot bars left / right; pivots apart | 5 / 3; 5 to 60 | The right side is the confirmation delay. |
| Clean lines | on | No bar between the pivots crosses the line. |
| Show a divergence when at least / alert when at least | 1 / 2 | Number of sources that agree. |
| Closed bars each cell starts from | 1000 | 200 to 5000. |
| Fresh cell | 3 bars or less | Brighter cell. |
| Panel corner, position, font size, colours | top left | Panel look. |
| Click opens the chart; template | on / none | Optional template for the opened chart. |
| Pop-up / push / sound / e-mail | on / on / off / off | Alerts. Push needs your MetaQuotes ID. |
| Debug log for bug reports | off | See Found a problem? |
Alerts and Expert Advisor use
Alerts. Pop-up, sound, push and e-mail are switched separately. Cells that confirm a divergence in the same second are sent as one message. Nothing is sent while history loads, twice for the same cell and bar, or in the Strategy Tester.
Buffers. Buffer 0 holds the number of fresh bullish cells and buffer 1 the number of fresh bearish cells, on the newest bar.
How often it signals
Per symbol per month on EURUSD, GBPUSD, USDJPY and XAUUSD, October 2023 to October 2026, closed bars, the five default sources, regular divergence. It is a code count, not a trading result.
| Timeframe | Any source | 2 or more agree | 3 or more agree |
|---|---|---|---|
| M15 | about 61 to 67 | about 25 to 28 | about 9 to 12 |
| H1 | about 14 to 16 | about 6 to 7 | about 2 to 3 |
| H4 | about 3 to 4 | about 1.4 to 1.8 | about 0.4 to 0.7 |
| D1 | about 0.4 to 0.6 | up to 0.4 | fewer than 0.2 |
How often each source diverges alone, with the same symbols and rules (regular only):
| Source alone | H1 | H4 |
|---|---|---|
| RSI | about 3.7 to 5.1 | about 1 to 1.2 |
| MACD histogram | about 6.5 to 9.1 | about 1.9 to 2.1 |
| Stochastic %K | about 4.4 to 5.4 | about 1 to 1.4 |
| CCI | about 5.9 to 7.5 | about 1.4 to 2 |
| OBV | about 3.3 to 3.8 | about 0.8 to 1.1 |
| Awesome Oscillator | about 3 to 4.1 | about 0.7 to 1 |
| Momentum | about 3.4 to 4 | about 0.9 to 1.3 |
| MFI | about 4.8 to 6.6 | about 1.4 to 1.7 |
| CMF | about 2 to 2.7 | about 0.6 to 0.9 |
| Volume-weighted MACD | about 5.4 to 5.7 | about 1.2 to 1.8 |
These counts are for the five default sources. More sources on raise them.
How it was checked
- Calculation: in the MetaTrader 4 Strategy Tester, 50,697,760 values matched the same Python calculation. They covered all ten sources, every divergence and the latest one per cell, from the engine, the loader and a run through the test period. There were 300 files on EURUSD, GBPJPY, XAUUSD and BTCUSD at M15, H1, H4 and D1, with six settings. Four settings used the new sources. Cells used only closed bars.
- Panel: its fresh bullish and bearish counts matched the test's own cells on 9,349,092 ticks, with 0 mismatches. An every-tick run on EURUSD H1, 2026 (8,417,316 ticks) had 0 mismatches.
- Formulas: the engine is the one tested in MetaTrader 5: 288,000 bars, 12,097 divergences, plus vector formulas on 456,000 values. The volume-weighted MACD periods were tested only at 12/26/9 in MetaTrader 4.
- Version 1.2 against 1.3: the MetaTrader 4 engine is an exact copy of the MetaTrader 5 engine, which was compared as described in the MetaTrader 5 listing. The MetaTrader 4 scanner itself was not run through the tester again for 1.3: only the version number changed.
- Validator-style runs: ten runs (five symbols and timeframes, deposits of 100 and 1,000) ended with 0 error lines.
- Compile: 0 errors and 0 warnings.
Not tested: alerts on a live chart (the tester is silent for alerts). No profit or accuracy test was made. The scanner reports divergences and is not a strategy.
Limits
- A divergence is not a turn call. Agreement of several sources is not a promise either.
- It places no orders and gives no stop loss, target or lot size.
- A cell needs history for its symbol and timeframe. It reads "loading" until the terminal has it, and "n/a" when there are too few bars.
- OBV, MFI, CMF and the volume-weighted MACD use tick volume. It differs from broker to broker.
- Ten sources on cost more CPU than five. With five sources the engine needs about 0.24 microseconds per closed bar, with ten about 0.64. Starting one cell from 1,000 bars costs 0.64 ms of engine time with ten sources. For 60 symbols and 8 timeframes (480 cells) that is about 0.3 s once. After that the check for a new bar costs about 0.8 microseconds per cell each second. The state per cell is about 22 KB (calculated), so 480 cells take about 10 MB.
- Alerts need the terminal to be running with the chart open.
FAQ
Does it repaint? No. Cells use closed bars only and never change after their bar has closed.
Why does a cell say "BULL 3"? The divergence was confirmed 3 closed bars ago. The pivot itself formed 3 bars before that.
What happens if I change the timeframe or reload the chart? The panel is built again and every cell loads its closed bars. The values come out the same. No alerts are sent for old divergences.
Does 1.3 change my cells? No. The same engine gives the same values, divergences and pivots as 1.2 with the five default sources.
Does it work on gold and crypto? Yes, on any symbol with history. OBV, MFI, CMF and the volume-weighted MACD use tick volume.
Does ten sources slow the terminal? With five sources the engine needs about 0.24 microseconds per closed bar, with ten about 0.64. Starting one cell from 1,000 bars costs 0.64 ms of engine time with ten sources. For 60 symbols and 8 timeframes (480 cells) that is about 0.3 s once. After that the check for a new bar costs about 0.8 microseconds per cell each second. The state per cell is about 22 KB (calculated), so 480 cells take about 10 MB.
Alerts on my phone? Yes, with push set up in the terminal. The terminal must be running.
How is it different from the free indicator? It uses the same engine. The free indicator draws divergences of six sources on one chart. The scanner covers many symbols and timeframes with up to ten sources and a count of how many agree.
Is there a MetaTrader 5 version? Yes, Divergence Scanner MT5, with the same inputs and the same cells.
Try it first
Download the free demo from this page and run it in the Strategy Tester on your own symbol. Check the cells against the bars on the charts.
The free Divergence Signal Alerts MT4 draws the same divergences on one chart. It is a good way to see how a divergence looks before you use the scanner. You do not need it to use the scanner.
Works well with
These are workflow suggestions. I have not found that any pair gives better trading results. You do not need any of them.
| Product | How to use them together | Why |
|---|---|---|
| Divergence Signal Alerts MT4 | Use the scanner for the watchlist. Put the indicator on the chart you open. Use the same inputs on both. | Both run the same calculation, so the readings match. |
| Session Levels MT4 | Add it to the same chart. | It draws the Asia, London and New York sessions and killzones, the previous day and week levels and a time panel as context. It is not a signal. |
| Risk Position Tool MT4 | Pick the trade from the chart, then drag the entry and stop lines. The tool gives the lot for your risk. | It separates where you enter from how much you risk. The tool places no orders. |
Related products
- Divergence Scanner MT5: the same scanner for MetaTrader 5.
- Divergence Signal Alerts MT4: the free indicator with the same engine; it draws RSI and MACD divergences on one MetaTrader 4 chart.
- Candlestick Scanner MT4 - another scanner panel with symbols by timeframes, closed bars only and click-to-open, for candlestick patterns.
- MACD Multi Timeframe Scanner MT4 - another scanner panel for many symbols and timeframes, for MACD crosses.
- All my products on MQL5
Custom work
Want an EA that trades this indicator, a custom version of it, several of my indicators or EAs combined into one, an EA that trades another indicator you use (mine or another developer's), or a new indicator or EA of your own? Order it through MQL5 Freelance and choose me as the developer: order through Freelance. Send your requirements, rules and the flow or algorithm you want. The whole order, payment and delivery stay inside MQL5 Freelance.
Found a problem?
- In the inputs, set "Debug log for bug reports" to true.
- Repeat what went wrong.
- Open the Experts tab in the Toolbox. Copy the lines that start with "DBG" and paste them in a comment on this page, with the symbol and timeframe.
- Set the debug log back to false.
The debug lines never contain your account number, name, server, balance or equity.
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.
The scanner shows a technical pattern. It does not predict the market, and past signals may not repeat.
