AiDataTaskRuner/Backend/Tlgm/TlgBot.mq5

88 lines
3.3 KiB
MQL5
Raw Permalink Normal View History

2026-03-17 16:38:37 -05:00
//+------------------------------------------------------------------+
//| EA.mq5 |
//| Copyright 2025, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Include |
//+------------------------------------------------------------------+
#include "Reciber.mqh"
//+------------------------------------------------------------------+
//| Inputs |
//+------------------------------------------------------------------+
input long InpChartIdPadre = -1;
input double InpKey = 0.00;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#resource "sys_prompt.txt" as const string g_system_prompt
//+------------------------------------------------------------------+
//| Global variables |
//+------------------------------------------------------------------+
2026-03-18 12:43:15 -05:00
CChatTelegramBaseFully bot(g_system_prompt);
2026-03-17 16:38:37 -05:00
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
if(!bot.Init(InpChartIdPadre, InpKey))
{
FastLog(FUNCION_ACTUAL, FATAL_ERROR_TEXT, "Fallo al setear parametros");
return INIT_PARAMETERS_INCORRECT;
}
//---
//f(bot.GetMe() != 0)
// {
// Print("Fallo");
// return INIT_PARAMETERS_INCORRECT;
// }
//---
EventSetTimer(1);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
bot.OnTimerEvent();
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnChartEvent(const int32_t id, const long& lparam, const double& dparam, const string& sparam)
{
bot.ChartEvent(id, lparam, dparam, sparam);
}
//+------------------------------------------------------------------+