Librería profesional de integración Telegram Bot para MetaTrader 5. Una solución completa para enviar señales comerciales, capturas de pantalla, informes y notificaciones en tiempo real a los canales y grupos de Telegram.
#include <TelegramBot.mqh> CTelegramBot bot; int OnInit() { // Inicializar el bot if(!bot.Initialize("YOUR_TOKEN"., "YOUR_CHAT_ID")) { Print("Fallo al inicializar bot"); return INIT_FAILED; } // Envío de un mensaje de prueba bot.SendMessage("¡Bot conectado con éxito!"); // Enviar una captura de pantalla del gráfico bot.SendChartScreenshot("Situación actual del mercado".); 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();
El paquete incluye un ejemplo totalmente funcional del Asesor Experto, demostrando:
string message = "<b> Жирный текст</b>\n"; message += "<i> Курсив</i>\n"; message += "<code> Моноширинный код</code>\n"; message += "<a href='http://example.com'> Ссылка</a>"; bot.SendHTMLMessage(message);
string message = "Texto en negrita"; message += "Cursiva".; message += "Código monoespaciado".; message += "[Enlace](http://example.com)"; bot.SendMarkdownMessage(message);
La biblioteca incluye una compleja gestión de errores:
Esta biblioteca se proporciona "tal cual" para su uso en MetaTrader 5. Es gratuita para uso personal y comercial.
Forex Trading Blueprint
(Stepan Sinic)
Este software se proporciona "tal cual" sin garantía de ningún tipo. El comercio implica un riesgo sustancial de pérdida y no es adecuado para todos los inversores. El rendimiento pasado no es un indicador de resultados futuros.
Si encuentra útil esta librería, ¡por favor valórela en MQL5 CodeBase!
Encontrar BotFather
Crear un nuevo bot
Configure el bot
Solución: 1. Herramientas → Configuración → Asesores 2. Haga clic en Aceptar. ✓ Permitir WebRequest para las siguientes URLs 3. Añadir: https://api.telegram.org 4. Reiniciar MT5
Compruebe: 1. Token correcto 2. 3. Conexión a Internet 4. Configuración de WebRequest
Posibles causas: 1. Límite API excedido (30 mensajes/minuto) 2. 2. Formato HTML incorrecto en el mensaje. Mensaje demasiado largo (>4096 caracteres)
bot.SendTradeSignal(SIGNAL_BUY, "EURUSD", 1.1850, 1.1800, 1.1900);
string caption = "<b> Точка входа</b>\n"; caption += "Пара: EURUSD\n"; caption += "Тип: BUY\n"; caption += "Цена: 1.1850"; bot.SendChartScreenshot(caption);
bot.SendAccountStatus();
// Enviar automáticamente saldo, capital, margen, etc. // En el asesor OnTimer() if(TimeHour(TimeCurrent()) == 23 && TimeMinute(TimeCurrent()) == 0) { bot.SendDailyReport(); }
double drawdown = CalculateDrawdown(); // Su función de cálculo if(drawdown > 20.0) // La reducción es superior al 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% ================
Traducción del ruso realizada por MetaQuotes Ltd
Artículo original: /ru/code/63585
MT5 to Telegram Professional Library
Librería profesional de integración Telegram Bot para MetaTrader 5. Solución completa para enviar señales de trading, capturas de pantalla, informes y notificaciones en tiempo real a canales y grupos de Telegram.
Arbitrage Triangle EURGBP-EURUSD-GBPUSD
El EA identifica las discrepancias entre los tipos de cambio teóricos y reales para ejecutar oportunidades de negociación con un riesgo mínimo.
TimeBar
Un simple indicador de información que muestra el tiempo restante hasta el cierre de la barra, así como el tiempo transcurrido desde la apertura de la barra y la hora actual.
Fractales Dinámicos
Modificación del indicador estándar Fractal