//+------------------------------------------------------------------+ //| BprFvg.mq5 | //| Copyright 2025, Niquel Mendoza. | //| https://www.mql5.com/es/users/nique_372/news | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, Niquel Mendoza." #property link "https://www.mql5.com/es/users/nique_372/news" #property version "1.00" #property strict //--- Incluimos las carga global.. asu vez incluye a la libreria ICT #define DEFGLOBAL_SIMPLE #include "..\\..\\..\\DefGlobal.mqh" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int8_t idx_controler_d1 = INVALID_INDEX; int8_t idx_controler_curr = INVALID_INDEX; CFvgBar fvg; CBprFvg bpr; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Registramos timeframe D1 g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1); g_new_bar_manager.GetPosExecute(Period(), idx_controler_curr); //--- Creamos el atr const int atr_pos_hanlde = ICTAtr_Create(PERIOD_CURRENT, _Symbol, 14, true); TSN::CAtr* atr_ptr = ICTAtr_GetAtrPointer(atr_pos_hanlde); //--- Fvg fvg.Create(_Symbol, _Period); fvg.SetGrapich(clrGreen, clrRed, clrGreen, clrRed, STYLE_SOLID, true, 1, true, 10, 1, STYLE_DOT); //Configuramos los objetos graficos fvg.Set(500, defined_pattern, fvg_1_vela, TSN::CreateDiffptr(TSN::MODE_DIFF_BY_ATR, _Symbol, atr_ptr, 1, 0.00)); //Configuraciones generales //--- Bpr bpr.CreateByBlockBar(0, 0, true, fvg.Handle()); bpr.SetProperties(defined_pattern, TSN::CreateDiffptr(TSN::MODE_DIFF_BY_ATR, _Symbol, atr_ptr, 1, 0.00)); bpr.SetGrapich(clrBlue, C'0xFF,0x51,0x51', clrRed, clrBlue, STYLE_SOLID, true, 1, true, 20); bpr.MaxEsperaToSuperate(20); //20 velas de maxiam espera //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- ICTGen_OnDeinitEvent(reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- const datetime curr_time = TimeCurrent(); g_new_bar_manager.Execute(curr_time); //--- if(CNewBarManager_IsNewBarM1(g_new_bar_manager) && CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_curr)) { const bool new_day = CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_d1); ICTGen_FuncionOnBarM1(new_day, curr_time); fvg.OnNewBar(); //Ejecutamos OnNewBar bpr.OnNewBar(); //SIEMPRE DESPUES if(bpr.SizeAlcistasMitigados() > 0) { Print("Bloque alcista mitigado"); } else if(bpr.SizeBajistasMitigados() > 0) { Print("Bloque bajsita mitigado"); } } } //+------------------------------------------------------------------+ //2026.01.03 15:24:40.164 EURUSD,M5: 11701434 ticks, 595565 bars generated. Environment synchronized in 0:00:00.035. // Test passed in 0:00:24.457 (including ticks preprocessing 0:00:00.688).