WorkflowsByLeo/Test/First/Generic.mq5
Nique_372 39ed3a2f43
2026-04-09 20:49:22 -05:00

65 righe
2,4 KiB
MQL5

//+------------------------------------------------------------------+
//| 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
CWfCallBack* g_callback;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
CWorkflow flow; // Nota lo pongo aqui dado que el test.yml hay solo flujos SYNC asi que no hay problema
// En caso habria async entonces global (si no se destryte antes de ejecutar el resto de pasos)
g_callback = new CWfCallBack();
flow.AddCallBack(g_callback);
//--- Par de keys
CDict* dict = flow.Variables();
dict.Set("internal.number", string(GetTickCount()));
//---
if(!flow.Init(yml_workflow))
return INIT_PARAMETERS_INCORRECT;
//---
const bool res = flow.First();
if(!res)
Print("Err excuting");
//---
return(1);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
delete g_callback;
CWorflowsFactory::Deinit(reason);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+