Download MetaTrader 5

ObjectName

The function returns the name of the corresponding object in the specified chart, in the specified subwindow, of the specified type.

string  ObjectName(
   long  chart_id,           // chart identifier
   int   pos,                // number in the list of objects
   int   sub_window=-1,      // window index
   int   type=-1             // object type
   );

Parameters

chart_id

[in]  Chart identifier. 0 means the current chart.

pos

[in]  Ordinal number of the object according to the specified filter by the number and type of the subwindow.

sub_window=-1

[in]  Number of the chart subwindow. 0 means the main chart window, -1 means all the subwindows of the chart, including the main window.

type=-1

[in]  Type of the object. The value can be one of the values of the ENUM_OBJECT enumeration. -1 means all types.

Return Value

Name of the object is returned in case of success.

Note

When an object is renamed, two events are formed simultaneously. These events can be handled in an Expert Advisor or indicator by the OnChartEvent() function:

  • an event of deletion of an object with the old name;
  • an event of creation of an object with a new name.

Updated: 2015.12.03