CloseAll

전체 포지션 클로즈의 일부를 수행합니다.

virtual bool  CloseAll(
   double    lot    // lot
   )

Parameters

lot

[in] 포지션을 줄일 로트 수.

반환 값

거래 작업이 수행되었으면 true, 그게 아니면 false.

참고

"넷팅"모드에서는, CExpertTrade::Buy 또는 CExpertTrade::Sell 멧드를 사용하여 포지션을 클로즈합니다. "헤징" 모드에서는 CTrade::PositionClose 메서드가 사용되며, 이는 넷팅 모드를 사용하는 계정에서도 사용할 수 있습니다. DeleteOrders() 메서드는 주문 삭제에 사용됩니다.

Implementation

//+------------------------------------------------------------------+
//| 포지션 클로즈 및 주문 삭제                                 |
//| INPUT:  lot - 클로즈 볼륨.                                  |
//| OUTPUT: 거래 작업이 처리되면 true, 그렇지 않으면 false.      |
//| 비고: no.                                                      |
//+------------------------------------------------------------------+
bool CExpert::CloseAll(double lot)
  {
   bool result=false;
//--- 클로즈 작업을 확인합니다
   if(m_margin_mode==ACCOUNT_MARGIN_MODE_RETAIL_HEDGING)
      result=m_trade.PositionCloseByTicket(m_position.Identifier());
   else
     {
      if(m_position.PositionType()==POSITION_TYPE_BUY)
         result=m_trade.Sell(lot,0,0,0);
      else
         result=m_trade.Buy(lot,0,0,0);
     }
   result|=DeleteOrders();
//---
   return(result);
  }