MQL4参考 物件函数
|
Object FunctionsThis is the group of functions intended for working with graphic objects relating to any specified chart. When working with objects on the current chart, a direct access is used, i.e. the existence of the specified object is pre-checked during the function call, and the error code is immediately returned in case of failure. When a function is used for the objects of a chart other than the current one, an asynchronous function call is used, during which no pre-checks are performed and the function is added to the queue of that chart as is. Functions that set the properties of graphical objects, as well as the ObjectCreate() and ObjectMove() operations are actually used for sending commands to a chart. If these functions are executed successfully, the command is added to the queue of chart events. Visual changes in the properties of graphical objects are implemented upon handling of chart events from the queue. That is why you should do not expect an immediate visual update of graphical objects after calling these functions. Generally, graphical objects on a chart are updated automatically by the terminal based on update events, such as a new quote arrival, chart window resizing, etc. Use the ChartRedraw() command to force the update of graphical objects.
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).
What's new in MQL5MQL5 features more graphical objects, and the most unusual of them is OBJ_CHART(Chart) C you are able to insert such objects as symbol charts. If you complement OBJ_CHART with indicators and control panels handling custom events, a usual chart turns into a convenient analysis tool with the ability to quickly change symbols and timeframes in a single mouse click. The properties of objects for managing program objects have been significantly expanded. Now you are able to set colors, move an object to the back or front, set the priority for intercepting keyboard and mouse events on a chart, as well as select an object or hide it from the list of visible ones. All this allows you to develop a graphical user interface of any complexity.
|