2026-04-05 22:25:22 -05:00
|
|
|
//+------------------------------------------------------------------+
|
2026-04-05 17:18:28 -05:00
|
|
|
//| Generic.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"
|
|
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Resources |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#resource "test.yml" as const string yml_workflow
|
2026-04-06 13:04:47 -05:00
|
|
|
CWfCallBack* g_callback;
|
2026-04-05 17:18:28 -05:00
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Expert initialization function |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
int OnInit()
|
|
|
|
|
{
|
|
|
|
|
//---
|
2026-04-07 09:09:27 -05:00
|
|
|
CWorkflow flow; // Nota lo pongo aqui dado que el test.yml hay solo flujos SYNC asi que no hay problema
|
2026-04-08 11:55:14 -05:00
|
|
|
// En caso habria async entonces global (si no se destryte antes de ejecutar el resto de pasos)
|
2026-04-06 13:04:47 -05:00
|
|
|
g_callback = new CWfCallBack();
|
|
|
|
|
flow.AddCallBack(g_callback);
|
|
|
|
|
|
2026-04-08 11:55:14 -05:00
|
|
|
//--- Par de keys
|
2026-04-09 20:49:22 -05:00
|
|
|
CDict* dict = flow.Variables();
|
|
|
|
|
dict.Set("internal.number", string(GetTickCount()));
|
2026-04-08 11:55:14 -05:00
|
|
|
|
2026-04-06 13:04:47 -05:00
|
|
|
//---
|
2026-04-07 08:55:55 -05:00
|
|
|
if(!flow.Init(yml_workflow))
|
2026-04-05 17:18:28 -05:00
|
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
|
|
|
|
|
|
|
|
//---
|
2026-04-06 13:04:47 -05:00
|
|
|
const bool res = flow.First();
|
|
|
|
|
if(!res)
|
|
|
|
|
Print("Err excuting");
|
|
|
|
|
|
2026-04-05 17:18:28 -05:00
|
|
|
//---
|
2026-04-08 14:04:36 -05:00
|
|
|
return(1);
|
2026-04-05 17:18:28 -05:00
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Expert deinitialization function |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
void OnDeinit(const int reason)
|
|
|
|
|
{
|
|
|
|
|
//---
|
2026-04-06 13:04:47 -05:00
|
|
|
delete g_callback;
|
2026-04-07 09:06:54 -05:00
|
|
|
CWorflowsFactory::Deinit(reason);
|
2026-04-05 17:18:28 -05:00
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Expert tick function |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
void OnTick()
|
|
|
|
|
{
|
|
|
|
|
//---
|
|
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|