Hidden Divergence Specialist
Most published divergence indicators hunt for regular divergence - the reversal pattern where price makes a new extreme but the oscillator does not confirm it - and treat hidden divergence as an afterthought, if it is covered at all. This indicator does the opposite. It looks for hidden divergence exclusively: price making a higher low while RSI makes a lower low (bullish continuation), or price making a lower high while RSI makes a higher high (bearish continuation). Regular divergence is not drawn here at all - that is a different signal with a different meaning, and mixing the two on one chart makes both harder to read. A trend filter is what makes this a specialist tool rather than a plain hidden-divergence detector. Hidden divergence is a continuation pattern by definition - it only makes sense as a signal when there is an existing trend to continue. A hidden bullish signal is only drawn when the newer pivot's closing price sits above a configurable EMA (an uptrend by this indicator's definition); a hidden bearish signal requires price below that same EMA. A hidden divergence found against the trend filter is discarded silently rather than drawn - this indicator would rather show nothing than show a continuation signal with no trend behind it. Swing pivots are confirmed fractal-style (InpPivotBars bars required on both sides), so a divergence line, once drawn, is never erased or moved by later price action - it can only go from "not yet confirmed" to "confirmed". RSI itself is computed in-house with Wilder's recursive smoothing rather than calling iRSI() at every shift separately, so the whole recalculation is one bounded pass anchored at each pivot. Notes and limitations - Regular divergence is intentionally not detected or drawn by this indicator - use a general-purpose divergence tool if that is what is needed. - The trend filter is a single EMA comparison, not a full trend-strength model; a choppy market straddling the EMA can flip the filter's verdict from one pivot to the next. - In-house RSI is recomputed per pivot from a bounded lookback window rather than maintained as one continuous recursive series across the whole chart history, which is an approximation of the textbook Wilder RSI rather than an exact match to iRSI() on very old bars - acceptable for pivot-to-pivot comparison, which only ever compares values computed the same way. - Does not repaint on already-confirmed pivots.
Indicator · MT4 · v1.0 · Free
About Hidden Divergence Specialist
Hidden Divergence Specialist is an indicator for MetaTrader 4 based on Divergence and Moving Average. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Rsi period, Pivot bars and Trend ma period. MQL source code included.
Files in the download: HiddenDivergenceSpecialist.ex4, HiddenDivergenceSpecialist.mq4, HiddenDivergenceSpecialist.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Rsi period | 14 | RSI period used to read momentum at each pivot |
| Pivot bars | 5 | Bars required on each side to confirm a swing pivot |
| Trend ma period | 50 | EMA period defining the prevailing trend |
| Max pivot age | 300 | Ignore a pivot pair if the older one is more than this many bars back |
| Alerts | true | Alert once when a new hidden divergence confirms |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: RSI · Divergence · Oscillator · Trend · Alerts · Moving Average · MT4 Indicator · MQL4 Source Code