MQL4 Reference Object Functions

Object Functions

This is the group of functions intended for working with graphic objects relating to any specified chart.

Function

Action

ObjectCreate

Creates an object of the specified type in a specified chart

ObjectName

Returns the name of an object by its index in the objects list

ObjectDelete

Removes the object having the specified name

ObjectsDeleteAll

Removes all objects of the specified type from the specified chart subwindow

ObjectFind

Searches for an object having the specified name

ObjectGetTimeByValue

Returns the time value for the specified object price value

ObjectGetValueByTime

Returns the price value of an object for the specified time

ObjectMove

Changes the coordinates of the specified object anchor point

ObjectsTotal

Returns the number of objects of the specified type

ObjectGetDouble

Returns the double value of the corresponding object property

ObjectGetInteger

Returns the integer value of the corresponding object property

ObjectGetString

Returns the string value of the corresponding object property

ObjectSetDouble

Sets the value of the corresponding object property

ObjectSetInteger

Sets the value of the corresponding object property

ObjectSetString

Sets the value of the corresponding object property

TextSetFont

Sets the font for displaying the text using drawing methods (Arial 20 used by default)

TextOut

Transfers the text to the custom array (buffer) designed for creation of a graphical resource

TextGetSize

Returns the string's width and height at the current font settings

ObjectDescription

Returns the object description

ObjectGet

Returns the value of the specified object property

ObjectGetFiboDescription

Returns the level description of a Fibonacci object

ObjectGetShiftByValue

Calculates and returns bar index for the given price

ObjectGetValueByShift

Calculates and returns the price value for the specified bar

ObjectSet

Changes the value of the specified object property

ObjectSetFiboDescription

Sets a new description to a level of a Fibonacci object

ObjectSetText

Changes the object description

ObjectType

Returns the object type

Every graphical object should have a name unique within one chart, including its subwindows. Changing of a name of a graphic object generates two events: event of deletion of an object with the old name, and event of creation of an object with a new name.

After an object is created or an object property is modified it is recommended to call the ChartRedraw() function, which commands the client terminal to forcibly draw a chart (and all visible objects in it).