2026-04-07 09:56:10 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| 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 |
|
| | | //+------------------------------------------------------------------+
|
2026-04-08 20:35:41 -05:00 | | | input long InpCharId = 0; // Chart id padre
|
| | | input string InpFileNameStart = ""; // Nombre del archivo temporal (comuniacion)
|
| | | input bool InpCommonFolder = false; // Common folder
|
2026-04-13 17:42:23 -05:00 | | | input ENUM_VERBOSE_LOG_LEVEL InpLogLevel = VERBOSE_LOG_LEVEL_ALL; // Log level
|
2026-04-07 09:56:10 -05:00 | | |
|
2026-04-08 07:03:04 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Global variables |
|
| | | //+------------------------------------------------------------------+
|
2026-05-29 11:19:18 -05:00 | | | TSN::CWorkflow g_wf;
|
2026-07-15 13:36:40 -05:00 | | | TSN::CWfCallBack* g_callback;
|
2026-04-07 09:56:10 -05:00 | | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert initialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | int OnInit()
|
| | | {
|
2026-04-13 17:42:23 -05:00 | | | //---
|
| | | g_wf.AddLogFlags(InpLogLevel);
|
| | |
|
2026-04-08 20:35:41 -05:00 | | | //--- 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
|
2026-04-07 09:56:10 -05:00 | | | // CallBack
|
2026-07-15 13:36:40 -05:00 | | | g_callback = new TSN::CWfCallBack();
|
2026-04-08 20:35:41 -05:00 | | | g_callback.Set(InpCharId, &g_wf, InpFileNameStart, InpCommonFolder);
|
2026-04-07 09:56:10 -05:00 | | | 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;
|
2026-04-09 06:52:40 -05:00 | | | //---
|
2026-05-29 11:19:18 -05:00 | | | TSN::CWorflowsFactory::Deinit(reason);
|
2026-04-07 09:56:10 -05:00 | | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert tick function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTick()
|
| | | {
|
| | | //---
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| ChartEvent function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnChartEvent(const int id,
|
| | | const long &lparam,
|
| | | const double &dparam,
|
| | | const string &sparam)
|
| | | {
|
| | | //---
|
2026-04-08 20:35:41 -05:00 | | | // 1ero siempre el callback (escuhar eventos de inifio de wf)
|
| | | g_callback.ChartEvent(id, lparam, dparam, sparam);
|
| | | // Luego el wf real el que corre
|
2026-04-07 09:56:10 -05:00 | | | g_wf.ChartEvent(id, lparam, dparam, sparam);
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
2026-04-10 15:42:04 -05:00 | | | //| Timer function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTimer()
|
| | | {
|
| | | //---
|
| | | g_wf.TimerEvent();
|
| | | }
|
| | | //+------------------------------------------------------------------+
|