|
Object Properties
Graphical objects can have various properties depending on the object type. Values of object properties are set up and received by corresponding functions for working with graphical objects.
All objects used in technical analysis are bound to the time and price coordinates: trendline, channels, Fibonacci tools, etc. But there is a number of auxiliary objects intended to improve the user interface that are bound to the always visible part of a chart (main chart windows or indicator subwindows):
Object |
ID |
X/Y |
Width/Height |
Date/Price |
|||
---|---|---|---|---|---|---|---|
Text |
— |
— |
Yes |
— |
Yes |
Yes |
|
Label |
Yes |
Yes (read only) |
— |
Yes |
Yes |
Yes |
|
Button |
Yes |
Yes |
— |
Yes |
— |
— |
|
Bitmap |
— |
Yes (read only) |
Yes |
— |
Yes |
— |
|
Bitmap Label |
Yes |
Yes (read only) |
— |
Yes |
Yes |
— |
|
Edit |
Yes |
Yes |
— |
Yes |
— |
— |
|
Rectangle Label |
Yes |
Yes |
— |
Yes |
— |
— |
The following designations are used in the table:
The functions defining the properties of graphical objects, as well as ObjectCreate() and ObjectMove() operations for creating and moving objects along the chart are actually used for sending commands to the chart. If these functions are executed successfully, the command is included in the common queue of the chart events. Visual changes in the properties of graphical objects are implemented when handling the queue of the chart events.
Thus, do not expect an immediate visual update of graphical objects after calling these functions. Generally, the graphical objects on the chart are updated automatically by the terminal following the change events - a new quote arrival, resizing the chart window, etc. Use ChartRedraw() function to forcefully update the graphical objects.
For functions ObjectSetInteger() and ObjectGetInteger()
Identifier |
Description |
Property Type |
---|---|---|
OBJPROP_COLOR |
Color |
color |
OBJPROP_STYLE |
Style |
|
OBJPROP_WIDTH |
Line thickness |
int |
OBJPROP_BACK |
Object in the background |
bool |
OBJPROP_ZORDER |
Priority of a graphical object for receiving events of clicking on a chart (CHARTEVENT_CLICK). The default zero value is set when creating an object; the priority can be increased if necessary. When objects are placed one atop another, only one of them with the highest priority will receive the CHARTEVENT_CLICK event. |
long |
OBJPROP_FILL |
Fill an object with color (for OBJ_RECTANGLE, OBJ_TRIANGLE, OBJ_ELLIPSE, OBJ_CHANNEL, OBJ_STDDEVCHANNEL, OBJ_REGRESSION) |
bool |
OBJPROP_HIDDEN |
Prohibit showing of the name of a graphical object in the list of objects from the terminal menu "Charts" - "Objects" - "List of objects". The true value allows to hide an object from the list. By default, true is set to the objects that display calendar events, trading history and to the objects created from MQL5 programs. To see such graphical objects and access their properties, click on the "All" button in the "List of objects" window. |
bool |
OBJPROP_SELECTED |
Object is selected |
bool |
OBJPROP_READONLY |
Ability to edit text in the Edit object |
bool |
OBJPROP_TYPE |
Object type |
ENUM_OBJECT r/o |
OBJPROP_TIME |
Time coordinate |
datetime modifier=number of anchor point |
OBJPROP_SELECTABLE |
Object availability |
bool |
OBJPROP_CREATETIME |
Time of object creation |
datetime r/o |
OBJPROP_LEVELS |
Number of levels |
int |
OBJPROP_LEVELCOLOR |
Color of the line-level |
color modifier=level number |
OBJPROP_LEVELSTYLE |
Style of the line-level |
ENUM_LINE_STYLE modifier=level number |
OBJPROP_LEVELWIDTH |
Thickness of the line-level |
int modifier=level number |
OBJPROP_ALIGN |
Horizontal text alignment in the "Edit" object (OBJ_EDIT) |
|
OBJPROP_FONTSIZE |
Font size |
int |
OBJPROP_RAY_LEFT |
Ray goes to the left |
bool |
OBJPROP_RAY_RIGHT |
Ray goes to the right |
bool |
OBJPROP_RAY |
A vertical line goes through all the windows of a chart |
bool |
OBJPROP_ELLIPSE |
Showing the full ellipse of the Fibonacci Arc object (OBJ_FIBOARC) |
bool |
OBJPROP_ARROWCODE |
Arrow code for the Arrow object |
uchar |
OBJPROP_TIMEFRAMES |
Visibility of an object at timeframes |
set of flags flags |
OBJPROP_ANCHOR |
Location of the anchor point of a graphical object |
ENUM_ARROW_ANCHOR (for OBJ_ARROW), ENUM_ANCHOR_POINT (for OBJ_LABEL, OBJ_BITMAP_LABEL and OBJ_TEXT) |
OBJPROP_XDISTANCE |
The distance in pixels along the X axis from the binding corner (see note) |
int |
OBJPROP_YDISTANCE |
The distance in pixels along the Y axis from the binding corner (see note) |
int |
OBJPROP_DIRECTION |
Trend of the Gann object |
|
OBJPROP_DEGREE |
Level of the Elliott Wave Marking |
|
OBJPROP_DRAWLINES |
Displaying lines for marking the Elliott Wave |
bool |
OBJPROP_STATE |
Button state (pressed / depressed) |
bool |
OBJPROP_CHART_ID |
ID of the "Chart" object (OBJ_CHART). It allows working with the properties of this object like with a normal chart using the functions described in Chart Operations, but there some exceptions. |
long r/o |
OBJPROP_XSIZE |
The object's width along the X axis in pixels. Specified for OBJ_LABEL (read only), OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects. |
int |
OBJPROP_YSIZE |
The object's height along the Y axis in pixels. Specified for OBJ_LABEL (read only), OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects. |
int |
OBJPROP_XOFFSET |
The X coordinate of the upper left corner of the rectangular visible area in the graphical objects "Bitmap Label" and "Bitmap" (OBJ_BITMAP_LABEL and OBJ_BITMAP). The value is set in pixels relative to the upper left corner of the original image. |
int |
OBJPROP_YOFFSET |
The Y coordinate of the upper left corner of the rectangular visible area in the graphical objects "Bitmap Label" and "Bitmap" (OBJ_BITMAP_LABEL and OBJ_BITMAP). The value is set in pixels relative to the upper left corner of the original image. |
int |
OBJPROP_PERIOD |
Timeframe for the Chart object |
|
OBJPROP_DATE_SCALE |
Displaying the time scale for the Chart object |
bool |
OBJPROP_PRICE_SCALE |
Displaying the price scale for the Chart object |
bool |
OBJPROP_CHART_SCALE |
The scale for the Chart object |
int value in the range 0–5 |
OBJPROP_BGCOLOR |
The background color for OBJ_EDIT, OBJ_BUTTON, OBJ_RECTANGLE_LABEL |
color |
OBJPROP_CORNER |
The corner of the chart to link a graphical object |
|
OBJPROP_BORDER_TYPE |
Border type for the "Rectangle label" object |
|
OBJPROP_BORDER_COLOR |
Border color for the OBJ_EDIT and OBJ_BUTTON objects |
color |
When using chart operations for the "Chart" object (OBJ_CHART), the following limitations are imposed:
You can set a special mode of image display for OBJ_BITMAP_LABEL and OBJ_BITMAP objects. In this mode, only part of an original image (at which a rectangular visible area is applied) is displayed, while the rest of the image becomes invisible. The size of this area should be set using the properties OBJPROP_XSIZE and OBJPROP_YSIZE. The visible area can be "moved" only within the original image using the properties OBJPROP_XOFFSET and OBJPROP_YOFFSET.
For the fixed-sized objects: OBJ_BUTTON, OBJ_RECTANGLE_LABEL, OBJ_EDIT and OBJ_CHART, properties OBJPROP_XDISTANCE and OBJPROP_YDISTANCE set the position of the top left point of the object relative to the chart corner (OBJPROP_CORNER), from which the X and Y coordinates will be counted in pixels.
For functions ObjectSetDouble() and ObjectGetDouble()
Identifier |
Description |
Property Type |
---|---|---|
OBJPROP_PRICE |
Price coordinate |
double modifier=number of anchor point |
OBJPROP_LEVELVALUE |
Level value |
double modifier=level number |
OBJPROP_SCALE |
Scale (properties of Gann objects and Fibonacci Arcs) |
double |
OBJPROP_ANGLE |
Angle. For the objects with no angle specified, created from a program, the value is equal to EMPTY_VALUE |
double |
OBJPROP_DEVIATION |
Deviation for the Standard Deviation Channel |
double |
For functions ObjectSetString() and ObjectGetString()
Identifier |
Description |
Property Type |
---|---|---|
OBJPROP_NAME |
Object name |
string |
OBJPROP_TEXT |
Description of the object (the text contained in the object) |
string |
OBJPROP_TOOLTIP |
The text of a tooltip. If the property is not set, then the tooltip generated automatically by the terminal is shown. A tooltip can be disabled by setting the "\n" (line feed) value to it |
string |
OBJPROP_LEVELTEXT |
Level description |
string modifier=level number |
OBJPROP_FONT |
Font |
string |
OBJPROP_BMPFILE |
The name of BMP-file for Bitmap Label. See also Resources |
string modifier: 0-state ON, 1-state OFF |
OBJPROP_SYMBOL |
Symbol for the Chart object |
string |
For the OBJ_RECTANGLE_LABEL object ("Rectangle label") one of the three design modes can be set, to which the following values of ENUM_BORDER_TYPE correspond.
Identifier |
Description |
---|---|
BORDER_FLAT |
Flat form |
BORDER_RAISED |
Prominent form |
BORDER_SUNKEN |
Concave form |
For the OBJ_EDIT object ("Edit") and for the ChartScreenShot() function, you can specify the horizontal alignment type using the values of the ENUM_ALIGN_MODE enumeration.
Identifier |
Description |
---|---|
ALIGN_LEFT |
Left alignment |
ALIGN_CENTER |
Centered (only for the Edit object) |
ALIGN_RIGHT |
Right alignment |
Example:
#define UP "\x0431"
|