본문 바로가기
트레이딩/메타트레이더 코딩

MQL5. PositionGetSymbol

by 리치굿맨 2019. 4. 19.

PositionGetSymbol 

Returns the symbol corresponding to the open position and automatically selects the position for further working with it using functions PositionGetDouble, PositionGetInteger, PositionGetString.

string PositionGetSymbol(
int index // Number in the list of positions
);

Parameters

index

[in] Number of the position in the list of open positions.

Return Value

Value of the string type. If the position was not found, an empty string will be returned. To get an error code, call the GetLastError() function.

 

코드예 1.

- EA 가 배치되는 챠트의 symbol 의 전체 포지션 수량 구하는 함수.

int GetNumPosition(string symbol)
{
   int count_position_symbol; 
   for(int idx = 0; idx < PositionsTotal(); idx++)
   {
      if(symbol == PositionGetSymbol(idx)) count_position_symbol++; 
   }
   
   return count_position_symbol; 
}

 

 

 

 

 

 

 

상세

https://www.mql5.com/en/docs/trading/positiongetsymbol

 

Documentation on MQL5: Trade Functions / PositionGetSymbol

 

www.mql5.com

 

 

 


첫등록 : 2019년 4월 19일

최종수정 : 

 

본 글 단축주소 : https://igotit.tistory.com/2121

 


 

댓글0


.    
현물 |선물 인버스 |선물 USDT     현물 | 선물 USDT |봇제작툴/카피트레이딩     현물 |선물 인버스 |선물 USDT     .