#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link ""
#property version "1.00"
//+------------------------------------------------------------------+
//| スクリプトプログラム開始関数 |
//+------------------------------------------------------------------+
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);
}
/*
メインウィンドウに2つのサブウィンドウがあり、
メインウィンドウには取引ラベルがあり、
サブウィンドウには2つのグラフィックオブジェクトがある場合の結果
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
*/
}
|