Ex Machina Telegram Bridge
This professional-grade solution for MetaTrader 5 helps traders achieve greater efficiency in their daily workflow. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.
How to Setup and Use Ex Machina Telegram Bridge
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
Description & Settings
WHAT IT DOES
The EA detects trade events through two independent mechanisms: the OnTradeTransaction handler for real-time detection, and a periodic deal history scan as fallback. A deduplication system ensures you never receive the same notification twice, even if both mechanisms trigger on the same event.
Supported notifications:
— Trade opened: symbol, direction (BUY/SELL), volume, price, SL, TP, magic number, deal ticket
— Trade closed: symbol, volume, close price, gross P/L, commission, swap, net P/L, updated balance
— SL/TP modified: old and new values displayed side by side (e.g. SL: 1924.00 → 1926.50)
— Pending orders placed: type (Buy Limit, Sell Limit, Buy Stop, Sell Stop, Buy Stop Limit, Sell Stop Limit), price, volume
— Position reversal: new direction, closed P/L
— Deposits and withdrawals: amount and updated balance
— Periodic account summaries: balance, equity, free margin, floating P/L, session P/L, open positions, day high/low equity, drawdown percentage
— Connection and disconnection messages with session statistics
SETUP — STEP BY STEP
Step 2: Get Your Chat ID
Step 3: Start a Conversation with Your Bot
Step 4: Allow WebRequest in MetaTrader 5
Step 5: Install the EA
Step 6: Attach to a Chart
INPUT PARAMETERS
— Bot Token: your API token from @BotFather (required)
— Chat ID: your numeric chat ID (required, can be a group ID)
Notification Settings:
— Notify on Trade Open: true/false (default: true)
— Notify on Trade Close: true/false (default: true)
— Notify on SL/TP Modify: true/false (default: true)
— Notify on Pending Orders: true/false (default: true)
— Notify on Deposit/Withdrawal: true/false (default: true)
Account Summary:
— Summary Report Interval: Off, Every 1 Hour, Every 4 Hours, Every 8 Hours, Every 24 Hours (default: Every 4 Hours)
— Include Equity in Summary: true/false (default: true)
— Include Drawdown Info: true/false (default: true)
Display & Style:
— Message Style: Minimal (compact one-line), Detailed (full info with labels), or Emoji-rich (detailed with Unicode icons). Default: Emoji-rich.
— Show Dashboard on Chart: true/false (default: true)
Filters:
— Symbol Filter: comma-separated list of symbols to monitor. Leave empty for all symbols. Example: "EURUSD,XAUUSD"
— Min Lot Size to Notify: minimum volume to trigger a notification. 0 = no filter. Useful to ignore micro-lots.
— Magic Number Filter: only notify for trades with this specific magic number. -1 = all trades (including manual).
MESSAGE STYLES
Minimal — compact single-line format:
XAUUSD | BUY | 0.50 lots @ 1928.45
Detailed — structured with labeled fields:
TRADE CLOSED
━━━━━━━━━━━━━━━━━━━━
Symbol: XAUUSD
Close: SELL (close BUY)
Volume: 0.50 lots
Price: 1935.20
───────────────────
Gross P/L: +$340.00
Commission: -$2.50
Swap: -$0.00
Net P/L: +$337.50
Balance: $10,585.00 USD
Deal #182947363
Emoji-rich (default) — same as Detailed but with Unicode icons for each field. Trade opens show a green circle for BUY and red circle for SELL. Closures show a checkmark for profit and a cross for loss.
FILTERS
The Magic Number filter is particularly useful if you run multiple EAs on the same account. Set it to the magic number of a specific EA to only receive notifications from that EA. Set it to -1 to receive everything (including manual trades).
The Symbol filter accepts a comma-separated list: "XAUUSD,EURUSD,GBPUSD". Only trades on those symbols will generate notifications. Leave empty to monitor all symbols.
ACCOUNT SUMMARIES
Periodic summaries include: balance, equity, free margin, number of open positions, total floating P/L (including swap), session P/L since the EA was started, day high equity, day low equity, and drawdown percentage calculated from the day's high.
Useful for prop firm traders who need to monitor daily drawdown limits remotely. Set the interval to 1 Hour during active sessions.
ON-CHART DASHBOARD
A compact status panel in the top-left corner of the chart shows:
— Connection status: CONNECTED (green) or DISCONNECTED (red)
— Bot username
— Running counters: messages sent and failed
— ExMachina tagline
The dashboard uses the ExMachina steel palette by default (background C'8,10,18', accent C'0,180,220') and can be customized or disabled via the Display inputs.
HOW TO TEST
Step 2: Open a small market order manually (e.g. 0.01 lots EURUSD). You should receive a "TRADE OPENED" notification.
Step 3: Modify the SL or TP of your open position (right-click → Modify). You should receive a "SL/TP MODIFIED" notification showing old → new values.
Step 4: Close the position. You should receive a "TRADE CLOSED" notification with P/L breakdown.
Step 5: Place a pending order (e.g. Buy Limit). You should receive a "PENDING ORDER PLACED" notification.
Step 6: Remove the EA from the chart. You should receive a "Disconnected" message with session statistics.
Quick browser test: to verify your token and chat ID before using the EA, paste this URL in any browser (replace the placeholders):
Quick smoke test script: save this as a Script (not EA) in MQL5/Scripts/, compile, and run on a demo chart:
#include <Trade\Trade.mqh>
void OnStart()
CTrade trade;
trade.Buy(0.01, "EURUSD");
Sleep(3000);
for(int i = PositionsTotal()-1; i >= 0; i--)
if(PositionGetSymbol(i) == "EURUSD")
trade.PositionClose(PositionGetTicket(i));
Important: this EA does not work in the Strategy Tester. The Strategy Tester does not support WebRequest (network calls). The EA must run on a live or demo chart with internet access.
RUNNING ALONGSIDE OTHER EAs
Use the Magic Number filter to limit notifications to a specific EA.
TROUBLESHOOTING
No messages received:
2. Verify Bot Token and Chat ID are correct (no extra spaces)
4. Check the Experts tab (View → Toolbox → Experts) for error messages
EA shows INIT_PARAMETERS_INCORRECT: Bot Token and Chat ID are both required. Make sure neither field is empty.
Dashboard not showing: make sure "Show Dashboard on Chart" is set to true in the EA inputs.
TECHNICAL DETAILS
— Trade detection: dual mechanism via OnTradeTransaction (real-time) + deal history polling every 2 seconds (fallback)
— Deduplication: processed deals stored in memory (last 500 deals tracked)
— SL/TP detection: position snapshot array compared on every tick, triggers on any change
— Connection test: /getMe endpoint called on init to validate token and retrieve bot name
— Summary timer: EventSetTimer(60) checks if the configured interval has elapsed
— Chart objects: all dashboard objects use prefix "EXTB_" and are cleaned up on deinit
This EA is free and open source. Feedback, ratings, and suggestions are welcome.
ExMachina Trading Systems — Precision before profit.