Loading…

Documentation

Complete guide to installing, configuring, and using FxMath Harmony Pro v1.0.

Overview

FxMath Harmony Pro is a professional harmonic pattern scanner and trade management platform for MetaTrader 5. It combines a high-performance Flask backend with a beautiful D3.js frontend to deliver real-time harmonic pattern detection, ML-powered quality scoring, and automated trade management — all accessible through your browser.

Key Capabilities

Installation

Windows (Standalone Executable)

  1. Download the latest FxMath_Harmony_Pro.exe from the download section.
  2. Place the file anywhere on your system (no installation required).
  3. Ensure MetaTrader 5 is installed and running on your system.
  4. Double-click the executable — the app opens in your default browser automatically.
Note: The standalone .exe includes Python 3.9, Flask, scikit-learn, pandas, numpy, matplotlib, and all other dependencies. No separate installation needed.

Windows (Python Source)

# 1. Extract the project
cd harmonics_desktop_v2

# 2. Install dependencies
pip install -r requirements.txt

# 3. Launch
python main.py

Quick Start

  1. Launch the app (python main.py or double-click the .exe).
  2. The app opens http://127.0.0.1:xxxxx in your browser automatically.
  3. Click Connect MT5 in the top-right navbar.
  4. Go to SettingsMT5 Terminal Connection and click 🔍 Detect to find your MT5 installation.
  5. If auto-detection fails, enter the path to terminal64.exe manually.
  6. Click Connect MT5 again — the green dot confirms connection.
  7. Tune your symbols and timeframes in Settings.
  8. Click Scan Market to find harmonic patterns.
Tip: The first scan may take a few seconds as the ML model trains. Subsequent scans are instantaneous due to model caching.

Scanning for Patterns

The Scanner tab is your main workspace. Configure which symbols and timeframes to scan, then click Scan Market.

Scan Controls

ControlDescription
Scan Market / Predict PatternsRun a full scan or predict incomplete/emerging patterns
🔍 Symbol FilterFilter results by symbol name (e.g., EUR)
📐 Pattern FilterFilter by pattern type (Bat, Gartley, etc.)
↕ Direction FilterShow only BUY or SELL signals
🧠 Min Quality FilterOnly show patterns above an ML confidence threshold

Results Table

Each row shows: symbol, timeframe, pattern name, direction, entry/SL/TP1/TP2/TP3 prices, age, and ML quality score (color-coded: ✅ ≥65%, ⚠️ 40–64%, ❌ <40%). Click View to open the interactive chart.

Chart Viewer

The chart modal displays an interactive D3.js candlestick chart with pattern overlays:

ATR / Fib Level Toggle

Click 🧠 ML ATR to switch between standard Fibonacci-based SL/TP levels and volatility-adjusted ATR levels. The ATR levels are computed from ATR(14) at the pattern D-point and adapt to market volatility.

Trade Execution

Place trades directly from the chart modal:

  1. Open a pattern chart via the results table.
  2. Select your TP level (TP1: 0.38, TP2: 0.618, TP3: 0.786).
  3. Enter Risk % (calculates lot size automatically) or a Fixed Lot size.
  4. Click Place BUY or Place SELL.

The system automatically:

Trade Management

The Trades tab provides comprehensive position monitoring and automated management.

Active Trade Management

Enable the Active Trade Management toggle to activate background monitoring of all open positions:

FeatureDescription
BreakevenAutomatically moves SL to entry when price reaches X% of TP distance in your favour.
Trailing StopSL follows price at a fixed % of TP behind current price, locking in profits.
Check IntervalConfigurable interval (default 5s) for the background daemon thread.
Run NowManual one-shot check of all positions.

Position Management Modal

Click ✏️ SL/TP or ✕ Close on any position to open the management modal, allowing precise SL/TP modifications and partial or full position closing without browser alerts.

Telegram Bot Auto-Scanner

The Telegram tab lets you configure an automated background scanner that sends pattern alerts to your Telegram chat.

Setup

  1. Create a bot via @BotFather on Telegram and copy the token.
  2. Get your Chat ID via @userinfobot.
  3. Enter both in the Telegram tab.
  4. Click 📨 Test Message to verify.

Configuration Options

SettingDescription
PairsComma-separated symbols to scan
TimeframesSelect from all 21 timeframes
PatternsToggle individual pattern types
IntervalScan frequency (min: 5, default: 60 minutes)
Accuracy %Pattern detection threshold
Min Quality %Only alert above this ML confidence
Max Age (bars)Ignore stale patterns older than X bars
Send ChartInclude matplotlib chart image with alert

Alert Format

Each alert includes: emoji header with direction, pair, timeframe, pattern name, standard levels, ML volatility levels (ATR-based), ML quality confidence with star rating, and Fibonacci ratios.

Custom Pattern Builder

Open Settings → scroll to Custom Pattern Builder to view, edit, or create patterns.

API Reference

All endpoints are served from the Flask backend on http://127.0.0.1:PORT.

Connection

EndpointMethodDescription
/api/connectPOSTConnect to MT5 (body: {path})
/api/disconnectPOSTDisconnect from MT5
/api/statusGETConnection status + account info + positions
/api/detect-mt5GETAuto-detect installed MT5 terminals
/api/symbolsGETAvailable trading symbols

