此资源为年度星钻会员专享,每日更新,收录于《大白EA宝库:星钻会员专属合集》。
这是一个交易提醒类工具 EA:通过 Telegram Bot API 把交易成交提醒推送到手机 Telegram 上。本帖文件为 MT4 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。
源码预览(先看代码,再决定下不下)
本帖是源码 EA:TelegramTradeNotify.mq4,全文共 349 行。下面是它的全部可调参数与文件开头,完整源码在上方下载区,星钻会员可见。
可调参数(7 个)
string InpBotToken = "";(Telegram bot token (e.g. 123456:ABC-DEF...))string InpChatId = "";(Chat ID or @channelusername (e.g. 12345678 or -100xxxxxxxxxx or @mychannel))bool InpSendTestOnInit = true;(Send test message on init)bool InpNotifyBuySellOnly = true;(Notify only BUY/SELL executions (ignore pending/balance/credit/etc.))bool InpDisableLinkPreview = true;(Disable web page preview)int InpTimeoutMs = 10000;(WebRequest timeout (ms))string InpMsgPrefix = "MT4";(Message prefix)
//+------------------------------------------------------------------+
//| TelegramTradeNotify_MT4.mq4 |
//| Copyright © 2026, Ngo The Hung (thehung21) |
//| https://www.b123.com/ |
//+------------------------------------------------------------------+
#property strict
#property version "1.00"
#property copyright "Copyright © 2026, Ngo The Hung (thehung21)"
#property link "https://www.b123.com/"
#property description "Utility EA: sends trade execution notifications to Telegram via Bot API (sendMessage)."
// ------------------------- Compatibility ---------------------------
// Some older MT4 builds don't define OP_BALANCE / OP_CREDIT constants.
// We define them here to avoid compile errors.
#ifndef OP_BALANCE
#define OP_BALANCE 6
#endif
#ifndef OP_CREDIT
#define OP_CREDIT 7
#endif
// ------------------------- Inputs ----------------------------------
input string InpBotToken = ""; // Telegram bot token (e.g. 123456:ABC-DEF...)
input string InpChatId = ""; // Chat ID or @channelusername (e.g. 12345678 or -100xxxxxxxxxx or @mychannel)
input bool InpSendTestOnInit = true; // Send test message on init
input bool InpNotifyBuySellOnly = true; // Notify only BUY/SELL executions (ignore pending/balance/credit/etc.)
input bool InpDisableLinkPreview = true; // Disable web page preview
input int InpTimeoutMs = 10000; // WebRequest timeout (ms)
input string InpMsgPrefix = "MT4"; // Message prefix
// ------------------------- Helpers ---------------------------------
class CTelegramNotifier
{
private:
string m_token;
风险提示:EA 交易有风险,过往与参数表现不代表未来。正式使用前先在模拟盘跑够样本,确认在自己的点差、滑点环境下仍符合预期,再决定是否上实盘。
版本说明:资源随 MT4/MT5 版本迭代可能失效,如遇失效请在本帖留言反馈。

