![ObjectName](https://celebpanda.com/wp/wp-content/uploads/2021/07/ObjectName.jpg)
オブジェクトリスト内のインデックスに対応するオブジェクト名を返します。
ObjectName
string ObjectName(
long chart_id, //チャートID
int object_index, //オブジェクト インデックス
int sub_window = -1,//サブウィンドウ
int object_type = -1//オブジェクトタイプ
);
string ObjectName(
int object_index // オブジェクトインデックス
);
- 引数
引数名 | 初期値 | I/O | 詳細 |
chart_id | - | IN | チャートID ChartID()で取得。0で現在のチャート。 |
object_index | - | IN | オブジェクトインデックス。 ObjectsTotal()で返される値未満、0以上の範囲でしていします。 |
sub_window | - | IN | サブウィンドウ。 |
object_type | - | IN | オブジェクトタイプ。 |
- 戻り値
オブジェクト名を返します。
エラーコードの確認はGetLastError()関数を使用します。
- その他
- サンプルソース
//トレンドラインのみ名前を出力する
int total = ObjectsTotal(0,0,OBJ_TREND);
for(int i = 0; i < total; i++)
{
string name = ObjectName(0,i,0,OBJ_TREND);
Print(name);
}
//すべてのオブジェクトの名前を出力する
int total = ObjectsTotal();
for(int i = 0; i < total; i++)
{
string name = ObjectName(i);
Print(name);
}