Don’t forget to share it with your network!
Deven Jayantilal Ramani
CTO, Softices
MetaTrader 5 Development, Telegram Trading Bot Development
22 May, 2026
Deven Jayantilal Ramani
CTO, Softices
If you run a trading signal service, you already know the routine.
→ A setup forms on the chart. You type it out, format the message, paste it into Telegram, double-check the stop loss, and by the time the signal reaches your subscribers, the entry is already gone.
Or worse, there’s a typo in the stop loss (SL).
Manual posting works when you have 50 subscribers. It starts breaking down when you have 500, when you’re monitoring multiple pairs at once, or when a setup triggers at 2 AM.
That’s why more signal providers are automating distribution directly from MetaTrader 5 (MT5) to Telegram.
This blog covers:
MetaTrader 5 has one major advantage for automation: it allows developers to react to trading events in real time through code.
Using MQL5, MT5’s built-in scripting language, you can create an Expert Advisor (EA) that listens for events such as:
The function that makes this possible is OnTradeTransaction().
Every time a trade-related event occurs, MT5 triggers this function automatically.
Inside it, you have access to:
In other words, everything required to generate a trading signal message.
MT5 also supports outbound HTTP requests through WebRequest(). That means an EA can directly call external APIs, including the Telegram
Bot API without requiring third-party plugins or desktop bridges.
This is one of the biggest reasons many developers prefer MT5 over MT4 for signal automation.
MT4 doesn't have OnTradeTransaction(), which makes real-time trade tracking significantly more limited.
If you're evaluating platform options, the MetaTrader 5 development ecosystem offers considerably more flexibility for building these kinds of automated workflows.
Telegram's Bot API is fast, free, and straightforward to work with. Understanding how a Telegram trading bot works from the ground up helps in designing a system that's both reliable and easy to maintain.
A basic request looks like this:
POST https://api.telegram.org/bot<TOKEN>/sendMessage
{
"chat_id": "@your_channel",
"text": "EURUSD BUY\nEntry: 1.08450\nSL: 1.08200\nTP: 1.09000",
"parse_mode": "HTML"
}
That single API call is enough to distribute a signal instantly to thousands of subscribers.
Before we go further, here's a real example of a polished signal message:
<b>EURUSD BUY</b> Entry: 1.08450 SL: 1.08200 (-25 pips) TP: 1.09000 (+55 pips) Risk: 1% account <a href="https://tradingview.com/chart/...">View Chart</a>
Clean, scannable, and professional. That's what your subscribers expect.
Most signal providers use channels rather than groups.
A common production setup uses:
Telegram allows:
For most signal services, this is more than enough.
Telegram supports:
Most developers prefer HTML because it’s easier to manage. MarkdownV2
requires escaping special characters like . ( ) - _ that
becomes frustrating quickly when formatting prices and trading data. HTML
tends to be cleaner and more predictable.
The simplest architecture is also the fastest to deploy.
Direct: MT5 EA → WebRequest → Telegram API → Channel
Trade opens in MT5 ↓ OnTradeTransaction() fires ↓ EA extracts trade data ↓ Message is formatted ↓ WebRequest() sends data to Telegram API ↓ Signal appears in Telegram
void OnTradeTransaction(
const MqlTradeTransaction& trans,
const MqlTradeRequest& request,
const MqlTradeResult& result)
{
if(trans.type == TRADE_TRANSACTION_DEAL_ADD)
{
string symbol = trans.symbol;
double price = trans.price;
// Build Telegram message
// Send using WebRequest()
}
}
Before this works, MT5 must allow outbound HTTP requests.
Go to:
Tools → Options → Expert Advisors
Then add:
https://api.telegram.org
to the list of allowed URLs.
MT5 blocks outbound HTTP requests by default as a security measure. Without
this step, WebRequest() will fail silently.
A Note on WebRequest() Limitations
WebRequest() is synchronous and blocks the EA thread briefly.
For most signal services sending a few trades per day, this doesn't
matter. For high-frequency strategies like scalping or tick trading,
consider batching updates or using a lightweight local bridge instead.
The direct MT5 → Telegram approach works well for:
Advantages:
But there’s one major downside:
The system depends entirely on the MT5 terminal staying online.
If any of these happen, signals stop immediately:
That’s why larger services typically introduce a middleware layer.
For production-grade systems, most developers place a lightweight server between MT5 and Telegram. The EA sends trade data to your own endpoint, and the server handles the Telegram delivery.
Middleware: MT5 EA → JSON → Your Server → Telegram API → Channels + Groups
MT5 (EA) → Middleware Server (Python/Node.js) → Telegram Bot API → Telegram Channels/Groups
This adds flexibility and reliability.
One signal can be distributed to:
…without modifying MT5.
If you're running a paid signal service, you might want a dedicated Telegram trading bot built for distribution and subscription management.
The server can enhance signals with:
Instead of posting separate messages for every update, the server can reply to the original signal message.
Example:
EURUSD BUY @ 1.08450 | SL: 1.08200 | TP: 1.09000 └── ✅ TP hit @ 1.09000 | +55 pips | +$110
This keeps channels organized and easier to follow.
MT5 can occasionally fire duplicate trade events during:
A middleware server can prevent duplicate Telegram messages by storing processed deal IDs in Redis, an in-memory cache, or a local file store.
A lightweight Python setup using FastAPI:
from fastapi import FastAPI
import httpx
app = FastAPI()
@app.post("/signal")
async def receive_signal(payload: dict):
message = format_signal(payload)
await send_to_telegram(message)
return {"status": "ok"}
async def send_to_telegram(text: str):
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
async with httpx.AsyncClient() as client:
await client.post(
url,
json={
"chat_id": CHANNEL_ID,
"text": text,
"parse_mode": "HTML"
}
)
The EA sends structured JSON to the server, and the server handles delivery, logging, retries, formatting, channel routing.
Deploy this on a VPS close to your broker’s infrastructure to minimize latency.
One thing separates basic signal bots from polished systems: tracking the trade from start to finish.
Subscribers don’t just care about entries. They also want updates like:
A signal channel that only posts entries feels incomplete.
To handle this, the EA needs to fire messages for multiple events:
Event |
Action |
|---|---|
| Trade opened | Send signal with entry, SL, TP, risk info |
| SL/TP modified | Send update message |
| Trade closed | Send result (profit/loss, pips, percentage return, duration) |
Telegram supports reply_to_message_id. This allows updates to
appear underneath the original signal.
The server simply stores the Telegram message_id returned when
the signal is first posted.
Later updates reference that ID.
This creates a much cleaner subscriber experience.
MT5 can fire OnTradeTransaction() more than once for the same
event during reconnections.
Running MT5 on a local machine is risky. Sleep mode, power cuts, or crashes can stop all signals.
Never hardcode your Telegram bot token into shared source code.
Better Options:
This is usually not an issue for normal trade signals, but be mindful when sending performance summaries, weekly reports, or statistics.
If your bot also responds to subscriber commands like:
/status/results/helpyou’ll need inbound message handling.
Production Recommendation: Use webhooks instead of polling due to lower latency, lower server load, and better scalability.
If you're evaluating overall security before committing to an architecture, it's worth reviewing whether Telegram trading bots are safe, particularly around token exposure, subscriber data, and channel access controls.
Putting this all together, a production signal distribution setup typically looks like:
OnTradeTransaction() capturing trade opens, modifications,
and closes
WebRequest() posting structured JSON to your middleware
server
Python (FastAPI or Flask) or Node.js (Express)
Handles:
Optional additions:
Common setup:
Group with restricted posting for paid subscribers who want to ask questions
Most production systems run on VPS instances located near broker servers:
Process managers help maintain uptime:
For prop firms and larger operations running multiple accounts, the MT5 Manager API adds another layer, enabling account-level trade routing and reporting that a single EA can't handle on its own.
Automation isn't always the right answer. Consider staying manual if:
For everyone else, automation is a competitive advantage.
If you’re still posting trading signals manually, the move to automation is probably smaller than it looks.
The Telegram side can be set up in a few hours.
A basic MT5 EA capable of sending signals is only a few dozen lines of code.
The real complexity comes later in the middleware layer:
But that investment pays off quickly.
Subscribers notice:
And once the workflow is automated, you spend less time formatting messages and more time focusing on trading itself.
At Softices, we build exactly this kind of integration from simple MT5-to-Telegram setups to full multi-channel signal distribution systems with subscriber management and performance reporting.
If you're looking to automate your signal service or need a custom trading tool built around your workflow, we'd be glad to talk through what that looks like for you.
| Architecture | Best For | Pros | Cons |
|---|---|---|---|
| Direct MT5 → Telegram | Small services, MVPs | Simple, no server, low latency | Terminal must stay online 24/7 |
| Middleware-based | Production, scale | Reliable, feature-rich, multicasting | Requires server setup and maintenance |
Have questions about implementing this for your signal service? Reach out! We've built these systems for providers handling everything from 100 to 10,000+ subscribers.