期貨量化軟件:赫茲量化中窗體對象中的圖形和鼠標(biāo)事件的處理
赫茲量化軟件;https://www.herzqt.com?mark=YWKT8P9??
我加入了用于管理基準(zhǔn)圖形對象定位點(diǎn)的控件,以便處理復(fù)合圖形對象。 我的想法是,移動(dòng)這些控件將需要重新定位基準(zhǔn)圖形對象定位點(diǎn),從而改變其在圖表中的空間超向。 為了能用鼠標(biāo)移動(dòng)這些控制點(diǎn),我們需要為畫布對象(圖形元素和窗體對象)創(chuàng)建鼠標(biāo)事件處理程序。 將鼠標(biāo)光標(biāo)懸停在窗體對象上時(shí),它應(yīng)能探知這一點(diǎn),并更改其屬性。 此外,還應(yīng)考慮用戶是否會按住鼠標(biāo)按鈕不放。 如果我們在窗體對象內(nèi)按下鼠標(biāo)按鈕,并開始移動(dòng)它,則應(yīng)禁用鼠標(biāo)滾動(dòng)圖表(連同十字光標(biāo)工具和圖表上下文菜單),而窗體本身應(yīng)跟隨光標(biāo)。

若按下按鈕的鼠標(biāo)覆蓋其余窗體時(shí),它們不應(yīng)做出反應(yīng)。 如果我們在任何窗體外按鼠標(biāo)鍵并開始移動(dòng)光標(biāo),整個(gè)圖表都會移動(dòng)(如果設(shè)置允許),而窗體對象在光標(biāo)到達(dá)時(shí)不應(yīng)做出反應(yīng),從而避免后者窗體重新定位。 在接下來的文章中,我將逐步為窗體對象創(chuàng)建相同的功能,并繼續(xù)開發(fā)復(fù)合圖形對象。
此外,我還會改進(jìn)品種對象類,因?yàn)閳D表品種現(xiàn)在有新的屬性需要考慮和跟蹤。 新屬性的數(shù)量不多,但就描述這些屬性的枚舉常量的數(shù)量而言,一些屬性的內(nèi)容相當(dāng)可觀(ENUM_SYMBOL_SECTOR,ENUM_SYMBOL_INDUSTRY)。 因此,函數(shù)庫消息類將有多個(gè)新的消息索引,返回屬性描述的方法也將相當(dāng)龐大。
改進(jìn)庫類
在 \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 ? //---