Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/3541-standardlibrary-expertclasses-expertbaseclasses-cexpert-cexpertcheckreverse.md
T
2026-06-23 21:47:51 +08:00

1.5 KiB

CheckReverse

Checks necessity and conditions to reverse an open position.

virtual bool  CheckReverse()

Return Value

true - a trade operation has been executed, otherwise - false.

Note

It checks the necessity to reverse long (CheckReverseLong()) and short (CheckReverseShort()) positions.

Implementation

//+------------------------------------------------------------------+
//| Check for position reverse                                       |
//| INPUT:  no.                                                      |
//| OUTPUT: true-if trade operation processed, false otherwise.      |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
bool CExpert::CheckReverse()
  {
   if(m_position.PositionType()==POSITION_TYPE_BUY)
     {
      //--- check the possibility of reverse the long position
      if(CheckReverseLong())  return(true);
     }
   else
      //--- check the possibility of reverse the short position
      if(CheckReverseShort()) return(true);
//--- return without operations
   return(false);
  }