//+------------------------------------------------------------------+ //| MoneyFixedLot.mqh | //| Copyright 2023 - Dev.Solve LTDA | //+------------------------------------------------------------------+ #include "../ExpertMoney.mqh" //+------------------------------------------------------------------+ //| Class CMoneyFixedLot. | //| Purpose: Class of money management with fixed lot. | //| Derives from class CExpertMoney. | //+------------------------------------------------------------------+ class CMoneyFixedLot : public CExpertMoney { protected: //--- input parameters double m_lots; public: CMoneyFixedLot(void); ~CMoneyFixedLot(void); //--- void Lots(double lots) { m_lots=lots; } virtual bool ValidationSettings(void); //--- virtual double Lot(double price,double sl); }; //+------------------------------------------------------------------+ //| Constructor | //+------------------------------------------------------------------+ void CMoneyFixedLot::CMoneyFixedLot(void) : m_lots(0.1) { } //+------------------------------------------------------------------+ //| Destructor | //+------------------------------------------------------------------+ void CMoneyFixedLot::~CMoneyFixedLot(void) { } //+------------------------------------------------------------------+ //| Validation settings protected data. | //+------------------------------------------------------------------+ bool CMoneyFixedLot::ValidationSettings(void) { //--- initial data checks if(m_lots>m_lots_max) { printf(ERROR_SUFFIX+"error, lots amount must be in the range from %f to %f",m_lots_min,m_lots_max); return(false); } //--- ok return(true); } //+------------------------------------------------------------------+ //| Get lots for the open position. | //+------------------------------------------------------------------+ double CMoneyFixedLot::Lot(double price,double sl) { //--- if(m_lots==0.0) return(m_lots_min); //--- return(m_lots); }