Double Top And Bottom Scanner
A double top or bottom is not complete just because the second peak or trough forms - a discretionary trader waits for the neckline to actually break before calling it. Marking the pattern the moment the second extreme prints is the naive approach, and it is wrong: plenty of "double tops" that form never break their neckline and simply are not the pattern. This indicator waits. Once two confirmed same-side swings sit within a tolerance of each other, with an opposite-side swing between them serving as the neckline, the pattern goes into a pending state - drawn nowhere yet. Only when a subsequent bar's CLOSE moves through that neckline price does the indicator mark the pattern: buffer arrow, dashed neckline segment, and an optional text label. Both stages carry a confirmation delay, and they stack. The two extremes themselves are confirmed fractals, known InpSwingLookback bars after the peak or trough they mark. The neckline break, on top of that, can only be recognised after it happens. The result is a marker that, once drawn, never moves and never disappears - nothing here repaints - but it is also never early. Tolerance between the two extremes scales with ATR rather than a fixed distance, so "equal enough" means something sensible whether the chart is a tight FX pair or a volatile index. Notes and limitations - Nothing is marked until the neckline breaks. A textbook-looking double top that never closes through its neckline will never be flagged - this is deliberate, not a missed case. - Two confirmation delays stack: InpSwingLookback bars for each extreme to be recognised as a swing, then however many bars pass before the neckline breaks (up to InpMaxWaitBars before the pattern is abandoned). - Only one pending double top and one pending bottom are tracked at a time; a fresh same-side pair simply replaces whatever was pending before it. - Pattern search only pairs same-side swings that have exactly one usable opposite-side neckline between them further back in the swing list; two same-side swings back to back with nothing between them are skipped as partners. - No trade or stop-loss logic - visual and alerting only.
Indicator · MT5 · v1.0 · Free
About Double Top And Bottom Scanner
Double Top And Bottom Scanner is an indicator for MetaTrader 5 based on ATR. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Swing lookback, Tolerance atr mult and Atr period. MQL source code included.
Files in the download: DoubleTopBottom.ex5, DoubleTopBottom.mq5, DoubleTopBottom.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Swing lookback | 3 | Bars each side required to confirm a swing (K) |
| Tolerance atr mult | 0.25 | Extreme-match tolerance, as a multiple of ATR |
| Atr period | 14 | ATR period used to scale the tolerance |
| Max pattern bars | 300 | Max bars allowed between the two extremes |
| Max wait bars | 200 | Give up on an unconfirmed neckline after this many bars |
| Show labels | true | Draw a text label next to the neckline |
| Alerts | true | Alert once, on the bar the neckline breaks |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Dashboards & Scanners · Buy/Sell Arrows · Alerts · ATR · MT5 Indicator · MQL5 Source Code