2026-10-27 18:07:28 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| 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
|
| | | {
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
2026-10-28 16:35:48 -05:00 | | | //---
|
2026-10-27 18:07:28 -05:00 | | | #define RISK_MANAGEMENT_EVENT_ON_OPEN_POSITION (1)
|
| | | #define RISK_MANAGEMENT_EVENT_ON_CLOSE_POSITION (2)
|
2026-11-07 21:17:58 -05:00 | | | #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)
|
2026-10-27 18:07:28 -05:00 | | |
|
2026-10-28 16:35:48 -05:00 | | | //---
|
| | | struct ModifierOnOpenCloseStruct
|
| | | {
|
2026-11-07 21:17:58 -05:00 | | | // Solo incluye los profits
|
| | | // Si se desea posiciones etc consultarlo con account status
|
2026-10-28 16:35:48 -05:00 | | | 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)
|
| | | };
|
| | |
|
| | |
|
2026-10-27 18:07:28 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | class IRiskManagementHook : public CAllClassEventsBasic
|
| | | {
|
| | | public:
|
| | | const uint8_t m_events_flags;
|
| | | const string m_hook_name;
|
| | |
|
| | | public:
|
2026-11-07 21:17:58 -05:00 | | | IRiskManagementHook(const uint8_t f, const string& name) : m_events_flags(f), m_hook_name(name) {}
|
2026-10-27 18:07:28 -05:00 | | | ~IRiskManagementHook() {}
|
| | |
|
| | | //--- Virtual functions
|
| | | // Function that will be executed each time a position is closed
|
2026-11-07 21:17:58 -05:00 | | | virtual void OnClosePosition(const ModifierOnOpenCloseStruct &on_open_close_struct, const ROnClosePosition& pos) {}
|
2026-10-27 18:07:28 -05:00 | | |
|
| | | // Function that will be executed each time an operation is opened
|
2026-11-07 21:17:58 -05:00 | | | virtual void OnOpenPosition(const ROnOpenPosition &pos) {}
|
2026-10-27 18:07:28 -05:00 | | |
|
2026-11-07 21:17:58 -05:00 | | | // Props de risk management
|
| | | virtual void OnIBalance(const double b) {}
|
| | | virtual void OnMagic(const ulong m) {}
|
2026-10-27 18:07:28 -05:00 | | | };
|
| | |
|
| | |
|
| | | //---
|
| | | }
|
| | | #endif // MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_HOOKS_DEF_MQH
|
| | | //+------------------------------------------------------------------+
|