ICTLibraryEasy/Examples/Global.mqh
Nique_372 11519498bb
2026-02-11 15:37:09 -05:00

79 lines
2.8 KiB
MQL5

//+------------------------------------------------------------------+
//| 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>
//--- 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"
//--- Incluiremos las librerias de eventos principales
#include <TSN\\MQLArticles\\Utils\\FA\\AutoDelete.mqh>
#include <TSN\\MQLArticles\\RM\\AccountStatus.mqh>
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CGlobalInit
{
private:
static bool init;
public:
//--- Incializacion global
CGlobalInit(void)
{
if(init)
return;
//---
CBasicEvents::Init();
//--- Seteasmos el bar manager
ICTGen_BarManagerSet(GetPointer(g_new_bar_manager)); // Le damos a la libreira ICT el manager
//---
#ifndef DEFGLOBAL_SIMPLE
CAutoCleaner::AddFunction(CAccountStatus_Deinit);
CAutoCleaner::AddFunction(CBasicEvents::Deinit);
CAutoCleaner::AddFunction(ICTGen_OnDeinitEvent);
#endif
//---
init = true;
}
//--- Deinicializacion global
~CGlobalInit(void) {}
};
//+------------------------------------------------------------------+
bool CGlobalInit::init = false;
//+------------------------------------------------------------------+
CGlobalInit g_global_instance;
//+------------------------------------------------------------------+
#endif // GLOBAL_MQH