//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 현재 차트 주기를 가져오고 얻은 값을 저널에 표시
ENUM_TIMEFRAMES period=ChartPeriod();
Print("Current chart period: ", EnumToString(period));
//--- 현재 차트 ID를 가져옵니다
long chart_id=ChartID();
period=ChartPeriod(chart_id);
PrintFormat("Chart period with ID %I64d: %s", chart_id, EnumToString(period));
//--- 랜덤 차트 ID를 설정
period=ChartPeriod(1234567890);
if(period==0)
Print("The chart with ID 1234567890 does not exist");
else
Print("Chart period with ID 1234567890: ", EnumToString(period));
/*
결과:
Current chart period: PERIOD_M15
Chart period with ID 133510090240498505: PERIOD_M15
The chart with ID 1234567890 does not exist
*/
}
|