最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

赫茲股票量化軟件:監(jiān)視多幣種的交易信號3:引入搜索算法

2023-07-13 14:53 作者:大牛啊呢  | 我要投稿

品種集保存系統(tǒng)

上一次,在第一個應用程序設置步驟中,我們創(chuàng)建了從市場觀察里選擇品種的工具。 可以按三種不同方式選擇品種:

赫茲量化股票期貨交易軟件

  • 手工。 標記所需品種,然后單擊下一步。

  • 一套預定義集合。 單擊“All(全部)”,“Major(直盤)”或 “Crosses(交叉盤)”會自動選擇一組特定的預定義品種。

  • 集合已保存 之前預備好的品種集用前兩種方法得以配置,并以特定名稱保存到文件中。



編輯切換為居中


圖例 1 應用程序設置步驟 1,和已保存的集合設置。

前兩種方法非常簡單,且它們是早前就已創(chuàng)建的。 第三種方式需要創(chuàng)建。 現(xiàn)在我們來更精確地定義我們要做什么。 我們將更深入地研究圖例 1 中紅框里元素的交互作用,這意味著:

赫茲量化股票期貨交易軟件

  • 所需品種由勾選符標記,用戶在 “Template name(模板名稱)”字段中輸入名稱,然后單擊 “Save(保存)”或按 S 熱鍵。 如果成功保存,則會顯示相應的消息。

  • 若要訪問之前配置并保存的模板,應在字段中鍵入模板名稱,然后按 “Load(加載)”或 L 熱鍵。



打開項目,找到 CProgram 基類,并在其私密部分中添加兩個方法。 該方法將負責加載和保存品種模板。

? bool ? ? ? ? ? ? ?SaveSymbolSet(string file_name); ? bool ? ? ? ? ? ? ?LoadSymbolSet(string file_name);

以下是這些方法如何被實現(xiàn)的。

//+------------------------------------------------------------------+ //| Save template to a file ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| //+------------------------------------------------------------------+ bool CProgram::SaveSymbolSet(string file_name) { ? if(file_name=="") ? { ? ? ?MessageBox("Select the template name to record","Signal Monitor"); ? ? ?return(false); ? } ? int h=FileOpen("Signal Monitor\\"+file_name+".bin",FILE_WRITE|FILE_BIN); ? if(h==INVALID_HANDLE) ? { ? ? ?MessageBox("Failed to create a configuration file","Signal Monitor"); ? ? ?return(false); ? } ? else ? ? ?MessageBox("The "+file_name+" configuration has been successfully saved","Signal Monitor"); //--- Save the selection of timeframes and patterns ? for(int i=0; i<m_all_symbols; i++) ? ? ?m_save.tf[i]=m_checkbox[i].IsPressed(); //--- ? FileWriteStruct(h,m_save); ? FileClose(h); //--- ? return(true); } //+------------------------------------------------------------------+ //| Load data to a panel ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | //+------------------------------------------------------------------+ bool CProgram::LoadSymbolSet(string file_name) { ? if(file_name=="") ? { ? ? ?MessageBox("Select the template name to load","Signal Monitor"); ? ? ?return(false); ? } ? int h=FileOpen("Signal Monitor\\"+file_name+".bin",FILE_READ|FILE_BIN); ? if(h==INVALID_HANDLE) ? { ? ? ?MessageBox("Configuration "+file_name+" not found","Signal Monitor"); ? ? ?return(false); ? } ? ZeroMemory(m_save); ? FileReadStruct(h,m_save); //--- Loading timeframes ? for(int i=0; i<m_all_symbols; i++) ? { ? ? ?m_checkbox[i].IsPressed(m_save.tf[i]); ? ? ?m_checkbox[i].Update(true); ? } //--- ? FileClose(h); //--- ? return(true); }

不過,若嘗試立即編譯項目,則將觸發(fā)與 m_save 變量有關的錯誤。 該結(jié)構(gòu)含有一個名為 tf 的布爾類型參數(shù)。 它可記住用戶所選的文件。 故需在應用類中創(chuàng)建此結(jié)構(gòu),并將其實例添加到基類。赫茲量化股票期貨交易軟件

