| //+------------------------------------------------------------------+
|
| //| 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
|
| // SIEMPRE SE DEBERA DE INCLUIR ESTO ANTES DE INSTANCIAR O EJECUTAR CUALUIQER CONCEPTO ICT
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| #include <TSN\\MQLArticles\\Utils\\TFManager.mqh>
|
|
|
| //---
|
| TSN::CNewBarManager g_new_bar_manager;
|
|
|
| //---
|
| #define TSN_ICTLIBRARY_INSTANCE_BAR_MANAGER g_new_bar_manager
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| // El objetto del manager se intancia primero antes de incluir ICTLibrary
|
| // La libreria requiere saber... cual es el manager que usara..
|
| // Incluimos los componentes de la lib que usaremos
|
| #include <TSN\\ICTLibrary\\ICTConcepts.mqh>
|
| #include <TSN\\ICTLibrary\\Liquidity.mqh>
|
| #include <TSN\\ICTLibrary\\Pda.mqh>
|
|
|
| //--- Incluiremos las librerias de eventos principales
|
| #include <TSN\\Std\\Memory.mqh>
|
| #include <TSN\\MQLArticles\\RM\\AccountStatus.mqh>
|
| #include <TSN\\Std\\Basics\\Try.mqh>
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| class CGlobalInit
|
| {
|
| private:
|
| static bool init;
|
|
|
| public:
|
| //--- Incializacion global
|
| CGlobalInit(void)
|
| {
|
| if(init)
|
| return;
|
|
|
| //--- Llamamos una unica vez a la funcion de incilzaicion
|
| ICTGen_Init(THE_BOT_PLACE_USER_ID);
|
| CBasicEvents::Init();
|
|
|
| //--- Seteasmos el bar manager
|
| ICTGen_BarManagerSet(&g_new_bar_manager); // Le damos a la libreira ICT el manager
|
|
|
| //--- Solo añadimos en CASO de que DEFGLOBAL_SIMPLE NO ESTE DEFINIDIO
|
| // Util para los ejemplos BASE.. en los cuales no hace falta usar CAutoCleaner debido a la simplicidad
|
| #ifndef DEFGLOBAL_SIMPLE
|
| CAutoCleaner::AddFunction(TSN::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
|