Am I seeing this right?

 
//+------------------------------------------------------------------+
//| Getting lot size for open long position.                         |
//+------------------------------------------------------------------+
double CExpertMoney::CheckOpenLong(double price,double sl)
  {
   if(m_symbol==NULL)
      return(0.0);
//---
   double lot;
   if(price==0.0)
      lot=m_account.MaxLotCheck(m_symbol.Name(),ORDER_TYPE_BUY,m_symbol.Ask(),m_percent);
   else
      lot=m_account.MaxLotCheck(m_symbol.Name(),ORDER_TYPE_BUY,price,m_percent);
   if(lot<m_symbol.LotsMin())
      return(0.0);
//---
   return(m_symbol.LotsMin());
  }
This is a code extracted from ExpertMoney.mqh in the standard library. Why take the pain of calculating the 'lot' variable, if it's never returned? I keep fixing it, then an update just undoes it.
 
Nelson :
This is a code extracted from ExpertMoney.mqh in the standard library . Why take the pain of calculating the 'lot' variable, if it's never returned? I keep fixing it, then an update just undoes it.

Read the help: CExpertMoney

CExpertMoney

CExpertMoney is a base class for money and risk management algorithms.


It is necessary to use the heirs of the class. For example CMoneyFixedMargin:

//+------------------------------------------------------------------+
//| Getting lot size for open long position.                         |
//+------------------------------------------------------------------+
double CMoneyFixedMargin::CheckOpenLong(double price,double sl)
  {
   if(m_symbol==NULL)
      return(0.0);
//--- select lot size
   double lot;
   if(price==0.0)
      lot=m_account.MaxLotCheck(m_symbol.Name(),ORDER_TYPE_BUY,m_symbol.Ask(),m_percent);
   else
      lot=m_account.MaxLotCheck(m_symbol.Name(),ORDER_TYPE_BUY,price,m_percent);
//--- return trading volume
   return(lot);
  }
Documentation on MQL5: Standard Library / Strategy Modules / Base classes for Expert Advisors / CExpertMoney
Documentation on MQL5: Standard Library / Strategy Modules / Base classes for Expert Advisors / CExpertMoney
  • www.mql5.com
CExpertMoney - Base classes for Expert Advisors - Strategy Modules - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov:

Read the help: CExpertMoney


It is necessary to use the heirs of the class. For example CMoneyFixedMargin:

Thank you. I'm trying to understand the entire structure of the standard library.