@0xrelogic/mt5-analysis-mcp
v1.9.1
Published
MCP server for MT5 market analysis, trading operations, and alert system with 15 conditions - FIXED pip value calculation
Maintainers
Readme
MT5 Analysis MCP Server
Model Context Protocol server untuk analisis teknikal MetaTrader 5 dengan AI context tools.
Features
📊 Pattern Detection (v1.3.0) 🔥 NEW
- 🎯 13+ Chart Patterns - Double Top/Bottom, Head & Shoulders, Inverse H&S, Rising/Falling Wedge, Ascending/Descending/Symmetrical Triangle, Ascending/Descending/Horizontal Channel, Bull/Bear Flag
- 🕯️ Candlestick Signals - Bullish/Bearish Engulfing, Hammer, Shooting Star, Doji, Morning/Evening Star
- ⭐ Quality Scoring - 0-100 score based on completion %, confidence %, and volume confirmation
- 📊 Volume Validation - Patterns marked with ✓/✗ based on volume spike confirmation
- 🎚️ Smart Support/Resistance - Strength 1-10 calculated from touches, age (bars), and volume
- 📐 Fibonacci Retracement - Auto-detect trend + 7 key levels (0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%)
- 🔍 False Positive Reduction - Minimum quality threshold + strict validation rules
Core Analysis Tools
- ✅ Comprehensive Market Analysis - Multi-timeframe analysis (M1, M5, M15, H1, H4, D1) with 15+ technical indicators including EMA20 for scalping
- ✅ Live Price Feed - Real-time Bid/Ask/Last prices
- ✅ Account Summary - Balance, Equity, Margin, Profit tracking
- ✅ Batch Analysis - Compare up to 10 symbols simultaneously (summary mode)
- ✅ Historical Data - OHLCV data on any timeframe (M1 to MN1)
AI Context Tools (v1.2.0)
- 🧠 Market Condition Detector - Identifies trending/ranging/volatile states using ADX + ATR
- 🧠 Higher Timeframe Bias - Shows alignment across timeframes to avoid counter-trend trades
- 🧠 Volatility Rank - ATR percentile ranking (current vs historical)
- 🧠 Session Info - Detects Asian/London/NY sessions and volume expectations
� Scalp ing Tools (v1.7.0) 🔥 NEW
- ⚡ M1/M5 Timeframes - Ultra-fast scalping timeframes with full indicator suite
- 📊 EMA20 - Critical for scalping trend identification
- 📍 Swing High/Low - Last 30 bars for local support/resistance
- 💰 Spread Monitoring - Real-time spread in points & pips
- 🎯 Scalping Screener - Multi-symbol quick overview for rapid pair selection
- 🔍 Market Condition M1/M5 - Trending/ranging/volatile detection on scalping timeframes
🔔 Alert System (v1.8.0) 🔥 UPDATED
- 🎯 15 Condition Types - RSI, MACD, Price, Pattern, ADX, Stochastic, Price Level, Price Breaks, HTF Bias, Volatility, Session, Volume, Spread, Candle Patterns, Momentum, Time Filter
- ⚡ Scalping Conditions (NEW) - Spread check (<2 pips), Candle patterns (6 types), Momentum (price velocity), Time filter (avoid low-volume hours)
- ⏰ Background Monitor - Auto-checks rules every 5 minutes
- 📊 Quality Scoring - Each alert shows quality score based on conditions met
- 🔕 Cooldown System - Prevents spam with configurable cooldown hours
- 📱 Telegram Ready - Built-in Telegram notification support
- ✅ Acknowledge System - Mark alerts as reviewed to keep track
Technical Indicators
RSI, MACD, Bollinger Bands, Ichimoku Cloud, ADX, Parabolic SAR, Stochastic, CCI, Williams %R, ATR, Keltner Channels, OBV, MFI
Setup untuk Server (VM/Tailscale Host)
1. Install Dependencies
cd "d:/Project Utama/Metatrade5"
pip install fastapi uvicorn pandas ta MetaTrader5 pytz2. Jalankan API Server
cd "d:/Project Utama/Metatrade5/analysis_service"
python main.pyServer akan jalan di http://0.0.0.0:8000
3. Cek IP Tailscale
tailscale ip -4Contoh output: 100.67.151.83
Setup untuk Client (Keluarga/Tim)
1. Pastikan Tailscale Aktif
- Download: https://tailscale.com/download
- Login dengan akun yang sama dengan server
2. Install MCP Server via NPM
Edit file mcp_config.json (lokasi tergantung IDE):
Cursor/VS Code:
- Windows:
C:\Users\{username}\.cursor\mcp_config.jsonatau.vscode\mcp_config.json - Mac/Linux:
~/.cursor/mcp_config.json
Claude Desktop:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - Mac:
~/Library/Application Support/Claude/claude_desktop_config.json
Tambahkan konfigurasi ini:
{
"mcpServers": {
"mt5-analysis": {
"command": "npx",
"args": ["-y", "@0xrelogic/mt5-analysis-mcp"],
"env": {
"MT5_API_URL": "http://100.67.151.83:8000"
}
}
}
}Ganti
100.67.151.83dengan IP Tailscale server kamu!
3. Restart IDE
- Cursor/VS Code: Tutup dan buka lagi (Ctrl+Q → Re-open)
- Claude Desktop: Restart aplikasi
Tools yang Tersedia
🔥 Pattern Detection (NEW in v1.3.0)
detect_patterns - Deteksi Pattern + Fibonacci
Input: symbol (string), timeframe (string, default: "H4")
Contoh: "BTCUSD", "H4"
Output:
- 13+ chart patterns (sorted by quality score)
- Candlestick signals (Engulfing, Hammer, Doji, etc.)
- Support/Resistance levels with strength 1-10
- Fibonacci retracement levels
- Volume confirmation (✓/✗)
- Quality scores (0-100)
Example Output:
=== PATTERNS FOUND (sorted by quality) ===
Double Top (bearish_reversal)
Quality: 85% | Confidence: 92% | Volume: ✓
Target: 83271.33
=== FIBONACCI RETRACEMENT ===
Trend: DOWNTREND
Current at: 23.6% level ← Current
Support: 83422.93 - Strength: 8/10 (7 touches, 10 bars)Core Analysis Tools
1. get_market_analysis - Analisa Lengkap
Input: symbol (string)
Contoh: "XAUUSD"
Output: Analisa M15, H1, H4, D1 dengan semua indikator2. get_live_price - Cek Harga Cepat
Input: symbol (string)
Contoh: "EURUSD"
Output: Bid, Ask, Last, Time3. get_account_summary - Info Akun
Input: (none)
Output: Balance, Equity, Margin, Profit4. get_batch_analysis - Multi Symbol
Input: symbols (comma-separated string)
Contoh: "EURUSD,XAUUSD,GBPUSD"
Output: Analisa semua symbol sekaligus (max 10)5. get_historical_data - Data OHLCV
Inputs:
- symbol (string): "EURUSD"
- timeframe (string): "M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN1"
- bars (number): 100 (max 1000)
Output: Data OHLCV historisAI Context Tools (v1.2.0) 🆕
6. get_market_condition - Market State
Inputs:
- symbol (string): "EURUSD"
- timeframe (string): "M15", "H1", "H4", "D1" (default: "H4")
Output: trending/ranging/volatile + ADX + ATR + trend strength7. get_htf_bias - Timeframe Alignment
Inputs:
- symbol (string): "EURUSD"
- timeframe (string): "M15", "H1", "H4", "D1" (default: "H1")
Output: Bias per timeframe + alignment score + recommendation8. get_volatility_rank - Volatility Percentile
Input: symbol (string): "EURUSD"
Output: ATR percentile + status (low/normal/high/extremely_high)9. get_session_info - Trading Sessions
Input: (none)
Output: Active sessions (Asian/London/NY) + volume expectations🔔 Alert System Tools (v1.5.0) 🆕
10. create_alert_rule - Buat Alert Otomatis
Inputs:
- name (string): "EURUSD Oversold Setup"
- symbol (string): "EURUSD"
- timeframe (string): "M15", "H1", "H4", "D1" (default: "H4")
- conditions (array): Array of condition objects
- min_conditions_met (number): Minimum conditions to trigger (default: 2)
- cooldown_hours (number): Hours before re-trigger (default: 4)
- telegram_enabled (boolean): Send to Telegram (default: true)
Condition Types:
- RSI: {type: "rsi", operator: "<", value: 30}
- MACD: {type: "macd", operator: ">", value: 0}
- Price: {type: "price", operator: "<", value: 1.0500}
- Pattern: {type: "pattern", pattern_type: "bullish_reversal", min_quality: 80}
- ADX: {type: "adx", operator: ">", value: 25}
- Stochastic: {type: "stoch", operator: "<", value: 20}
Example:
{
"name": "EURUSD Bullish Setup",
"symbol": "EURUSD",
"timeframe": "H4",
"conditions": [
{"type": "rsi", "operator": "<", "value": 30},
{"type": "pattern", "pattern_type": "bullish_reversal", "min_quality": 80}
],
"min_conditions_met": 2
}
Output: Rule ID, name, conditions count11. list_alert_rules - Lihat Semua Alert Rules
Input: enabled_only (boolean, default: true)
Output: List of all alert rules with status, conditions, trigger count12. get_pending_alerts - Lihat Alert yang Triggered
Input: acknowledged (boolean, default: false)
Output: List of pending alerts with conditions met, quality score, price13. acknowledge_alert - Tandai Alert Sudah Dibaca
Input: alert_id (number)
Output: Success confirmation14. delete_alert_rule - Hapus Alert Rule
Input: rule_id (number)
Output: Success confirmation15. evaluate_alert_rule - Test Alert Rule Manual
Input: rule_id (number)
Output: Current evaluation result (triggered/not triggered), conditions status🚀 Scalping Tools (v1.7.0) 🆕
16. get_scalping_screener - Multi-Symbol Scalping Overview
Inputs:
- symbols (string): "EURUSD,GBPUSD,XAUUSD,BTCUSD" (max 10)
- timeframe (string): "M1", "M5", "M15" (default: "M5")
Output per symbol:
- price & spread_pips
- trend_bias: bullish/bearish/neutral
- market_condition: trending/ranging/volatile
- volatility_status: low/normal/high/extremely_high
- rsi, stoch_k, stoch_d
- distance_to_swing_high_pips
- distance_to_swing_low_pips
- swing_high, swing_low
- adx, atr
Perfect for: Quickly scanning which pairs are good for scalping right now!Cara Pakai
Setelah setup, langsung chat ke AI:
Analisa Single:
- "Analisa XAUUSD sekarang"
- "Berapa harga EURUSD?"
Analisa Batch:
- "Analisa batch untuk EURUSD, XAUUSD, GBPUSD"
- "Bandingkan kondisi pasar EURUSD dan GBPUSD"
Data Historis:
- "Ambil 200 bar data H4 untuk EURUSD"
- "Tampilkan candle D1 XAUUSD 100 bar terakhir"
AI Context (v1.2.0): 🆕
- "Apakah EURUSD lagi trending atau ranging?"
- "Cek timeframe alignment untuk XAUUSD di H1"
- "Berapa volatility EURUSD sekarang?"
- "Session apa yang aktif sekarang?"
Alert System (v1.5.0): 🔥
- "Buatkan alert untuk EURUSD kalau RSI < 30 dan ada bullish pattern di H4"
- "Lihat semua alert rules yang aktif"
- "Ada alert pending tidak?"
- "Test alert rule nomor 1"
- "Hapus alert rule nomor 2"
Info Akun:
- "Cek saldo akun MT5 saya"
API Endpoints (Untuk Dev/Testing)
# Core Endpoints
curl http://100.67.151.83:8000/api/analyze/EURUSD
curl http://100.67.151.83:8000/api/price/EURUSD
curl http://100.67.151.83:8000/api/account
curl "http://100.67.151.83:8000/api/analyze/batch?symbols=EURUSD,XAUUSD,GBPUSD"
curl "http://100.67.151.83:8000/api/history/EURUSD?timeframe=H1&bars=100"
# AI Context Endpoints (v1.2.0) 🆕
curl http://100.67.151.83:8000/api/condition/EURUSD/H4
curl http://100.67.151.83:8000/api/htf-bias/EURUSD/H1
curl http://100.67.151.83:8000/api/volatility/EURUSD
curl http://100.67.151.83:8000/api/session
# Alert System Endpoints (v1.5.0) 🔥
curl http://100.67.151.83:8000/api/alerts/rules
curl http://100.67.151.83:8000/api/alerts/pending
curl -X POST http://100.67.151.83:8000/api/alerts/create -H "Content-Type: application/json" -d '{"name":"Test","symbol":"EURUSD","conditions":[{"type":"rsi","operator":"<","value":30}]}'
curl http://100.67.151.83:8000/api/alerts/evaluate/1
curl -X DELETE http://100.67.151.83:8000/api/alerts/rules/1
# API Documentation
http://100.67.151.83:8000/docsKeamanan
✅ Private Network Only
- Hanya yang terhubung ke Tailscale yang bisa akses
- Tidak perlu expose port ke internet public
- Data trading tetap dalam jaringan private
Troubleshooting
Tools tidak muncul di AI?
- Pastikan API server jalan:
curl http://IP:8000/ - Pastikan MT5 sudah login di server
- Restart IDE setelah edit
mcp_config.json - Cek log di terminal IDE (Ctrl+Shift+P → "MCP: Show Logs")
Connection refused?
- Cek IP Tailscale benar
- Pastikan firewall allow port 8000
- Pastikan Tailscale aktif di client dan server
Error "429 Too Many Requests" dari NPM?
- NPM rate limit, tunggu 5-10 menit
- Atau download package sekali:
npm install -g @0xrelogic/mt5-analysis-mcp
Update Log
v1.9.1 (2025-11-25) 🐛 CRITICAL BUG FIX - PIP VALUE CALCULATION
- 🔧 FIXED: Pip value calculation for XAUUSD, JPY pairs, and other instruments
- 🔧 FIXED: Trade journal pip calculation (was 10x off for gold)
- ✅ XAUUSD: Now correctly uses pip_size = 0.01, pip_value = $1/lot
- ✅ XAGUSD: Now correctly uses pip_size = 0.01, pip_value = $50/lot
- ✅ USOIL/UKOIL: Now correctly uses pip_size = 0.01, pip_value = $10/lot
- ✅ JPY Pairs: Now correctly converts pip value from JPY to USD
- ✅ BTCUSD/ETHUSD: Now correctly uses pip_size = 0.1, pip_value = $0.1/lot
- 📊 Added
pip_infosection to position size calculator output - 🧪 Added test script
test_pip_fix.pyfor verification
v1.7.0 (2025-11-24) 🚀 SCALPING EDITION
- 📊 Added M1 & M5 timeframes to get_market_analysis
- ⚡ Added EMA20 for scalping (in addition to EMA50/200)
- 📍 Added swing high/low (last 30 bars) for support/resistance
- 💰 Added spread info (points & pips) to current_price
- 🔍 Extended get_market_condition to support M1/M5/M15
- 🎯 NEW TOOL: get_scalping_screener - Multi-symbol quick overview
- Trend bias (bullish/bearish/neutral)
- Market condition (trending/ranging/volatile)
- Volatility status
- RSI, Stochastic K/D
- Distance to swing high/low in pips
- Spread, ADX, ATR
- 📈 Perfect for scalpers and day traders!
v1.5.0 (2025-11-23) 🔥
- 🔔 Added Alert System:
create_alert_rule- Create custom alerts with multiple conditionslist_alert_rules- View all alert rulesget_pending_alerts- Check triggered alertsacknowledge_alert- Mark alerts as revieweddelete_alert_rule- Remove alert rulesevaluate_alert_rule- Test rules manually
- ⏰ Background monitor checks rules every 5 minutes
- 📊 Quality scoring for each alert
- 🔕 Cooldown system to prevent spam
- 📱 Telegram notification support
v1.3.0 (2025-11-22)
- 🔥 Added Pattern Detection:
detect_patterns- 13+ chart patterns + candlestick signals- Quality scoring (0-100) with volume confirmation
- Support/Resistance levels with strength 1-10
- Fibonacci retracement levels
- False positive reduction
v1.2.0 (2025-11-22)
- 🧠 Added AI Context Tools:
get_market_condition- Detect trending/ranging/volatile statesget_htf_bias- Check timeframe alignmentget_volatility_rank- ATR percentile rankingget_session_info- Trading session detection
- ✨ Raw data outputs for AI interpretation (no hardcoded suggestions)
v1.1.0 (2025-11-22)
- ✨ Added
get_batch_analysis- analyze multiple symbols at once - ✨ Added
get_historical_data- fetch OHLCV historical data - 📝 Improved README with clearer setup instructions
v1.8.0 (2025-11-24) 🔥 SCALPING CONDITIONS UPDATE
- ⚡ 4 New Alert Conditions for scalping strategies:
spread- Check spread in pips (e.g., {type: 'spread', operator: '<', value: 2})candle- 6 candlestick patterns (bullish_engulfing, bearish_engulfing, hammer, shooting_star, doji, pin_bar)momentum- Price velocity detection (min_pips threshold)time- Time filter to avoid low-volume hours
- 🎯 15 Total Condition Types - Complete toolset for swing & scalping
- 📝 Updated MCP docs with detailed syntax examples
- ✅ All conditions tested with live market data
v1.0.0 (2025-11-22)
- 🎉 Initial release
- ✅ Market analysis with 15+ indicators
- ✅ Live price feed
- ✅ Account summary
Maintainer: @0xReLogic
