SymbolExist

지정된 이름의 심볼이 있는지 확인.

bool  SymbolExist(
   const string  name,    // 심볼 이름
   bool&   is_custom      // 사용자 지정 심볼 속성
   );

매개변수

이름

[in]  심볼 이름.

is_custom

[out]  성공적으로 실행될 때 설정된 사용자 지정 심볼 속성. true일 경우, 탐지된 심볼은 사용자 지정 심볼입니다.

값 반환

false일 경우, 표준 및 사용자 지정심볼 중에서 찾을 수 없습니다.

예:

#define SYMBOL_NAME "GBPUSDn"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 사용자 정의 심볼 플래그를 선언하고 SYMBOL_NAME에 지정된 이름을 가진 심볼이 있는지 확인합니다.
   bool custom = false;
   bool result = SymbolExist(SYMBOL_NAMEcustom);
   
//--- 디폴트로 '심볼를 찾을 수 없음' 메시지 텍스트 선언
   string text = StringFormat("The symbol '%s' was not found among either the standard or custom symbols."SYMBOL_NAME);
   
//--- 심볼이 발견되면 심볼이 발견된 목록에 따라 메시지 텍스트를 생성합니다.
   if(result)
     {
      //--- 만약 이것이 스탠다드 심볼이라면
      if(!custom)
         text = StringFormat("The '%s' symbol is available on the server."SYMBOL_NAME);
      //--- 만약 이것이 별도로 만든 심볼이라면
      else
         text = StringFormat("The symbol '%s' was found in the list of custom symbols."SYMBOL_NAME);
     }
     
//--- 확인 결과와 관련한 메시지를 저널로 보냅니다.
   Print(text);
   /*
   result for standard 'GBPUSD' symbol:
   The 'GBPUSDsymbol is available on the server.
   
   result for custom 'GBPUSDx' symbol:
   The symbol 'GBPUSDxwas found in the list of custom symbols.
   
   result for missing 'GBPUSDn' symbol:
   The symbol 'GBPUSDnwas not found among either the standard or custom symbols.
   */
  }

추가 참조

SymbolsTotal, SymbolSelect, Custom symbols