Join our fan page
- Views:
- 1050
- Rating:
- Published:
- Updated:
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
Key Features
- 📨 Real-time Trading Notifications - Instant alerts for position open/close/modify
- 📸 Chart Screenshots - Automatic chart captures with annotations
- 📊 Account Reports - Daily, weekly, and monthly performance reports
- ⚠️ Risk Management Alerts - Drawdown, margin level, and stop-out warnings
- 🔄 Message Queue System - Reliable delivery with retry mechanism
- 👥 Multi-Channel Support - Broadcast to multiple Telegram chats/channels
- 📝 Template System - Customizable message templates
- 🎯 Smart Rate Limiting - Prevents API throttling
Requirements
- MetaTrader 5 build 2375 or higher
- Telegram Bot Token (obtain from @BotFather)
- Chat ID or Channel ID
- Internet connection
Installation
Step 1: Create Telegram Bot
- Open Telegram and search for @BotFather
- Send /newbot command
- Choose a name for your bot
- Choose a username (must end with 'bot')
- Save the token provided by BotFather
Step 2: Get Chat ID
- Add your bot to a group/channel or start private chat
- Send any message to the bot
- Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
- Find the chat ID in the response
Step 3: Configure MT5
- Open MT5 → Tools → Options → Expert Advisors
- Check "Allow WebRequest for listed URL"
- Add URL: https://api.telegram.org
- Click OK
Step 4: Install Files
- Copy TelegramBot.mqh to MQL5/Include/
- Copy TelegramBot_Example.mq5 to MQL5/Experts/
- Compile both files
Quick Start
#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; }
API Reference
Basic Messaging
bool SendMessage(string text); bool SendHTMLMessage(string text); bool SendMarkdownMessage(string text); bool SendMessageToAll(string text);
Trading Signals
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);
Media
bool SendPhoto(string file_path, string caption); bool SendDocument(string file_path, string caption); bool SendChartScreenshot(); bool SendChartScreenshot(string caption);
Reports
bool SendAccountStatus(); bool SendDailyReport(); bool SendWeeklyReport(); bool SendMonthlyReport();
Risk Management
bool SendRiskAlert(double drawdown_percent); bool SendMarginWarning(double margin_level); bool SendStopOutWarning();
Example Expert Advisor
The package includes a fully functional example EA demonstrating:
- Position monitoring with notifications
- Automatic screenshots on trade events
- Periodic account status updates
- Risk management alerts
- Daily reports
- Demo trading signals
Message Formatting
HTML Format (Recommended)
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);
Markdown Format
string message = "*Bold text*\n"; message += "_Italic text_\n"; message += "`Fixed-width code`\n"; message += "[Link](http://example.com)"; bot.SendMarkdownMessage(message);
Performance
- Message Rate: Up to 30 messages per minute
- File Size Limit: 50MB per file
- Message Length: 4096 characters
- Caption Length: 1024 characters
- Queue Size: 100 messages
- Average Response Time: 50-200ms
Error Handling
The library includes comprehensive error handling:
- Connection validation
- Rate limiting protection
- Automatic retries on failure
- Queue system for failed messages
- Detailed error logging
Support
- Documentation: Full API documentation included in source
- Example EA: Working example with all features
- Debug Mode: Built-in debugging for troubleshooting
Version History
Version 1.0.0 (2024)
- Initial release
- Full Telegram Bot API integration
- Multi-channel support
- Queue system
- Template engine
- Risk management alerts
License
This library is provided as-is for use in MetaTrader 5. Free for personal and commercial use.
Author
Financial Blueprint
Professional Trading Solutions
Disclaimer
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!
Detailed Setup Instructions
Creating a Telegram Bot
-
Find BotFather
- Open Telegram
- Search for @BotFather
- Press START
-
Create New Bot
- Send /newbot command
- Enter bot name (e.g., "My Trading Bot")
- Enter bot username (e.g., my_trading_bot)
- Save the token like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
-
Configure Bot
- Send /setprivacy and select DISABLE (for group functionality)
- Send /setjoingroups and select ENABLE (to add to groups)
Getting Chat ID
For Private Messages:
- Start conversation with your bot
- Send any message
- Open in browser: https://api.telegram.org/bot<TOKEN>/getUpdates
- Find "chat":{"id":123456789} - this is your Chat ID
For Groups:
- Add bot to group
- Send message in group
- Open in browser: https://api.telegram.org/bot<TOKEN>/getUpdates
- Find "chat":{"id":-123456789} - negative number for groups
For Channels:
- Add bot as channel administrator
- Send message to channel
- Or use @channelname as Chat ID
Troubleshooting Common Issues
WebRequest Error:
Solution: 1. Tools → Options → Expert Advisors 2. ✓ Allow WebRequest for listed URL 3. Add: https://api.telegram.org 4. Restart MT5
Bot Not Responding:
Check: 1. Token correctness 2. Chat ID correctness 3. Internet connection 4. WebRequest settings
Messages Not Delivered:
Possible causes: 1. API limit exceeded (30 messages/minute) 2. Invalid HTML format in message 3. Message too long (>4096 characters)
Usage Examples
Send Buy Signal
bot.SendTradeSignal(SIGNAL_BUY, "EURUSD", 1.1850, 1.1800, 1.1900);
Send Screenshot with Annotation
string caption = "<b>Entry Point</b>\n"; caption += "Pair: EURUSD\n"; caption += "Type: BUY\n"; caption += "Price: 1.1850"; bot.SendChartScreenshot(caption);
Send Account Status
bot.SendAccountStatus();
// Automatically sends balance, equity, margin, etc.
Setup Daily Reports
// In EA's OnTimer() if(TimeHour(TimeCurrent()) == 23 && TimeMinute(TimeCurrent()) == 0) { bot.SendDailyReport(); }
Drawdown Alert
double drawdown = CalculateDrawdown(); // Your calculation function if(drawdown > 20.0) // Drawdown greater than 20% { bot.SendRiskAlert(drawdown); }
Message Structure
[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%
================

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.

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 Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Indicator edition for new platform.