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

期货量化软件:赫兹量化中窗体对象中的图形和鼠标事件的处理

2023-10-07 10:25 作者:大牛啊呢  | 我要投稿

赫兹量化软件;https://www.herzqt.com?mark=YWKT8P9  

我加入了用于管理基准图形对象定位点的控件,以便处理复合图形对象。 我的想法是,移动这些控件将需要重新定位基准图形对象定位点,从而改变其在图表中的空间超向。 为了能用鼠标移动这些控制点,我们需要为画布对象(图形元素窗体对象)创建鼠标事件处理程序。 将鼠标光标悬停在窗体对象上时,它应能探知这一点,并更改其属性。 此外,还应考虑用户是否会按住鼠标按钮不放。 如果我们在窗体对象内按下鼠标按钮,并开始移动它,则应禁用鼠标滚动图表(连同十字光标工具和图表上下文菜单),而窗体本身应跟随光标。

若按下按钮的鼠标覆盖其余窗体时,它们不应做出反应。 如果我们在任何窗体外按鼠标键并开始移动光标,整个图表都会移动(如果设置允许),而窗体对象在光标到达时不应做出反应,从而避免后者窗体重新定位。 在接下来的文章中,我将逐步为窗体对象创建相同的功能,并继续开发复合图形对象。

此外,我还会改进品种对象类,因为图表品种现在有新的属性需要考虑和跟踪。 新属性的数量不多,但就描述这些属性的枚举常量的数量而言,一些属性的内容相当可观(ENUM_SYMBOL_SECTORENUM_SYMBOL_INDUSTRY)。 因此,函数库消息类将有多个新的消息索引,返回属性描述的方法也将相当庞大。


改进库类

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

//--- CSymbol   MSG_SYM_PROP_INDEX,                                // Index in \"Market Watch window\"   MSG_SYM_PROP_SECTOR,                               // Economic sector   MSG_SYM_PROP_INDUSTRY,                             // Industry or economy branch   MSG_SYM_PROP_CUSTOM,                               // Custom symbol   MSG_SYM_PROP_CHART_MODE,                           // Price type used for generating symbols bars   MSG_SYM_PROP_EXIST,                                // Symbol with this name exists   MSG_SYM_PROP_SELECT,                               // Symbol selected in Market Watch   MSG_SYM_PROP_VISIBLE,                              // Symbol visible in Market Watch   MSG_SYM_PROP_SESSION_DEALS,                        // Number of deals in the current session   MSG_SYM_PROP_SESSION_BUY_ORDERS,                   // Number of Buy orders at the moment   MSG_SYM_PROP_SESSION_SELL_ORDERS,                  // Number of Sell orders at the moment   MSG_SYM_PROP_VOLUME,                               // Volume of the last deal   MSG_SYM_PROP_VOLUMEHIGH,                           // Maximal day volume   MSG_SYM_PROP_VOLUMELOW,                            // Minimal day volume   MSG_SYM_PROP_TIME,                                 // Latest quote time   MSG_SYM_PROP_TIME_MSC,                             // Time of the last quote in milliseconds   MSG_SYM_PROP_DIGITS,                               // Number of decimal places   MSG_SYM_PROP_DIGITS_LOTS,                          // Digits after a decimal point in the value of the lot

...

  MSG_SYM_PROP_SESSION_PRICE_LIMIT_MAX,              // Maximum session price   MSG_SYM_PROP_MARGIN_HEDGED,                        // Size of a contract or margin for one lot of hedged positions     MSG_SYM_PROP_PRICE_CHANGE,                         // Change of the current price relative to the end of the previous trading day in %   MSG_SYM_PROP_PRICE_VOLATILITY,                     // Price volatility in %   MSG_SYM_PROP_PRICE_THEORETICAL,                    // Theoretical option price   MSG_SYM_PROP_PRICE_DELTA,                          // Option/warrant delta   MSG_SYM_PROP_PRICE_THETA,                          // Option/warrant theta   MSG_SYM_PROP_PRICE_GAMMA,                          // Option/warrant gamma   MSG_SYM_PROP_PRICE_VEGA,                           // Option/warrant vega   MSG_SYM_PROP_PRICE_RHO,                            // Option/warrant rho   MSG_SYM_PROP_PRICE_OMEGA,                          // Option/warrant omega   MSG_SYM_PROP_PRICE_SENSITIVITY,                    // Option/warrant sensitivity   //---   MSG_SYM_PROP_NAME,                                 // Symbol name   MSG_SYM_PROP_BASIS,                                // Underlying asset of derivative   MSG_SYM_PROP_COUNTRY,                              // Country   MSG_SYM_PROP_SECTOR_NAME,                          // Economic sector   MSG_SYM_PROP_INDUSTRY_NAME,                        // Economy or industry branch   MSG_SYM_PROP_CURRENCY_BASE,                        // Basic currency of symbol   MSG_SYM_PROP_CURRENCY_PROFIT,                      // Profit currency   MSG_SYM_PROP_CURRENCY_MARGIN,                      // Margin currency   MSG_SYM_PROP_BANK,                                 // Feeder of the current quote   MSG_SYM_PROP_DESCRIPTION,                          // Symbol description   MSG_SYM_PROP_FORMULA,                              // Formula used for custom symbol pricing   MSG_SYM_PROP_ISIN,                                 // Symbol name in ISIN system   MSG_SYM_PROP_PAGE,                                 // Address of web page containing symbol information   MSG_SYM_PROP_PATH,                                 // Location in symbol tree   MSG_SYM_PROP_CAYEGORY,                             // Symbol category   MSG_SYM_PROP_EXCHANGE,                             // Name of an exchange a symbol is traded on   //---



期货量化软件:赫兹量化中窗体对象中的图形和鼠标事件的处理的评论 (共 条)

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