国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

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

期貨量化:赫茲量化中研究多幣種的交易信號(hào)3--引入搜索算法

2023-11-01 16:44 作者:大牛啊呢  | 我要投稿

打開(kāi)項(xiàng)目,找到 CProgram 基類,并在其私密部分中添加兩個(gè)方法。 該方法將負(fù)責(zé)加載和保存品種模板。

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

以下是這些方法如何被實(shí)現(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); }

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

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

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

? ? ? ? //--- 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()); ? ? ? ? }

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

//--- 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()); ? ? ? ? } ? ? ?} ? }

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



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

添加和編輯交易信號(hào)

現(xiàn)在,轉(zhuǎn)到應(yīng)用程序的主要部分,該部分負(fù)責(zé)創(chuàng)建和編輯交易信號(hào),以及進(jìn)一步在監(jiān)視器中跟蹤它們。 信號(hào)創(chuàng)建和編輯的摸樣如此這般。



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

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

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

兩個(gè) CButton 按鈕的實(shí)例:

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


期貨量化:赫茲量化中研究多幣種的交易信號(hào)3--引入搜索算法的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
霍州市| 大化| 松滋市| 双城市| 中山市| 光泽县| 乌拉特后旗| 南开区| 常宁市| 农安县| 萨迦县| 镇沅| 竹山县| 农安县| 南郑县| 循化| 九江县| 景泰县| 新巴尔虎左旗| 萨嘎县| 府谷县| 鹿邑县| 普格县| 建水县| 彩票| 武安市| 赣榆县| 屏东市| 万载县| 云南省| 天祝| 庆云县| 安庆市| 开封市| 来凤县| 商洛市| 饶河县| 伊春市| 康马县| 繁峙县| 密云县|