SignalBridge Telegram to MT5 Orchestrator
- ユーティリティ
- Nelson Tum
- バージョン: 1.8
- アクティベーション: 10
TradingView & Telegram → MT5 Automation + Position Management
This is an integrated execution and risk/position management EA for MT5 that lets you:
- Automate trades from TradingView strategy alerts (via secured webhook → desktop bridge → JSON drop → EA)
- Manually trigger trades using plain-language Telegram bot commands (e.g., “Long EURUSD”, “Close XAUUSD”, “Short GBPJPY r=1 rt=fixed”)
- Run both methods in parallel; every instruction is normalized into structured JSON “signal drop” files that the EA ingests and executes on MT5 with uniform risk controls and management logic.
How It Works
-
Signal Sources (Choose One or Both):
- Automated path: TradingView sends alerts (webhook URLs generated by a companion desktop app). Alerts are transformed into standardized JSON files.
- Manual path: You interact with your Telegram bot (keyboard or typed commands). Commands (Long/Short/Close + optional risk params) are converted into the same JSON format.
-
Transport & Normalization:
The companion desktop application (SignalBridge) receives either webhook payloads or Telegram commands, applies formatting and validation, then writes JSON signal files to a shared folder (Common Files path). -
EA Ingestion & Validation:
The MT5 EA continuously scans for new JSON drops, verifies:- Webhook ID (optional)
- Freshness vs. expiry window
- Duplicate protection
-
Risk Layer Enforcement:
Before order placement, the EA applies cumulative daily limits, per‑trade loss protections, static account-size guard (optional), max trades per symbol/direction, and spread/slippage filters. -
Execution & Lifecycle Management:
Orders are placed with retry logic. Active positions are continuously managed (breakeven, trailing stops, staged partial closes, enforced drawdown exits). Trade-closing (TP/SL) events generate immediate Telegram notifications.
Ingestion Methods (Unified Execution)
Source Method | Trigger Style | Typical Use Case | Path to MT5 |
---|---|---|---|
TradingView webhooks | Strategy alert JSON | Full automation, 24/7 | Webhook → Desktop bridge → JSON → EA |
Telegram bot commands | Human text (Long/Short/Close) with optional risk modifiers | Manual intervention, discretionary overlays | Bot → Desktop bridge → JSON → EA |
Both converge into the same signal pipeline, guaranteeing identical risk treatment and trade handling regardless of origin.
Core Modules
1. Signal Engine
- Watches a dedicated “signal drop” directory
- Validates timestamp, expiry, Webhook ID (if enforced), and dedupes processed IDs
- Supports multi-symbol execution from a single chart instance (per-symbol filters applied at runtime)
2. Risk Manager
- Daily trade count ceiling
- Cumulative PnL percentage caps (gain + loss) with forced flattening
- Per-trade max loss (dynamic based on grouped entries)
- Static account-size safeguard (currency or % baseline until manually reset)
- Spread/slippage/max open lots/direction quotas
3. Trade Manager
- Resilient order dispatch with retry queue
- Volume calculation: fixed lots or percent risk (ATR/points SL normalization)
- Multi-attempt logic with timed backoff
- Supports partial volume scaling (split risk)
4. Position Management
- Breakeven trigger (ATR or points mode)
- Trailing stop (ATR, points, or prior candle high/low with buffer)
- Staged partial exits: TP1, TP2, Drawdown-triggered partial SL
- Reverse TP/SL calculations stored for alternative scenario labeling
5. News Filter (Optional)
- Daily economic calendar fetch (lightweight)
- Per-symbol impact gating (High/Medium/Low) with pre/post blackout windows
6. Notification Layer
- Telegram alerts for TP/SL/Trailing/Breakeven closures with cooldown for non-critical events
- Limit breach alerts (daily loss/gain, account-size guard)
- Structured trade-close summaries (PnL + duration + reason)
7. Visual & UI Overlay
- Entry price, aggregated average line (multi-position)
- Live TP/SL/partial trigger levels
- Real-time metrics panel (PnL %, daily limits, lot exposure, safeguard status)
Key Features Overview
- Dual ingestion (Webhook + Telegram)
- Account size circuit breaker
- Intelligent notification scheduling for all trade events
- Partial exit architecture (profit scaling + defensive drawdown trimming)
- Visual execution telemetry for situational awareness
- Fully file-based integration - no DLLs required
Supported Instruments
Tested on major brokers across:
- Forex Majors & Minors
- Metals
- Indices
- Crypto Pairs
Usage Workflow (Quick Start)
- Install & Attach EA to any MT5 chart (one instance can process multi-symbol signals)
- Configure Inputs:
- Risk parameters (percent or fixed)
- Daily limits & account-size guard (optional)
- Partial/trailing/breakeven logic
- (Optional) Enable News Filter: Add calendar URL to MT5 WebRequest list
- Set Signal Expiry Minutes to prevent stale execution
- Desktop App Setup:
- (TradingView Path) Create webhook (URL auto-generated) and paste into TradingView alert(s)
- (Telegram Path) Add bot token + start chat → send commands (e.g., “Long EURUSD r=1 rt=percent”)
- Monitor EA Panel: Confirm live metrics, PnL, trade limits, and incoming signal acknowledgments
- Validate Notifications: TP/SL/partial/breakeven events should arrive in Telegram with proper formatting
- Refine & Scale: Adjust ATR multiples, partial thresholds, or trailing buffer after demo validation
Manual Command Examples (Telegram)
Short XAUUSD r=0.5 rt=percent
Close GBPJPY
Close XAUUSD
The desktop bridge normalizes each into JSON with timestamps & IDs before EA ingestion.
TradingView Alert Payload (Example)
{
"webhook_id": "YOUR_ID",
"symbol": "EURUSD",
"mode": "ENTRY",
"type": 0,
"risk_mode": "percent",
"risk_value": 1.0,
"tp_mode": "points",
"tp": 200,
"sl_mode": "points",
"sl": 100,
"expiry_minutes": 5,
"signal_id": "{{alert_id}}",
"timestamp": {{timenow}}
}
Companion desktop app augments & drops as JSON → EA consumes.
Safeguards
- Hard Daily Loss & Gain Locks: Auto-close + block new entries (with Telegram alert)
- Per-Trade Loss Enforcement: Forced closure if allocated slice breaches envelope
- Account Size Guard: Persistent across restarts until manually reset (gain or loss threshold)
- Spread & Slippage Filters: Declines entries in adverse microstructure conditions
- Queued Retries: Avoids terminal freezing under transient trade context busy states
Best Practices
- Always demo first to calibrate ATR multiples & partial scaling.
- Use unique Webhook IDs per strategy cluster for traceability.
- Keep Telegram risk defaults conservative; override per command if needed.
Risk Disclaimer
Trading leveraged products (FX, CFDs, Metals, Crypto) involves substantial risk and may not be suitable for all investors. Past performance is not indicative of future results. You are solely responsible for configuration, compliance, and capital protection. Always validate on a demo environment before deploying to live accounts.