欢迎光临散文网 会员登陆 & 注册

期货量化软件:图形对象集合 - 在所有打开的图表上管理对象属性修改

2023-10-08 10:22 作者:大牛啊呢  | 我要投稿

我们已经能够控制在图表窗口中构建的、基于函数库程序操作的标准图形对象属性的更改。 为了跟踪一些事件,我决定采用上一篇文章中的事件模型。 图形对象事件将在 OnChartEvent() 响应程序中处理。 这大大简化了代码(尽管事件响应处理现在位于两个不同的函数库代码块之中),并修复了在图表上创建图形对象时,类对象属性填充不完整的问题。 我在上一篇文章中已提到了这一点

一切似乎都还不错,但现在我们无法直接接收来自其它图表里的图形对象事件。 在一个图表上发生的所有事件都会到达该特定图表上工作的 OnChartEvent() 响应程序。 这意味着为了判定在没有程序的图表上发生了什么事件,我们需要向启动程序的图表发送一个事件。

改进库类

在 \MQL5\Include\DoEasy\Data.mqh 里,加入新的消息索引:

  MSG_GRAPH_OBJ_TEXT_ANCHOR_LEFT_UPPER,              // Anchor point at the upper left corner   MSG_GRAPH_OBJ_TEXT_ANCHOR_LEFT,                    // Anchor point at the left center   MSG_GRAPH_OBJ_TEXT_ANCHOR_LEFT_LOWER,              // Anchor point at the lower left corner   MSG_GRAPH_OBJ_TEXT_ANCHOR_LOWER,                   // Anchor point at the bottom center   MSG_GRAPH_OBJ_TEXT_ANCHOR_RIGHT_LOWER,             // Anchor point at the lower right corner   MSG_GRAPH_OBJ_TEXT_ANCHOR_RIGHT,                   // Anchor point at the right center   MSG_GRAPH_OBJ_TEXT_ANCHOR_RIGHT_UPPER,             // Anchor point at the upper right corner   MSG_GRAPH_OBJ_TEXT_ANCHOR_UPPER,                   // Anchor point at the upper center   MSG_GRAPH_OBJ_TEXT_ANCHOR_CENTER,                  // Anchor point at the very center of the object //--- CGraphElementsCollection   MSG_GRAPH_OBJ_FAILED_GET_ADDED_OBJ_LIST,           // Failed to get the list of newly added objects   MSG_GRAPH_OBJ_FAILED_DETACH_OBJ_FROM_LIST,         // Failed to remove a graphical object from the list     MSG_GRAPH_OBJ_CREATE_EVN_CTRL_INDICATOR,           // Indicator for controlling and sending events created   MSG_GRAPH_OBJ_FAILED_CREATE_EVN_CTRL_INDICATOR,    // Failed to create the indicator for controlling and sending events   MSG_GRAPH_OBJ_CLOSED_CHARTS,                       // Chart window closed:   MSG_GRAPH_OBJ_OBJECTS_ON_CLOSED_CHARTS,            // Objects removed together with charts:    }; //+------------------------------------------------------------------+


期货量化软件:图形对象集合 - 在所有打开的图表上管理对象属性修改的评论 (共 条)

分享到微博请遵守国家法律