ICTLibraryEasy/Examples/Global.mqh

79 lines
2.8 KiB
MQL5
Raw Permalink Normal View History

2026-01-06 16:54:30 -05:00
//+------------------------------------------------------------------+
//| Global.mqh |
//| 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 strict
#ifndef GLOBAL_MQH
#define GLOBAL_MQH
// Archivo Global.mqh aqui se ubican todas las incilizacion GLOBALES antes de OnInit
// En este caso la libreria ICT Easy
// SIEMPRE SE DEBERA DE INCLUIR ESTO ANTES DE INSTANCIAR O EJECUTAR CUALUIQER CONCEPTO ICT
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include <TSN\\MQLArticles\\Utils\\TFManager.mqh>
2026-02-11 15:37:09 -05:00
2026-01-06 16:54:30 -05:00
//--- Instancia de new bar manager
CNewBarManager g_new_bar_manager;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
// El objetto del manager se intancia primero antes de incluir ICTLibraryEasy
// La libreria requiere saber... cual es el manager que usara..
// Incluimos los componentes de la lib que usaremos
#include "..\\Src\\ICTConcepts.mqh"
2026-02-11 15:37:09 -05:00
//--- Incluiremos las librerias de eventos principales
#include <TSN\\MQLArticles\\Utils\\FA\\AutoDelete.mqh>
#include <TSN\\MQLArticles\\RM\\AccountStatus.mqh>
2026-01-06 16:54:30 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-02-11 15:37:09 -05:00
class CGlobalInit
2026-01-06 16:54:30 -05:00
{
private:
static bool init;
public:
//--- Incializacion global
2026-02-11 15:37:09 -05:00
CGlobalInit(void)
2026-01-06 16:54:30 -05:00
{
if(init)
return;
2026-02-11 15:37:09 -05:00
//---
CBasicEvents::Init();
2026-01-06 16:54:30 -05:00
//--- Seteasmos el bar manager
ICTGen_BarManagerSet(GetPointer(g_new_bar_manager)); // Le damos a la libreira ICT el manager
2026-02-11 15:37:09 -05:00
//---
#ifndef DEFGLOBAL_SIMPLE
CAutoCleaner::AddFunction(CAccountStatus_Deinit);
CAutoCleaner::AddFunction(CBasicEvents::Deinit);
CAutoCleaner::AddFunction(ICTGen_OnDeinitEvent);
#endif
2026-01-06 16:54:30 -05:00
//---
init = true;
}
//--- Deinicializacion global
2026-02-11 15:37:09 -05:00
~CGlobalInit(void) {}
2026-01-06 16:54:30 -05:00
};
//+------------------------------------------------------------------+
2026-02-11 15:37:09 -05:00
bool CGlobalInit::init = false;
2026-01-06 16:54:30 -05:00
//+------------------------------------------------------------------+
2026-02-11 15:37:09 -05:00
CGlobalInit g_global_instance;
2026-01-06 16:54:30 -05:00
//+------------------------------------------------------------------+
#endif // GLOBAL_MQH