User ManualApeX Trading ConsoleToolsTelegram setup

Setting up your Telegram bot

About ten minutes, once. At the end your phone gets a test message from MetaTrader, and you know which part to check if anything stops working later.

To connect ApeX Trading Console, the trade manager for MT5, to Telegram: create a bot with @BotFather and copy its token; in MetaTrader add https://api.telegram.org under Tools › Options › Expert Advisors; press the round Telegram button beside the panel and paste the token; put your numeric Telegram user ID in Allowed IDs, which adds your private chat with the bot; press Start in that chat, then Send in the Test column. Groups and channels are added with Find new chats.

Step 1 — Create the bot

  1. In Telegram, search for @BotFather — the official one has a blue tick — and open it.
  2. Send /newbot. Give the bot a display name, then a username that ends in “bot”, for example mytrades_alerts_bot.
  3. BotFather replies with a token, a long code with a colon in it. Copy it. Anyone who has it can use your bot, so keep it to yourself.
Telegram chat with BotFather: the /newbot command, a display name for the bot, then a username ending in bot
BotFather confirming the new bot, with the bot token outlined in red and blurred
Left: /newbot, a name, then a username ending in “bot”. Right: BotFather’s reply — the outlined line is the token (blurred here).

Step 2 — Allow Telegram in MetaTrader

MetaTrader only lets an Expert Advisor reach addresses you have listed. Open Tools › Options and go to the Expert Advisors tab. Switch on the WebRequest option for listed addresses, put https://api.telegram.org in the list below it, and press OK.

MetaTrader 5 Options window, Expert Advisors tab, with Allow WebRequest for listed URL ticked and https://api.telegram.org in the list
Without this line nothing can reach Telegram, and the console tells you “Telegram blocked”.

Step 3 — Open the Telegram settings and paste the token

Press the round Telegram button beside the panel. Click the Bot Token box, paste the token and press Enter. Once saved, the token is covered on screen; click the box again when you need to change it.

ApeX Trading Console panel on MT5 with the round Telegram button outlined at its top right
Telegram settings window in ApeX Trading Console for MT5: Bot Token, Allowed IDs, Fallback and Find new chats at the top, then the list of chats with On, Groups and Test
Left: the round Telegram button. Right: the window it opens — Bot Token and Allowed IDs at the top, your chats below.

Step 4 — Put your user ID in Allowed IDs

Allowed IDs is the list of people the bot will listen to. It takes the numeric Telegram user ID, not your @username. The Telegram app does not show this number; the quickest way is to open a lookup bot such as @userinfobot, press Start, and copy the number it replies with.

A Telegram user-ID bot replying to /start, with the Id line outlined in red and blurred, labelled Allowed IDs
After /start, the number on the Id line is what goes into Allowed IDs (blurred here).
  1. Paste the number into Allowed IDs and press Enter. For more than one person, separate the numbers with commas.
  2. A row called ApeX System appears in the chat list. That is your private chat with the bot, set to receive every alert group.
  3. In Telegram, open your new bot and press Start. Telegram does not let a bot write to anyone who has not started a chat with it first.

An empty Allowed IDs list lets nobody in: alerts still go out, but the bot accepts no commands, and groups you write in are not picked up by Find new chats.

Step 5 — Send a test

On the ApeX System row, press Send in the Test column. Your phone should get “connection test OK” from the bot, and the chart shows “Telegram: sent to ApeX System”. If you see “failed” instead, the number after it tells you why — see If something does not work.

That is the whole basic setup. To choose which events reach Telegram, open Notify & Sound and tick or untick each one there.

Step 6 — Add a group or a channel

Only if you want alerts in a group, or want to post signals to a channel you run. The list holds up to eight chats.

  1. Add your bot to the group or channel as an administrator.
  2. Post /apex in it.
  3. Within five minutes, press Find new chats. Rooms found are listed already ticked; press Add selected.
  4. Press the new row’s Groups button and choose System for alerts — then pick which alert groups it gets — or Channel for signals you send yourself from the signal bar. Step 7 explains the card.

No channel yet? The pictures below go through it in the Telegram app on a phone, numbered in order: 1 name the channel · 2 choose Public or Private · 3 skip adding subscribers · 4 the channel is created · 5 open its info and tap Administrators · 6–7 Add Admin, then search for your bot’s username · 8 leave its rights as they are and tap Add Admin · 9 the bot now shows as admin.

