Download MetaTrader 5

ExpertMoney.mqh

To add comments, please log in or register
Having troubles understanding the code? Articles can help you!
och
485
och 2011.02.24 11:27 

Hi All,

 I tried to understand ExpertMoney.mqh. Is there someone who can explain this part of that class?

Even if we are using a derivated class and if we are surcharging CheckopenLong and checkOpenClose, according to me the end of thoses functions should be :

....  

if(lot<m_symbol.LotsMin()) return(m_symbol.LotMin());

   if(lot>m_symbol.LotsMax()) return(m_symbol.LotMax());    

//---

   return(lot);

  

 ----------- extract from standard library

//+------------------------------------------------------------------+

//| Getting lot size for open long position.                         |

//| INPUT:  no.                                                      |

//| OUTPUT: lot-if successful, 0.0 otherwise.                        |

//| REMARK: no.                                                      |

//+------------------------------------------------------------------+

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());

  } 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
hornsALERT
62
hornsALERT 2011.03.01 06:45  
You are right. It should be
if(lot<m_symbol.LotsMin()) return(0.0);


To add comments, please log in or register