MQLArticles/Account/RM/RiskManagement/LPMods/Def.mqh
66 行
2.7 KiB
MQL5
Nique_372
2026-10-27 18:07:28 -05:00
//+------------------------------------------------------------------+
//| Modificators.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
#ifndef MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_LPMODS_DEF_MQH
#define MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_LPMODS_DEF_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\..\\LossProfit\\Manager.mqh"
#include "..\\Hooks\\Def.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace TSN
{
//+--------------------------------------------------------------------+
//| Class to integrate external modifications to risk management |
//+--------------------------------------------------------------------+
class CExtraModifications : public IRiskManagementHook
{
protected:
Nique_372
2026-10-28 13:32:56 -05:00
// NOTA: solo para buen uso, si lo usas mal puede fallar..
Nique_372
2026-10-27 19:06:42 -05:00
CLossProfit* m_modifier;
Nique_372
2026-10-28 13:32:56 -05:00
public:
const int m_property_to_modify; // LP a modificar (Type)
Nique_372
2026-10-27 18:07:28 -05:00
public:
// WRONG_VALUE si no se busca modificar nada,
CExtraModifications(int _property_to_modify, uint8_t flags_events, const string& name)
: IRiskManagementHook(flags_events, name), m_property_to_modify(_property_to_modify) {}
Nique_372
2026-10-28 13:32:56 -05:00
//---
Nique_372
2026-10-27 18:07:28 -05:00
// Function that will be used in CRiskManagement to assign the "maximum loss or profit" based on the type of "maximum loss or profit" chosen
// in the constructor.
Nique_372
2026-10-27 19:06:42 -05:00
bool SetPointer(CLossProfit* _modifier);
Nique_372
2026-10-27 18:07:28 -05:00
};
//+------------------------------------------------------------------+
//| Set pointer |
//+------------------------------------------------------------------+
Nique_372
2026-10-28 13:32:56 -05:00
// asume modifer valido (ojo)
Nique_372
2026-10-27 19:06:42 -05:00
bool CExtraModifications::SetPointer(CLossProfit* _modifier)
Nique_372
2026-10-27 18:07:28 -05:00
{
//---
if(_modifier.m_type != m_property_to_modify)
return false;
//---
m_modifier = _modifier;
return true;
}
//---
}
//+------------------------------------------------------------------+
#endif // MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_LPMODS_DEF_MQH
//+------------------------------------------------------------------+