ICTLibraryExamples/Base/Bloques/CustomBlock/Ea.mq5
Nique_372 Nique_372 dc4dbf8a3f
2026-02-01 13:11:51 -05:00
68 lines
2.7 KiB
MQL5
//+------------------------------------------------------------------+
//| Fvg.mq5 |
//| Copyright 2025, Leo. |
//| https://www.mql5.com/es/users/nique_372/news |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Leo."
#property link "https://www.mql5.com/es/users/nique_372/news"
#property version "1.00"
#property strict
#define DEFGLOBAL_SIMPLE
#include "Main.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int8_t idx_controler_d1 = INVALID_INDEX;
int8_t idx_controler_curr = INVALID_INDEX;
CCustomBlockBar fvg;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1);
g_new_bar_manager.GetPosExecute(_Period, idx_controler_curr);
//---
CCustomFvg* interprete = new CCustomFvg();
fvg.Create(_Symbol, _Period, 0, 0, true, interprete, true);
fvg.SetGrapich(clrGreen, clrRed, clrGreen, clrRed, STYLE_SOLID, true, 1, true, 10, 1, STYLE_DOT); //Configuramos los objetos graficos
fvg.SetAlertas(true, "Alerts|Print");
fvg.Summary();
//---
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
// PrintFormat("El fvg alcista mas cercano es = %s", fvg.GetMasCercanoAlcista().name);
//PrintFormat("El fvg bajista mas cercano es = %s", fvg.GetMasCercanoBajista().name);
}
}
//+------------------------------------------------------------------+