Data

EndpointMethodDescription
/api/ratesGETOHLC data (?symbol=X&tf=Y&count=Z)
/api/tickGETLatest tick for a symbol (?symbol=X)

Pattern Scanning

EndpointMethodDescription
/api/scanPOSTScan for patterns ({pairs, timeframes, accuracy})
/api/predictPOSTPredict incomplete/emerging patterns
/api/predict-qualityPOSTML quality prediction with ATR levels ({pattern, bars})
/api/custom-patternsGET/POSTGet or save pattern definitions

Trading

EndpointMethodDescription
/api/tradePOSTPlace a trade order
/api/position/modifyPOSTModify SL/TP ({ticket, sl, tp})
/api/position/closePOSTClose position ({ticket})
/api/positions/realtimeGETLive positions with total profit
/api/trade-managementGET/POSTTrailing stop & breakeven config
/api/trade-management/run-nowPOSTOne-shot trade management check

Settings & Utilities

EndpointMethodDescription
/api/settingsGET/POSTScanner settings
/api/correlationPOSTCurrency strength index
/api/sdzonesPOSTSupport/demand zone detection
/api/calendarGETEconomic calendar (?days=14)
/api/telegram-settingsGET/POSTTelegram bot configuration
/api/telegram-testPOSTSend test Telegram message
/api/telegram-run-nowPOSTImmediate scan + Telegram alert

Harmonic Pattern Definitions

All ratios are fully editable from Settings → Custom Pattern Builder.

PatternXB (AB/XA)AC (BC/AB)BD (CD/BC)XD (CD/XC)
Bat0.382–0.5000.382–0.8861.618–2.6180.886
Gartley0.618–0.6180.382–0.8861.272–1.6180.786
Butterfly0.786–0.7860.382–0.8861.618–2.2401.270
Crab0.382–0.6180.382–0.8862.240–3.6181.618
Deep Crab0.886–0.8860.382–0.8861.618–2.6181.618
Cypher0.382–0.6181.130–1.4141.272–2.0000.786
Shark0.382–0.6180.886–1.1301.618–2.2400.886
1210.618–0.8860.382–0.8861.618–1.6181.000

ML Quality Scorer

The ML quality scorer uses a Random Forest Classifier (100 trees, balanced weights) trained on-the-fly for each symbol/timeframe combination.

Features

FeatureDescription
Ratio TightnessHow closely the pattern ratios match the ideal
CD MomentumMomentum of the CD leg (C → D)
Volatility RatioVolatility at D-point vs historical average
Volume DivergencePrice-volume divergence at the completion point
Pattern AgeHow many bars ago the pattern formed
Swing AlignmentAlignment with higher timeframe swings
XB PositionPosition of B within the XA retracement
Prior Session PerformancePerformance of the last N bars

Quality Levels

ScoreRatingChart Color
≥ 80%⭐⭐⭐ ExcellentGreen
65–79%⭐⭐ GoodGreen
40–64%⭐ FairYellow
< 40%— WeakRed

Troubleshooting

Connection Issues

ProblemSolution
MT5 not detectedManually enter the path to terminal64.exe in Settings → MT5 Path
Connection failsEnsure MT5 is running and logged in to your account
Scanner finds 0 patternsLower the accuracy threshold, increase depth range, or add more pairs/timeframes
Trade placement failsCheck that your account allows trading (demo accounts may restrict certain symbols)

Telegram Bot

ProblemSolution
Test message failsVerify the bot token is correct and the bot is started via @BotFather
Chat ID not foundSend a message to your bot first, then use @userinfobot to find your ID
No alerts receivedCheck that the bot is enabled (green status), min quality is not too high, and pairs/TFs are correct

Frequently Asked Questions

General

Q: What is harmonic pattern trading?
Harmonic patterns are specific geometric price formations that identify potential reversal zones based on Fibonacci ratios. They help traders identify high-probability entry points.

Q: Can I use this with any broker?
Yes. The app works with any broker that provides MT5 connectivity. It includes automatic symbol suffix resolution and filling mode fallback for maximum compatibility.

Technical

Q: How many symbols can I scan at once?
There is no hard limit. The parallel scanner uses configurable worker threads (default 4). Scanning 30 pairs across 3 timeframes typically completes in 3–8 seconds.

Q: Does it work with cryptocurrencies?
Yes, if your broker supports crypto symbols (e.g., BTCUSD, ETHUSD). Select them from Settings → Symbols.

Q: How is the ML model trained?
The Random Forest model trains on the fly for each symbol/timeframe pair. It uses the last 1500 bars to learn what makes a successful pattern, computing 8 feature dimensions per bar. Models are cached for subsequent scans.

Deployment

Q: Can I run this on a VPS?
Yes. The app is a standard Flask web server. Deploy it on any VPS and access the web UI remotely via the server's IP and port. Ensure MT5 is running on the VPS.

Q: Is the standalone executable safe?
Yes. The executable is built with PyInstaller and includes only the application code and its Python dependencies. You can verify the SHA-256 checksum provided on the download page.