ICTLibraryExamples/Sensei/Est2023/Confirmacion.mqh
Nique_372 Nique_372 3fd17f5686
2026-11-06 15:35:47 -05:00
109 라인
4.1 KiB
MQL5
//+------------------------------------------------------------------+
//| Confirmacion.mqh |
//| 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 strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Defines.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
interface IConfirmacion
{
bool ConfirmacionCompra();
bool ConfirmacionVenta();
void OnNewBarM1();
void Execute();
};
//+------------------------------------------------------------------+
//| Condicion para fvg |
//+------------------------------------------------------------------+
class CConfirmationFvg : public IConfirmacion
{
public:
bool ConfirmacionCompra() override { return g_fvg.SizeAlcistasMitigados() > 0; }
bool ConfirmacionVenta() override { return g_fvg.SizeBajistasMitigados() > 0; }
void OnNewBarM1() override {}
void Execute() override { }
};
//+------------------------------------------------------------------+
//| Condicion para ob |
//+------------------------------------------------------------------+
class CConfirmationOb : public IConfirmacion
{
public:
bool ConfirmacionCompra() override { return g_ob.SizeAlcistasMitigados() > 0; }
bool ConfirmacionVenta() override { return g_ob.SizeBajistasMitigados() > 0; }
void OnNewBarM1() override {}
void Execute() override { }
};
//+------------------------------------------------------------------+
//| Confirmacion para high-low |
//+------------------------------------------------------------------+
class CConfimationSessionMan : public IConfirmacion
{
public:
bool ConfirmacionCompra() override { return g_sessiones.MinSessionIsMitigated(); }
bool ConfirmacionVenta() override { return g_sessiones.MaxSessionIsMitigated(); }
void OnNewBarM1() override { g_sessiones.OnNewBarM1(); }
void Execute() override;
};
//+------------------------------------------------------------------+
void CConfimationSessionMan::Execute(void)
{
g_sessiones.OnNewBar();
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace ConfirmationFactory
{
IConfirmacion* GetConfirmationParaEntrada(ENUM_ESTRATEGIA_SENSEI_ENTRADA_TYPE type)
{
switch(type)
{
case SENSEI_EST_ENTRADA_OB:
return new CConfirmationOb();
case SENSEI_EST_ENTRADA_FVG:
return new CConfirmationFvg();
default:
FastLog(FUNCION_ACTUAL, ERROR_TEXT, StringFormat("Tipo invalido = %s", EnumToString(type)));
Remover();
break;
}
return NULL;
}
IConfirmacion* GetConfirmationParaDireccion(ENUM_ESTRATEGIA_SENSEI_DIRECCION_IND type)
{
switch(type)
{
case SENSEI_DIR_MANIPULACION_SESIONES:
return new CConfimationSessionMan();
case SENSEI_DIR_MANIPULACION_OB:
return new CConfirmationOb();
case SENSEI_DIR_MANIPULACION_FVG:
return new CConfirmationFvg();
default:
FastLog(FUNCION_ACTUAL, ERROR_TEXT, StringFormat("Tipo invalido = %s", EnumToString(type)));
Remover();
break;
}
return NULL;
}
}
//+------------------------------------------------------------------+