//+------------------------------------------------------------------+ //| Class for creating the application ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | //+------------------------------------------------------------------+ struct SAVE { ? bool ? ? tf[100]; }; class CProgram : public CWndEvents { ... ? ? ? ?SAVE ? ? ? ? ? ?m_save;

轉(zhuǎn)到 OnEvent(),進入與按鈕點擊事件相關的部分,并在“第一步”條件中添加以下代碼:

? ? ? ? //--- Save the template ? ? ? ? if(lparam==m_save_button.Id()) ? ? ? ? { ? ? ? ? ? ?SaveSymbolSet(m_text_edit.GetValue()); ? ? ? ? } ? ? ? ? //--- Load the template ? ? ? ? if(lparam==m_load_button.Id()) ? ? ? ? { ? ? ? ? ? ?LoadSymbolSet(m_text_edit.GetValue()); ? ? ? ? }

另外,實現(xiàn)上述按鈕的熱鍵用法。 以相同的方法,為按鍵事件添加檢查,并針對所用鍵添加代碼。

//--- Key press ? if(id==CHARTEVENT_KEYDOWN) ? { ? ? ?if(m_current_step==1) ? ? ?{ ? ? ? ? short sym=TranslateKey((int)lparam); ? ? ? ? //--- if the entered character is successfully converted to Unicode ? ? ? ? if(sym>0) ? ? ? ? { ? ? ? ? ? ?if(ShortToString(sym)=="l" || ShortToString(sym)=="д") ? ? ? ? ? ? ? LoadSymbolSet(m_text_edit.GetValue()); ? ? ? ? ? ?if(ShortToString(sym)=="s" || ShortToString(sym)=="ы") ? ? ? ? ? ? ? SaveSymbolSet(m_text_edit.GetValue()); ? ? ? ? } ? ? ?} ? }

編譯項目。 若成功編譯將產(chǎn)生以下結(jié)果。


編輯切換為居中


圖例 2 保存和加載用戶模板

添加和編輯交易信號

現(xiàn)在,轉(zhuǎn)到應用程序的主要部分,該部分負責創(chuàng)建和編輯交易信號,以及進一步在監(jiān)視器中跟蹤它們。 信號創(chuàng)建和編輯的摸樣如此這般。 赫茲量化股票期貨交易軟件


編輯


圖例 3 信號創(chuàng)建和編輯窗口。

在當前階段,該窗口顯示各種控制參數(shù)的一組 GUI 元素。 然而,這些設置尚未在任何地方用到。 首先在界面上添加兩個按鈕。 它們是添加/保存交易信號。 另一個是取消創(chuàng)建/編輯按鈕。 打開 Program.mqh ,并將這兩個按鈕的實現(xiàn)方法添加到基類中:

bool ? ? ? ? ? ? ?CreateButton3(CButton &button,string text,const int x_gap,const int y_gap);

兩個 CButton 按鈕的實例:

? CButton ? ? ? ? ? m_new_signal; ? CButton ? ? ? ? ? m_cancel_button;


赫茲股票量化軟件:監(jiān)視多幣種的交易信號3:引入搜索算法的評論 (共 條)

分享到微博請遵守國家法律
龙山县| 沂南县| 新乡县| 合江县| 江陵县| 洛阳市| 株洲市| 云霄县| 苏尼特左旗| 绵阳市| 广水市| 萝北县| 东阳市| 文化| 同心县| 永年县| 镇雄县| 微山县| 涞源县| 澜沧| 常宁市| 翁牛特旗| 毕节市| 磐安县| 台湾省| 留坝县| 大田县| 平陆县| 从化市| 马公市| 麟游县| 沙坪坝区| 陈巴尔虎旗| 彭山县| 曲阳县| 南城县| 义马市| 宣城市| 苍溪县| 柯坪县| 东丰县|