//+------------------------------------------------------------------+ //| Def.mqh | //| Copyright 2026, Niquel Mendoza. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Niquel Mendoza." #property link "https://www.mql5.com" #property strict #ifndef MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_HOOKS_DEF_MQH #define MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_HOOKS_DEF_MQH //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #include "..\\Def.mqh" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ namespace TSN { //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //--- #define RISK_MANAGEMENT_EVENT_ON_OPEN_POSITION (1) #define RISK_MANAGEMENT_EVENT_ON_CLOSE_POSITION (2) #define RISK_MANAGEMENT_EVENT_ON_INFO (4) //--- #define RISK_MANAGEMENT_HOOKINFO_F_IBALANCE (1) #define RISK_MANAGEMENT_HOOKINFO_F_MAGIC (2) //--- #define RISK_MANAGEMENT_HOOK_ALL_F (RISK_MANAGEMENT_HOOKINFO_F_IBALANCE|RISK_MANAGEMENT_HOOKINFO_F_MAGIC) //--- struct ModifierOnOpenCloseStruct { // Solo incluye los profits // Si se desea posiciones etc consultarlo con account status double profit_diario; // Daily profit regarding the magic number of (RiskManagement) double profit_semanal; // Weekly profit regarding the magic number of (RiskManagement) double profit_total; // Total profit regarding the magic number of (RiskManagement) double profit_mensual; // Monthly profit regarding the magic number of (RiskManagement) }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class IRiskManagementHook : public CAllClassEventsBasic { public: const uint8_t m_events_flags; const string m_hook_name; public: IRiskManagementHook(const uint8_t f, const string& name) : m_events_flags(f), m_hook_name(name) {} ~IRiskManagementHook() {} //--- Virtual functions // Function that will be executed each time a position is closed virtual void OnClosePosition(const ModifierOnOpenCloseStruct &on_open_close_struct, const ROnClosePosition& pos) {} // Function that will be executed each time an operation is opened virtual void OnOpenPosition(const ROnOpenPosition &pos) {} // Props de risk management virtual void OnIBalance(const double b) {} virtual void OnMagic(const ulong m) {} }; //--- } #endif // MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_HOOKS_DEF_MQH //+------------------------------------------------------------------+