Flat Divergence Detector MT5
- Indicateurs
-
Keijinro Mizutani
Hello, I’m kotoha, a system designer focused on research-driven, rule-based trading tools for the MT5 platform.
My work centers on market structure analysis, swing dynamics, and Fibonacci-based logic. - Version: 1.1
- Activations: 5
What it is
Flat Divergence Detector MT5 watches for divergence between price and oscillators on a single MetaTrader 5 chart, and draws it where it happens: a line connecting the two pivots on the price chart, an arrow, and a label naming the oscillator and the type.
Five oscillators are covered — RSI, Stochastic, CCI, MFI and MACD — each with its own ON/OFF switch, and detection runs independently per oscillator, so several can confirm the same pivot pair at once. RSI, Stochastic, CCI and MFI are ON by default; MACD is OFF by default and is simply one of the five.
Both kinds are detected, in both directions:
- Regular divergence (bullish and bearish): price makes a new extreme while the oscillator does not — momentum fading, a possible reversal.
- Hidden divergence (bullish and bearish): price holds its trend structure while the oscillator makes the opposite extreme — a possible continuation.
Regular divergence is drawn with a solid line, hidden with a dashed line.
Closed bars only, no repaint
A pivot (swing high / swing low) is used only after it is confirmed by the required number of bars on its right side, and only closed bars enter the calculation. Once a signal is drawn it never moves and never disappears.
Please note the honest trade-off of that design: because the pivot must be confirmed first, a signal appears on the confirmation bar, a fixed number of bars after the pivot itself. The line and arrow are drawn at the pivots, but the buffer value and the alert fire on the confirmation bar. Divergence is a suggestion, not a guarantee — in a strong trend, regular divergence can appear repeatedly and still be run over.
Buffers (8)
0 = Regular Buy arrow, 1 = Regular Sell arrow, 2 = Hidden Buy arrow, 3 = Hidden Sell arrow (drawn on the confirmation bar). 4 = Buy signal for external tools (1.0 on the signal bar only, edge type, read at shift 1), 5 = Sell signal. 6 = code of the oscillator that fired, 7 = size of the oscillator difference. The source of buffers 4 and 5 can be selected: regular only (default), hidden only, or both. Buffers 4 and 5 can be read by Flat Manual Trader MT5 via iCustom (set Buy = 4, Sell = 5, shift = 1). The indicator itself does not place orders.
Panel and alerts
The movable panel lists each oscillator with its ON/OFF state, its current value, and its most recent signal (type, direction, how many bars ago), plus the last confirmed pivot high and low with price and time. Drag it anywhere; it stays in front of the chart drawings and its position is saved.
Alerts fire only when a signal is confirmed, and only for the newest bar: pop-up, push notification, e-mail and sound, each switchable, and the same divergence never alerts twice.
Disclaimer: This product is an analysis tool. It does not provide investment advice and does not guarantee profit. Trading involves risk; please trade at your own responsibility.
