ChartClose

지정된 차트를 닫기.

bool  ChartClose(
   long  chart_id=0      // 차트 ID
   );

매개변수

chart_id=0

[in]  차트 ID. 0은 현재 차트를 의미합니다.

값 반환

성공하면 true를 반환하고 그렇지 않으면 false를 반환합니다.

예:

//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수                                         |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 현재 차트와 동일한 심볼 및 기간을 사용하여 새 차트를 엽니다.one
   long chart_id=ChartOpen(_Symbol_Period);
   if(chart_id==0)
     {
      Print("ChartOpen() failed. Error "GetLastError());
      return;
     }
 
//--- 저널에서 오픈 차트 매개변수를 인쇄합니다.
   PrintFormat("A new chart of the %s symbol has been opened with a period of %s and ChartID %I64u",
               _SymbolStringSubstr(EnumToString(_Period), 7), chart_id);
 
//--- 2초를 기다리고 이후 새로 열린 차트를 닫습니다
   PrintFormat("Waiting 3 seconds before closing a newly opened chart with ID %I64d ..."chart_id);
   Sleep(3000);
   ResetLastError();
   if(!ChartClose(chart_id))
     {
      Print("ChartClose() failed. Error "GetLastError());
      return;
     }
 
//--- 저널에 성공적인 차트 종료 메시지를 인쇄합니다.
   PrintFormat("The chart with ID %I64d was successfully closed"chart_id);
   /*
   결과:
   A new chart of the GBPUSD symbol has been opened with a period of M1 and ChartID 133346697706632016
   Waiting 3 seconds before closing a newly opened chart with ID 133346697706632016 ...
   The chart with ID 133346697706632016 was successfully closed
   */
  }