FxMath Harmonic Hunter — MT5 Suite Complete technical documentation

A professional harmonic-pattern trading suite for MetaTrader 5, written in pure MQL5. It consists of three Expert Advisors that work together to scan the market, display results, draw patterns and manage trades — plus a reference sheet for the classic harmonic patterns.

Version 1.0 Pure MQL5 · no MQL4 wrappers In-EA ZigZag engine 14 built-in patterns ATR SL/TP mode Logistic-regression filter
📡

Harmonic Hunter Scanner

Scans a grid of Pairs × Timeframes, detects the highest-accuracy harmonic pattern per symbol/TF and lists it in an on-chart table with full trade levels. Writes the shared .Pouya settings file for the Helper.

Open documentation →

🖥️

Scanner Panel (recommended)

Same scanning engine, but results are shown in a scrollable, sortable and filterable panel — mouse-wheel scrolling, click-to-sort on every column and a filter toolbar. Ideal when more patterns exist than fit on screen.

Open documentation →

🎯

Chart Helper

Attach to any chart to draw the current pattern (triangles, ratios, channel), show Entry / SL / TP levels, open Instant / Stop / Limit orders via CTrade and manage positions with partial close + breakeven.

Open documentation →

📐

Pattern Reference

The classic harmonic patterns (Gartley, Bat, Crab, Butterfly, Cypher, Shark…) with their Fibonacci ratio tables, plus the geometric Wolfe Waves rules.

Open reference →

📦 Files in this package

FileTypeRole
FxMath_Harmonic_Hunter_Scanner(MT5).mq5 / .ex5EAClassic scanner — fixed grid table, writes the shared settings file.
FxMath_Harmonic_Hunter_Scanner_Panel(MT5).mq5 / .ex5EAPanel version of the Scanner — scrollable / sortable / filterable table.
FxMath_Harmonic_Hunter_Helper(MT5).mq5 / .ex5EAChart helper — draws patterns, opens & manages trades, ML filter.
Harmonic_Patterns_Reference.txtReferenceClassic pattern names and Fibonacci ratio tables (incl. Wolfe Waves).
README.mdDocsProject read-me with feature log and session work log.

🏗️ How the EAs work together

The three EAs form a scanner → helper pipeline. The Scanner (either flavour) discovers patterns and broadcasts its settings; the Helper consumes those settings and turns a pattern into a real trade.

flowchart LR A["Scanner / Scanner Panel"] -->|"writes <login>.Pouya"| F[(MQL5\\Files settings)] F -->|"reads on attach"| B["Helper"] A -->|"View button / Open All"| C["Opens chart + template"] B -->|"Instant / Stop / Limit"| D["CTrade orders"] B -->|"partial close + BE"| E["Position management"]
Scanner runs on any chart

Scans the Pairs × TFs grid with an in-EA ZigZag engine, keeps only the highest-accuracy pattern per symbol+timeframe and draws the result table. On attach it writes <AccountLogin>.Pouya into MQL5\Files\ with accuracy, depths, scan window, pattern age, TP level, trading mode, magic number, colors, etc.

Helper attaches to a trade chart

On attach it reads the same .Pouya file, so its behaviour (accuracy, depth range, TP level, partial close, breakeven, magic, colors) matches the Scanner's settings.

Helper finds & draws the pattern

It re-runs the same detection on the chart symbol/timeframe and draws triangles, ratio labels, the AC channel and the trade levels (Open, TP1–3, SL). A 2-second timer keeps it working even when the market is closed.

Trade execution

Click Instant Order (market), Stop Order or Limit Order (entry at the pattern Open Price) — all via the standard CTrade class with the Scanner's magic number, comment and expiry.

Position management

The Helper watches its own positions and, when price travels BE_Ratio_Distance of the entry→TP distance, closes Close_Partial_Ratio of the volume and/or moves the stop to breakeven.

ℹ️ Note Re-attach the Scanner once after changing its settings so the .Pouya file is rewritten; the Helper picks up the new values on its next attach. The Helper's filter/ML settings are the exception — they are live runtime variables controllable from the on-chart Settings panel.

🧪 Interactive demo — Panel filter behaviour

This small demo mirrors the Panel Scanner's filter toolbar. Click the buttons to see how Type / Pattern / Timeframe / Acc / Age filters combine in real time.

Signal table Type:
PairTFPatternTypeOpenSLTP1AccAge
EURUSDH1Bearish BatSELL1.08751.09111.083994%3
GBPUSDM15Bullish GartleyBUY1.27121.26801.274888%7
XAUUSDH4Bearish CrabSELL2385.42401.22369.091%2
USDJPYH1Bullish ButterflyBUY155.82154.90156.6679%12
AUDUSDM30Bearish CypherSELL0.65870.66120.655985%5
BTCUSDD1Bullish SharkBUY61200598006240073%21
EURJPYM5Bullish AB=CDBUY169.24168.91169.6097%1

Filters apply instantly to stored results without a re-scan, combine with sorting and scrolling, and are fully implemented in the Panel version of the Scanner.

✨ Key features at a glance

Built-in patterns
14
Default scanned pairs
30
Default timeframes
18
ZigZag depth range
25–50
Accuracy default
80%
ATR SL/TP mode
R:R 1:2 / 1:3 / 1:4.5

🔍 In-EA ZigZag

Faithful port of MetaQuotes' Examples\ZigZag (deviation 5×point, backstep 3), cached per (symbol, timeframe, depth) — no external indicator needed.

🎯 Best-accuracy selection

When several patterns match one Pair+TF, only the single highest-accuracy candidate is emitted (ties broken by the newest D point).

📊 Graded accuracy

The Acc column is graded against unscaled table bounds: 100% = exact table match, lower toward the tolerance edges — not always 100.

🛰️ Timer-driven scans

Real EventSetTimer updates (minutes), so results stay fresh even with a closed market / quiet chart / zero ticks.

🔔 Notifications

Alert, Email, Push and optional Telegram (WinInet httpGET) on every emitted signal, with a signature line.

🧠 ML signal filter

The Helper trains an in-EA logistic-regression model on its own chart history (pure MQL5 — no ONNX/DLL) and shows a ML % badge.

🛠️ Installation

  1. Copy the .mq5 / .ex5 files to MQL5\Experts\ of your MetaTrader 5 data folder.
  2. Copy Harmonic_Hunter_Scanner(MT5).tpl (if you use it) to MQL5\Profiles\Templates\.
  3. In the terminal, enable Tools → Options → Expert Advisors → Allow DLL imports (required only for the Telegram/version-check httpGET calls — the core scan works without it).
  4. Drag the Scanner onto any chart (it scans the configured list, not the chart itself).
  5. Drag the Helper onto the chart of a symbol you want to trade.
  6. Press Scan Market on the Scanner, then use the View buttons to open charts, or the Helper's Trading Options panel to trade.
⚠️ Disclaimer Harmonic patterns are probabilistic — no pattern guarantees a profit. Always test on a demo account first, use proper risk management, and be aware that broker feeds / symbol naming differ. Trading involves substantial risk of loss.