//+------------------------------------------------------------------+ //| RunnerWF.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 "Main.mqh" //+------------------------------------------------------------------+ //| Inputs | //+------------------------------------------------------------------+ input long InpCharId = 0; // Chart id padre input string InpFileNameStart = ""; // Nombre del archivo temporal (comuniacion) input bool InpCommonFolder = false; // Common folder input ENUM_VERBOSE_LOG_LEVEL InpLogLevel = VERBOSE_LOG_LEVEL_ALL; // Log level //+------------------------------------------------------------------+ //| Global variables | //+------------------------------------------------------------------+ CWorkflow g_wf; CWfCallBack* g_callback; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- g_wf.AddLogFlags(InpLogLevel); //--- Ahora mismo solo inciaremos el callback // Nota aqui el callback no solo escucha los eventos del wf // Si no que sirve de comunicador entre el panel y la clase de wf // CallBack g_callback = new CWfCallBack(); g_callback.Set(InpCharId, &g_wf, InpFileNameStart, InpCommonFolder); g_wf.AddCallBack(g_callback); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- if(CheckPointer(g_callback) == POINTER_DYNAMIC) delete g_callback; //--- CWorflowsFactory::Deinit(reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- // 1ero siempre el callback (escuhar eventos de inifio de wf) g_callback.ChartEvent(id, lparam, dparam, sparam); // Luego el wf real el que corre g_wf.ChartEvent(id, lparam, dparam, sparam); } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- g_wf.TimerEvent(); } //+------------------------------------------------------------------+