MQL4 Reference Object Functions ObjectSetString

MQL4 Help as One File:

ObjectSetString

The function sets the value of the corresponding object property. The object property must be of the string type. There are 2 variants of the function.

Setting property value, without modifier:

bool  ObjectSetString(
   long     chart_id,        // chart identifier
   string   object_name,     // object name
   int      prop_id,         // property
   string   prop_value       // value
   );

Setting a property value indicating the modifier:

bool  ObjectSetString(
   long     chart_id,        // chart identifier
   string   object_name,     // object name
   int      prop_id,         // property
   int      prop_modifier,   // modifier
   string   prop_value       // value
   );

Parameters

chart_id

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

object_name

[in]  Name of the object.

prop_id

[in]  ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_STRING enumeration.

prop_modifier

[in]  Modifier of the specified property.  It denotes the number of the level in Fibonacci tools and in the graphical object Andrew's pitchfork. The numeration of levels starts from zero.

prop_value

[in]  The value of the property.

Return Value

The function returns true only if the command to change properties of a graphical object has been sent to a chart successfully. Otherwise it returns false. To read more about the error call GetLastError().

Note

When this function is used on the current chart, this chart is accessed directly and the result is returned immediately. In order to set object properties on a different chart, an asynchronous call is used. The asynchronous call means that the function does not wait for the execution of the command that has been added to the queue of another chart. Instead, it immediately returns control.

To check the result of command execution on a chart other than the current one, you can use a function that checks the specified object property. However, you should keep in mind that such functions are added to the end of the queue of that chart and wait for the execution result, and can therefore be time consuming. This feature should be taken into account when working with a large number of objects on a chart.