ObjectCreate
The function creates an object with the specified name, type, and the initial coordinates in the specified chart subwindow. During creation up to 30 coordinates can be specified.
bool ObjectCreate( |
Parameters
chart_id
[in] Chart identifier. 0 means the current chart.
name
[in] Name of the object. The name must be unique within a chart, including its subwindows.
type
[in] Object type. The value can be one of the values of the ENUM_OBJECT enumeration.
nwin
[in] Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist, otherwise the function returns false.
time1
[in] The time coordinate of the first anchor.
price1
[in] The price coordinate of the first anchor point.
timeN=0
[in] The time coordinate of the N-th anchor point.
priceN=0
[in] The price coordinate of the N-th anchor point.
time30=0
[in] The time coordinate of the thirtieth anchor point.
price30=0
[in] The price coordinate of the thirtieth anchor point.
Return Value
Returns true or false depending on whether the object is created or not. To read more about the error call GetLastError(). If the object has been created already, the function tries to change its coordinates.
Note
The numbering of the chart subwindows (if there are subwindows with indicators in the chart) starts with 1. The main chart window of the chart is and always has index 0.
A large number of anchor points (to 30) provides for future use.At the same time limit only 30 possible anchor points for the graphics due to the fact that when you call the number of parameters must not exceed 64.
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:
© 2000-2010, MetaQuotes Software Corp.