#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
/+------------------------------------------------------------------+
//| Script program start function |
/+------------------------------------------------------------------+
void OnStart()
{
//--- 차트 ID
long chart_id=ChartID();
//--- 메인 창과 함께 하위 창의 개수를 가져옵니다.
long wnd=0;
ResetLastError();
if(!ChartGetInteger(chart_id, CHART_WINDOWS_TOTAL, 0, wnd))
{
Print("ChartGetInteger() failed. Error ", GetLastError());
return;
}
//--- 각 차트 하위 창의 그래픽 객체의 수를 가져와 저널에 표시합니다.
for(int i=0; i<(int)wnd; i++)
{
int objects=ObjectsTotal(chart_id, i);
string wnd_head=(i==0 ? "The main chart window" : StringFormat("The window with index %d of the chart", i));
PrintFormat("%s contains %d graphic objects", wnd_head, objects);
}
/*
두 개의 하위 창이 있는 메인 창에 대한 결과
메인 창에 거래 라벨이 포함되어 있는
그리고 두 개의 그래픽 객체가 있는 하위 창에
The main chart window contains 656 graphic objects
The window with index 1 of the chart contains 2 graphic objects
The window with index 2 of the chart contains 2 graphic objects
*/
}
|