forked from nique_372/MQLArticles
//+------------------------------------------------------------------+
| |
//| 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:
| |
// NOTA: solo para buen uso, si lo usas mal puede fallar..
| |
CLossProfit* m_modifier;
| |
| |
public:
| |
const int m_property_to_modify; // LP a modificar (Type)
| |
| |
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) {}
| |
| |
//---
| |
// 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.
| |
bool SetPointer(CLossProfit* _modifier);
| |
};
| |
| |
//+------------------------------------------------------------------+
| |
//| Set pointer |
| |
//+------------------------------------------------------------------+
| |
// asume modifer valido (ojo)
| |
bool CExtraModifications::SetPointer(CLossProfit* _modifier)
| |
{
| |
//---
| |
if(_modifier.m_type != m_property_to_modify)
| |
return false;
| |
| |
//---
| |
m_modifier = _modifier;
| |
return true;
| |
}
| |
| |
//---
| |
}
| |
//+------------------------------------------------------------------+
| |
#endif // MQLARTICLES_ACCOUNT_RM_RISKMANAGEMENT_LPMODS_DEF_MQH
| |
//+------------------------------------------------------------------+
|