#include <TelegramBot.mqh> CTelegramBot bot; int OnInit() { // Initialize bot if(!bot.Initialize("YOUR_TOKEN", "YOUR_CHAT_ID")) { Print("Failed to initialize bot"); return INIT_FAILED; } // Send test message bot.SendMessage("Bot connected successfully!"); // Send chart screenshot bot.SendChartScreenshot("Current market situation"); return INIT_SUCCEEDED; }
bool SendMessage(string text); bool SendHTMLMessage(string text); bool SendMarkdownMessage(string text); bool SendMessageToAll(string text);
bool SendTradeSignal(ENUM_SIGNAL_TYPE type, string symbol, double price); bool SendPositionOpened(ulong ticket, string symbol, ENUM_POSITION_TYPE type, double volume, double price); bool SendPositionClosed(ulong ticket, string symbol, double profit, double commission, double swap);
bool SendPhoto(string file_path, string caption); bool SendDocument(string file_path, string caption); bool SendChartScreenshot(); bool SendChartScreenshot(string caption);
bool SendAccountStatus(); bool SendDailyReport(); bool SendWeeklyReport(); bool SendMonthlyReport();
bool SendRiskAlert(double drawdown_percent); bool SendMarginWarning(double margin_level); bool SendStopOutWarning();
The package includes a fully functional example EA demonstrating:
string message = "<b>Bold text</b>\n"; message += "<i>Italic text</i>\n"; message += "<code>Fixed-width code</code>\n"; message += "<a href='http://example.com'>Link</a>"; bot.SendHTMLMessage(message);
string message = "*Bold text*\n"; message += "_Italic text_\n"; message += "`Fixed-width code`\n"; message += "[Link](http://example.com)"; bot.SendMarkdownMessage(message);
The library includes comprehensive error handling:
This library is provided as-is for use in MetaTrader 5. Free for personal and commercial use.
Financial Blueprint
Professional Trading Solutions
This software is provided "as is" without warranty of any kind. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results.
If you find this library useful, please rate it on MQL5 CodeBase!
Find BotFather
Create New Bot
Configure Bot
Solution: 1. Tools → Options → Expert Advisors 2. ✓ Allow WebRequest for listed URL 3. Add: https://api.telegram.org 4. Restart MT5
Check: 1. Token correctness 2. Chat ID correctness 3. Internet connection 4. WebRequest settings
Possible causes: 1. API limit exceeded (30 messages/minute) 2. Invalid HTML format in message 3. Message too long (>4096 characters)
bot.SendTradeSignal(SIGNAL_BUY, "EURUSD", 1.1850, 1.1800, 1.1900);
string caption = "<b>Entry Point</b>\n"; caption += "Pair: EURUSD\n"; caption += "Type: BUY\n"; caption += "Price: 1.1850"; bot.SendChartScreenshot(caption);
bot.SendAccountStatus();
// Automatically sends balance, equity, margin, etc. // In EA's OnTimer() if(TimeHour(TimeCurrent()) == 23 && TimeMinute(TimeCurrent()) == 0) { bot.SendDailyReport(); }
double drawdown = CalculateDrawdown(); // Your calculation function if(drawdown > 20.0) // Drawdown greater than 20% { bot.SendRiskAlert(drawdown); }
[POSITION OPENED] ↑ ================ Ticket: #12345678 Symbol: EURUSD Type: BUY Volume: 0.10 Price: 1.18500 Time: 2024.01.15 10:30
[POSITION CLOSED] ================ Ticket: #12345678 Symbol: EURUSD Profit: +125.50 USD Commission: -2.00 Swap: -0.50 Total: +123.00 USD Time: 2024.01.15 14:45 ================
[DAILY REPORT] ================ Date: 2024.01.15 ACCOUNT SUMMARY ---------------- Balance: 10,125.50 USD Equity: 10,250.00 USD Floating P/L: +124.50 USD TRADING ACTIVITY ---------------- Trades Today: 5 Today's Result: +250.00 USD Open Positions: 2 BOT STATISTICS ---------------- Messages Sent: 45 Signals Sent: 8 Success Rate: 98.5% ================
Martingale Pulse EA
Introducing MP by SPLpulse, a sophisticated and highly versatile Expert Advisor designed for the modern trader. Whether you are a scalper, a trend follower, or a reversal trader, MP by SPLpulse combines multiple trading strategies with an institutional-grade risk management suite to adapt to your unique trading style. Take control of your trading with unparalleled customization and powerful automation.
WaveTrend
The WaveTrend Indicator (WT) is a powerful technical analysis tool designed to identify trend direction and potential reversal points. It plots two lines, WT1 and WT2 , in a separate window, calculated based on price momentum and smoothed averages.
The RSI Engine
The RSI Engine EA is a highly versatile automated trading robot for MetaTrader 5, designed to execute trades based on signals from the popular Relative Strength Index (RSI) indicator. Version 2.1 features optimized signal processing and enhanced stability. The EA provides a flexible framework with multiple RSI-based strategies, confirmation filters, and comprehensive trade management settings, making it suitable for both novice and experienced traders.
ZIGZAG CALIBRATION TOOLS
Allows you to easily visualize bullish and bearish periods confirmed by the zigzag indicator using vlines. You can control the display of the zigzag, choosing to start from the beginning of the chart or from a certain number of bars, as well as the display of labels showing the price of the peak or trough, the direction of the past period, and its amplitude in pips. Of course, it works on the main window as well as on sub-windows. WARNING!!! This is a valuable aid to understanding and calibrating indicators and developing strategies, but it is not intended for direct use. Translated with DeepL.com (free version)