- 显示:
- 3733
- 等级:
- 已发布:
- 2016.04.25 12:43
-
需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务
有关自动优化器的用例, 和其操作原理的完整文章可在此找到: https://www.mql5.com/zh/articles/1467
将代码插入您的 EA:
//---- extern int SetHour = 0; //优化开始时间 extern int SetMinute = 1; //优化开始分钟 int TestDay = 3; //优化天数 int TimeOut = 4; //超时分钟则优化结束 string NameMTS = "Expert_Name"; //EA 的名称 string NameFileSet = "SetFileName.set"; //设置文件名称 string PuthTester = "PathTester"; //测试器路径 //--- 订单过滤 int Gross_Profit = 1; //最大盈利排序 int Profit_Factor = 2; //最大应力因子排序 int Expected_Payoff= 3; //最大预期回报排序 //--优化变量名 string Per1 = "variables_1"; string Per2 = "variables_2"; string Per3 = "variables_3"; string Per4 = "variables_4"; bool StartTest=false; datetime TimeStart; //--- 包含自动优化库 #include <auto_optimization.mqh> //----代码插入到 start() 函数
//---- // 不要在测试和优化期间启动 if(!IsTesting() && !IsOptimization()) { // 比较当前和启动时的小时差 if(TimeHour(TimeLocal()) == SetHour) { // 重启保护 if(!StartTest) { // 比较当前和启动时的分钟范围 if(TimeMinute(TimeLocal()) > SetMinute - 1) { // 出于一些原因, 此范围是必需的 // 长时间没有新的分时 if(TimeMinute(TimeLocal()) < SetMinute + 1) { TimeStart = TimeLocal(); StartTest = true; // 测试器启动标志 Tester(TestDay, NameMTS, NameFileSet, PuthTester, TimeOut, Gross_Profit, Profit_Factor, Expected_Payoff, Per1, Per2, Per3, Per4); } } } } variables_1 = GlobalVariableGet(Per1); variables_2 = GlobalVariableGet(Per2); variables_3 = GlobalVariableGet(Per3); variables_4 = GlobalVariableGet(Per4); } // 是否测试器已经启动的标志 if(StartTest) { // 如果自启动的时间, 已超过了设置 // 的等待时间很多 if(TimeLocal() - TimeStart > TimeOut*60) { StartTest = false; // 标志清零 } } //----
为集成版本 204 添加自动优化器库 - auto_optimization_204.mqh
相应地, 调用库函数的代码如下
//--- 包含自动优化库 #include <auto_optimization_204.mqh>
由MetaQuotes Ltd译自俄语
原代码: https://www.mql5.com/ru/code/7090

脚本 hst2csv 用来转换 *.hst 文件至 *.csv 文件, 之后可以无暇地导入到 MetaTrader 4 客户终端。

脚本 history_data_analysis_v3 检查历史中的缺失柱线检测漏洞、缺口大小, 并在列表里标记它们。