The problem
The client trades gold on MetaTrader 5 and runs a paid VIP channel on Telegram, where members follow their trades as they happen. Before the bot, every entry, every stop-loss change and every close was typed out by hand on a phone, at the same moment the client needed to keep an eye on the chart. When a post came late or got missed, the people paying for the channel noticed. The weekly recap meant going back through the week and adding everything up again.
Two rules were settled before I wrote any code. The bot must never be able to open, change or close a trade, and it must never see the account password. And because members pay for an honest record, a trade that has been posted must always get its ending posted too, whether it won or lost.
What I built
A small Python service that runs on the trader's own Windows PC, next to MetaTrader, and turns what happens in the terminal into posts in the channel.
Getting to know the terminal first
Before building the bot, I wrote a read-only diagnostic tool and ran it against the client's terminal to answer the questions the bot would depend on. It turned up a few things that would have caused wrong posts. The broker's clock runs two to three hours ahead of UTC and shifts with European daylight saving, so asking MetaTrader for "today's deals" in UTC quietly returned nothing. The account can hold several gold positions at once, including opposite ones, so every position needs its own identity. And simply connecting to MetaTrader while it's closed launches a new terminal window, so the bot has to check first. Everything the bot does is built on those findings rather than on guesses.
How a trade reaches the channel
Step 1 / 4
- Every few seconds the bot reads the terminal: new deals, open positions and pending orders, and any stop-loss or take-profit changes. It only ever reads.
- It compares what it sees with what it saw last time and works out what happened: a position opened, a stop-loss moved, a partial close or a full close.
- Each event is written to a local database before anything is sent, together with the message it should become. If Telegram can't be reached, the message waits there and is sent again later.
- The post goes to the channel in WIB, with a small chart of the trade. Updates and the close are posted as replies under the original trade, so members can follow one trade from open to close.


Keeping it honest and safe
The read-only rule is checked, not just promised. A test reads every source file and fails if any trading call or password setting appears anywhere, and the bot refuses to start if its settings contain anything that looks like a password. The owner can choose to keep a trade out of the channel, but only before it starts. Once a trade has been posted, its updates and its close always follow, so members never see an entry without its ending.
A home PC will have bad days, so I planned for them. On its very first run the bot saves the trades that already exist as a starting point, so the channel isn't flooded with old history. If MetaTrader closes, signs out or switches to a different account, posting pauses and the admins get a message. When things are back to normal, the trades it missed are posted and marked as delayed, and a heartbeat check outside the PC raises an alert if the machine goes quiet altogether.
The owner sets everything up from their phone, in Indonesian: add the bot to the channel, confirm the account, choose how posts look, see a sample, then tap Start posting. Nothing goes out before that tap. On top of the trade posts there are daily and weekly recaps, a private performance report, and an approval step for people joining the VIP channel. Installing it is one PowerShell script, which also makes sure the bot starts again by itself if it ever stops.
The result
Trades reach the channel a few seconds after they happen, without the trader touching their phone, and the weekly recap writes itself. Every trade that's posted gets its close posted too, win or lose, all in one thread. After a restart or a power cut the bot catches up quietly instead of flooding the channel with old trades.
