DivergenceScanner MT4
- Indicators
- Version: 1.0
- Activations: 5
A MetaTrader 4 indicator that finds divergences of 10 oscillators on a symbols x timeframes panel, with one arrow on the chart and the oscillators as lines or a heat map below.
What it does
Divergence Scanner finds where price and momentum disagree. It checks 10 classic oscillators on every symbol and timeframe you choose, shows on a panel where a divergence is forming now, marks it on the price chart with one arrow, and draws the oscillators that diverge in the indicator window below the chart.
Oscillators
- RSI, MACD histogram, MACD line, Stochastic %K, CCI, Momentum, OBV, MFI, Awesome Oscillator, Williams %R. Each one can be switched on or off, with its usual periods.
- All of them are calculated by the indicator itself from the price bars, so the result is the same on every broker and in MT4 and MT5.
Divergences
- Regular (reversal): price makes a lower low and the oscillator a higher low (bullish), or price a higher high and the oscillator a lower high (bearish).
- Hidden (continuation): price makes a higher low and the oscillator a lower low (bullish), or the reverse (bearish). Shown with the Hidden button (off at start by default); both kinds are always calculated.
- Pivots: a swing low / high with a set number of bars on each side. The second pivot is confirmed when its right-hand bars have closed: from then on the divergence is final and never moves or disappears.
- Optional clean check: neither price nor the oscillator crosses the line between the two pivots.
The panel
- Symbols (Market Watch or your own list) in rows, timeframes M15 to W1 in columns.
- Every cell shows the largest number of oscillators that diverge on one pair of pivots, green for bullish and red for bearish, in the last N bars. Click a cell and the chart switches to that symbol and timeframe.
- Below the grid: the divergences of the chart symbol on all scanned timeframes, with the oscillator, the type, how many bars ago it was confirmed and how often the same oscillator and type worked before on that symbol and timeframe.
- Buttons: Regular, Hidden, pages, Panel - / Panel + to fold the panel to one line. Your choices are kept per chart.
The chart and the subwindow
- Price chart: one arrow per divergence (under the low for bullish, above the high for bearish). Hover over the arrow: the type, the time and every oscillator that diverges there. Optional lines between the price pivots.
- Subwindow, Lines: each oscillator in its own band, close together, with the divergence line and the same arrows (hover for the details).
- Subwindow, Heat map: one row of squares per oscillator, one square per bar: grey, green on a bullish divergence, red on a bearish one. You see at a glance when several oscillators diverge on the same bars and how long it lasted.
- Buttons in the subwindow: Lines / Heat map, Now only / All bars (lines: only the oscillators that diverge now, or all of them), All (all oscillators on or off) and one button per oscillator.
How to use
- Attach the indicator and wait until the panel cells fill. Click a cell to open that symbol and timeframe with the arrows on the chart.
- Start with Regular divergences; turn Hidden on when you also want continuation cases.
- Use the "worked before" figure as a history count on this symbol, not as a reason to trade the next signal by itself.
Alerts
- Pop-up, push and e-mail on a new divergence, only when at least N oscillators diverge on the same pivots (default 2), for all scanned symbols or only the chart symbol.
How "worked before" is measured
- After each divergence: did price move 1 ATR in its direction before it moved 1 ATR against it, within 20 bars (input)? Counted per symbol, timeframe, oscillator and type, on the bars loaded from your broker. Spread and commission are not included.
- In our own test (8 symbols, H1, H4 and D1, about 2000 bars each, 15 801 divergences) each oscillator and type worked in 46 % to 52 % of the cases: a divergence on its own is close to a coin toss. Use it with your own trend, level and timing rules. The indicator shows the history on your symbol; it is not a forecast and not a promise of any result.
Inputs
- Scan: symbols (empty = Market Watch), maximum symbols, timeframes M15, M30, H1, H4, D1, W1, history bars.
- Oscillators: each one on / off and its periods.
- Divergences: regular, hidden, pivot bars left / right, minimum and maximum bars between the pivots, clean check, bars that count as "now", bars for the result.
- Chart and subwindow: number of divergences drawn, subwindow all / now, heat map at start, lines on the price chart, colours, panel position, symbols per page, panel open at start.
- Alerts: pop-up, minimum oscillators, chart symbol only, push, e-mail.
Platform, symbols and timeframes
- MetaTrader 4 indicator. A MetaTrader 5 version is available as DivergenceScanner MT5.
Notes and limits
- Every divergence is set when its second pivot is confirmed at a bar close. Test: the full history and the same history cut 300 bars earlier, 8 symbols x 3 timeframes, regular and hidden: 0 differences.
- OBV and MFI use the tick volume of your broker.
- The oscillator lines in the subwindow are scaled to 0-100 inside their bands, for display only.
- The indicator does not trade. No DLL, no web requests.
Questions and suggestions are welcome in the comments or by private message on MQL5.
