AiDataTaskRuner/AiDataTaskRunnerByLeo.mq5

128 lines
5.7 KiB
MQL5
Raw Permalink Normal View History

2026-03-17 08:31:01 -05:00
//+------------------------------------------------------------------+
//| AiDataTaskRunnerByLeo.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372"
#property version "1.00"
#property description "Automate data generation and AI model training through a simple, easy-to-use GUI."
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-03-21 06:15:18 -05:00
#include "Global.mqh"
2026-03-17 16:50:48 -05:00
#include "Backend\\All.mqh"
2026-03-17 08:31:01 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
sinput group "-- Panel folder --"
input ENUM_VERBOSE_LOG_LEVEL InpLogLevelPanelFronted = VERBOSE_LOG_LEVEL_ALL; // Log levels
input string InpGeneralBaseFolder = "AiDataTaskRunner\\"; // Folder for panel files
input bool InpGeneralCommonFolder = true; // In common folder ?
sinput group "-- Generation --"
input ENUM_VERBOSE_LOG_LEVEL InpLogLevelPanelBackend = VERBOSE_LOG_LEVEL_ALL; // Log levels
input bool InpBackendCommonIn = true; // Files EA input in common folder ?
input bool InpBackendCommonOut = true; // Files EA output in common folder ?
sinput group "-- Telegram bot --"
input string InpTelegramBotPath = EXPERT_TELEGRAM_PATH; // Put the path of telegram bot
2026-03-21 08:15:18 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-03-21 06:15:18 -05:00
sinput group "-- Training (Py comunication files)--"
input string InpTrainingPyComPathJson = "AiDataTaskRunner\\Comunication\\res.json"; // Put the path of json
input string InpTrainingPyComPathBin = "AiDataTaskRunner\\Comunication\\lock.bin"; // Put the path of bin file
2026-03-24 10:39:38 -05:00
input string InpTrainingPyLauncherEa = "AiDataTaskRuner\\Backend\\Training\\TrainingLauncher.ex5"; // Put the path of EA launcher (Relative at Experts\\)
2026-03-21 06:15:18 -05:00
2026-03-17 08:31:01 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CProgram g_program;
CExecutionTester g_backend;
2026-03-18 13:28:52 -05:00
CChatTelegramAgentLLmSenderAdtr* g_sender_to_telegram; // clase que procesa las llamdas de evento de telegram
2026-03-21 08:15:18 -05:00
CTrainingTabConfig* m_trainer_config;
2026-03-17 08:31:01 -05:00
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
g_aidatatask_runner_config_g.base_folder = InpGeneralBaseFolder;
g_aidatatask_runner_config_g.comon_flag = InpGeneralCommonFolder;
//--- Configraucion
// Backend
g_backend.AddLogFlags(InpLogLevelPanelBackend);
g_backend.Set(g_program.GetSecTaskRunerAiDGenPtr(), InpBackendCommonIn, InpBackendCommonOut);
// Fronted
g_program.GetSecTaskRunerAiDGenPtr().SetRunner(&g_backend);
2026-03-17 16:50:48 -05:00
// Tab ai
2026-03-18 13:28:52 -05:00
g_sender_to_telegram = new CChatTelegramAgentLLmSenderAdtr();
g_program.GetSecAi().Initialize(g_aidatatask_runner_config_g.base_folder, AIDATATASK_RUNNER_COMON_FLAG, g_sender_to_telegram);
g_sender_to_telegram.Set(&g_backend, g_program.GetSecTaskRunerAiDGenPtr()); // Setemoas los puntos del frontend y backend
g_sender_to_telegram.RunEA(InpTelegramBotPath); // Corremos el EA (tlgm)
2026-03-17 16:50:48 -05:00
2026-03-17 08:31:01 -05:00
//---
2026-03-21 06:15:18 -05:00
// Config del training tab
TrainingTabConfig config;
config.config_py_path_json_file = InpTrainingPyComPathJson;
config.config_py_path_lock_bin_file = InpTrainingPyComPathBin;
config.proyect_common_flag = InpBackendCommonOut;
2026-03-24 10:39:38 -05:00
config.config_path_to_ea_launcher = InpTrainingPyLauncherEa;
2026-03-21 08:15:18 -05:00
m_trainer_config = g_program.GetTrainingTab().Config();
2026-03-21 06:15:18 -05:00
//
g_program.CreateGUI(700, 500, InpLogLevelPanelFronted, config);
2026-03-17 08:31:01 -05:00
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
g_program.OnDeinitEvent(reason);
2026-03-21 06:15:18 -05:00
CAutoCleaner::Deinit(reason); // lamamos para que elimine todo lo relaciion a las depndicas del dsl
2026-03-17 08:31:01 -05:00
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
2026-03-21 08:15:18 -05:00
m_trainer_config.OnTimerEvent();
2026-03-17 08:31:01 -05:00
g_program.OnTimerEvent();
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int32_t id,
const long &lparam,
const double &dparam,
const string &sparam)
{
//---
2026-03-18 13:28:52 -05:00
g_sender_to_telegram.ChartEvent(id, lparam, dparam, sparam);
2026-03-17 08:31:01 -05:00
g_backend.ChartEvent(id, lparam, dparam, sparam);
g_program.ChartEvent(id, lparam, dparam, sparam);
}
//+------------------------------------------------------------------+