Nine numbered Telegram phone screens: creating a channel, choosing private, the new channel, its info page, the administrators list, searching for the bot, its admin rights and the bot listed as admin
Creating a signal channel and making your bot its administrator, in nine screens.
New chats found card in the ApeX Telegram settings on MT5: three channels named Free, Premium and VIP, each ticked, with their chat IDs blurred and an Add selected button
Three channels that posted /apex, all ticked. Add selected puts them into free rows of the list (chat IDs blurred here).

Find new chats does not ask Telegram at the moment you press it. It lists what the console has already received, so something has to be receiving: the Bridge service in step 8, or — without it — a draft zone on the chart with Fallback on, when the console checks for messages every 25 seconds. You can also type a chat ID into an empty row by hand; How to set up Telegram, at the bottom of the window, shows how to find it.

Step 7 — Choose what each chat receives

Every chat in the list has its own Groups card. Open it with the button in that row’s Groups column. For your own chat, that is the ApeX System row — the one created in step 4, whose Chat ID is the same number you typed into Allowed IDs. The number is covered on screen, so go by the name.

ApeX Telegram settings on MT5 with the Groups button of the ApeX System row outlined; the other rows are channels
Groups card of the ApeX System chat: 1 System or Channel, 2 the ten alert groups with All, None and Chart image, 3 the four control switches
Left: the Groups button of the ApeX System row — here it reads All. Right: the card it opens, in three parts.
  1. System or Channel — what kind of room this is. Your own chat must be System: it receives your alerts and, later, can take commands. Channel is for rooms where you post signals from the signal bar; a channel gets nothing else, and parts 2 and 3 disappear from its card.
  2. Alert groups — blue means this room gets that group, from Orders to Other; All and None switch them in one go. Chart image adds a picture of the chart to trading alerts. Which events belong to each group, and whether an event goes to Telegram at all, is set in Notify & Sound.
  3. Control — lets this chat send commands and use buttons. It only works with the Bridge service; see step 8.

Step 8 — Commands from your phone (optional)

Alerts and signals work without this. Typed commands and buttons in the chat need the free ApeX Telegram Bridge service, which reads replies around the clock.

  1. Download ApeX Telegram Bridge from the download page.
  2. In MetaTrader choose File › Open Data Folder, and copy the file into MQL5\Services.
  3. In the Navigator, right-click Services and choose Refresh. Right-click ApeXTgBridge, choose Add Service and press OK.
  4. Back in the Telegram settings, the corner should read Bridge: running.
  5. Open the Groups card of the ApeX System row (step 7) and switch on what you need in part 3.
Switch in part 3 What it allows
Control buttons Makes this chat the control room, the only one that can send commands. There can be just one: turning it on here turns it off in any other chat. It also adds the place, execute and cancel buttons to trade-engine messages.
Control close The close buttons from /close, /closeprofit and /closeloss.
Control order The ✕ that cancels a pending order in /orders.
Control position The ✕ that closes one open position in /positions.

Control close, order and position all start off. While one is off, the bot answers that command with a note saying which switch to turn on, instead of buttons.

ApeX Telegram settings window on MT5 with Bridge: running shown in green at the bottom right
Bottom right of the Telegram settings: Bridge: running means the service is reading replies.

The commands themselves are listed on MT5 and Telegram.

If something does not work

What you see What to do
Telegram blocked The address is missing from Tools › Options › Expert Advisors. Add https://api.telegram.org (step 2), then press Send again.
failed (HTTP 401) Telegram rejected the token. Copy it again from BotFather and paste it in full. It is not a ban.
failed (HTTP 403) The bot is not allowed to write to that chat. In your own chat, press Start; in a group or channel, make sure the bot is still an administrator.
failed (HTTP 400) Telegram does not know that chat ID. Check the number in that row, or find the room again with Find new chats.
No new chats found Post /apex again and press Find new chats within five minutes, and make sure something is receiving (step 6). If it says another account is receiving for this bot, only that account can find rooms — one bot is read by one account at a time.
Commands get no answer Check that the corner reads Bridge: running, that you typed in the control room, and that your ID is in Allowed IDs — the Experts log names any ID it turned away. Buttons that do nothing usually mean the matching Control switch is still off.

Questions

Does my bot token go to ApeX?

No. It stays in MetaTrader on your computer, and messages go from your terminal straight to Telegram.

I have several trading accounts. Do I set this up for each?

Yes. The Telegram settings are kept per trading account, so if you change the bot token, change it in every account that uses it. One bot can send from all of them, but only one account at a time reads the replies.

Do I need the Bridge service for alerts?

No. Alerts, chart pictures and signals to channels are sent by the console itself. The Bridge is only for commands and chat buttons.

Checked against ApeX Trading Console 6.593.