Advertisement IC Markets

Alert Bots: Sending Trading Alerts to Telegram or Discord

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS Prop Desk
Posts: 415
Joined: Wed Oct 07, 2026 9:52 am

Alert Bots: Sending Trading Alerts to Telegram or Discord

Post by FXS Prop Desk »

Bots can send alerts from MT5 or Python scripts to Telegram or Discord, so you can monitor setups or EAs remotely.

Telegram example (Python):

Code: Select all

import requests
def send(msg):
    requests.post(f"https://api.telegram.org/bot{TOKEN}/sendMessage",
                  data={"chat_id": CHAT_ID, "text": msg})
Uses:
  • Setup alerts when price reaches a level.
  • Fill notifications from EAs.
  • Daily summaries of trades and equity.
  • Error alerts.
Security tips: keep tokens out of shared code, and do not allow trading commands without authentication.

MQL5 can also send web requests directly using WebRequest (after allowing the URL in settings).

Rate limits are worth knowing: Telegram and Discord restrict how many messages a bot can send per second. Grouping alerts into one message during busy periods prevents lost notifications.

Do you use alert bots, and which platform do you send them to?
FXS Official Team | The Idea Lab & Strategy
Recommended broker for automated trading & scalping IC Markets
Shadow Trader
Posts: 989
Joined: Wed Sep 09, 2026 5:19 pm

Re: Alert Bots: Sending Trading Alerts to Telegram or Discord

Post by Shadow Trader »

One practical thing worth knowing before wiring this into anything that trades: a plain requests.post call without a timeout can block forever. If Telegram is slow and the alert sits inside the same loop that manages your stops, the alert can delay the thing it was meant to report.

I always pass a timeout of a few seconds and push messages onto a queue that a separate thread sends. The trading loop just drops the text in and moves on, and if the send fails it gets retried without holding anything up.

On the MQL5 side, WebRequest is synchronous and can't be called from an indicator, only from an EA or a script. So an alert built into an indicator needs a different route, usually writing to a file that a small Python process watches.

On the rate limits, the rough numbers I work with are about one message per second to a single chat on Telegram, and a similar small burst limit per webhook on Discord. Batching fills into one message every 30 seconds keeps you well clear of both.

Which alerts have you actually found worth keeping? Mine shrank to fills, errors and the end of day summary within a month.
Shadow Trader
Posts: 989
Joined: Wed Sep 09, 2026 5:19 pm

Re: Alert Bots: Sending Trading Alerts to Telegram or Discord

Post by Shadow Trader »

FXS Prop Desk, the security tip about blocking trading commands is the line I would put above the code sample. My bots can only send text. They cannot place, modify or close anything, and the token lives in an env file the trading process cannot read.

Telegram won for me over Discord for fills and errors because the mobile push is faster on my phone. Discord keeps the end of day summary only, in a private channel I read after the session.

I dropped level alerts within two weeks. They fired all session and trained me to ignore the phone, which defeated the fills and error channel.

Batching still sits at one message every 30 seconds during busy London. Single fill spam was how I hit the chat limit on a news morning and lost the error that mattered.

Which platform do you trust for the error path when the VPS itself is under load? That is the case where a blocked requests call without a queue hurt me once.
Post Reply