免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一个神经网络的ea的示例含源码combo_right.mq4 软件简介 去年年底结束的国际大赛的第一名为better所夺得 他采用的就是神经网络原理的ea 这使得用神经网络方法做ea成为不少人关注的焦点 这里翻译一篇采用神经网络做ea的不错的示例文章 当然附有源码是吸引人的地方 不过也许作者提出了研究神经网络ea的一些思考更为值得注意 作者提出了 1。“如果有飞机为什么还要教人类去飞” 意思是研究是经网络不必从零起步。mt4里已有了不错的“遗传算法” 文中介绍了如何利用mt4已有的“遗传算法” 2。大家都说做单子最重要的是“顺势而为”但更需要解决的是 “一个基于趋势的交易系统是不能成功交易在盘整sideways trends 也不能识别市场的回调setbacks和逆转reversals.反向走势” 这可是抓到不少人心中的“痒处”有多少人不是到了该逆势时没转向而产生亏损呢 3。训练神经网络需要用多长的历史数据提出了并不是用的历史数据越长越好另外也不是训练的间隔越短越好文中提出了什么情况下有需再训练它。 等等。 下面是译文和作者的源码 the problem is stated for this automated trading system ats as follows: ats自动的智能的采用神经网络的交易系统的问题表述如下 lets consider we have a basic trading system - bts. it is necessary to create and teach a neural network in order it to do things that cannot be done with the bts. this must result in creation of a trading system consisting of two combined and mutually complementary bts and nn neural network. 如果我们有一个bts basic trading system同时需要用创建一个神经网络系统并教会它做bts所不能做的事按这个思路就是要创建这样一个交易系统它由互相补充配合的两部分组成bts和nn神经网络。 or the english of this is: there is no need to discover the continents again they were all discovered. why to teach somebody to run fast if we have a car or to fly if we have a plane 呃英语说我们不需要再去发现“新大陆”它们是已经存在的东西进一步说如果我们已经有了汽车那为什么还要教人如何跑得快如果有飞机为什么还要教人类去飞 once we have a trend-following ats we just have to teach the neural network in countertrend strategy. this is necessary because a system intended for trend-based trading cannot trade on sideways trends or recognize market setbacks or reversals. you can of course take two atses - a trend-following one and a countertrend one - and attach them to the same chart. on the other hand you can teach a neural network to complement your existing trading system. 一旦有一个趋势交易系统的ats我们仅需要教会这个神经网络如何逆势反趋势交易的策略。这一点是非常必要的因为一个基于趋势的交易系统是不能成功交易在盘整sideways trends也不能识别市场的回调setbacks和逆转reversals.反向走势当然你可以采用两个ats一个基于“趋势”一个基于“反趋势”逆向然后把它们挂到同一图表上。另一个办法是你能教会神经网络如何与你现有的系统“互补地”协调工作 for this purpose we designed a two-layer neural network consisting of two perceptrons in the lower layer and one perceptron in the upper layer. 为实现这个目标我们设计了一个两层的神经网络下层有两个感知机perceptrons上层有一个感知机。 the output of the neural network can be in one of these three states: 这个神经网络的能输出下列三种状态之一 entering the market with a long position entering市场是处在多向仓 entering the market with a short position entering市场是处在空向仓 indeterminate state 不确定的 不明确的 模糊的状态 actually the third state is the state of passing control over to the bts whereas in the first two states the trade signals are given by the neural network. 实际上第三种状蔷桶芽刂迫桓鳥ts反之前两种状态是交易信号由神经网络给出。 the teaching of the neural network is divided into three stages each stage for teaching one perceptron. at any stage the optimized bts must be present for perceptrons to know what it can do. 神经网络的“教育”分成三步骤每一步骤“教育”一个感知机在任何一步骤这个优化了的bts必须存在为的是“感知机们”知道它自己能做什么。 the separate teaching of perceptrons by a genetic algorithm is determined by the lack of this algorithm namely: the amount of inputs searched in with the help of such algorithm is limited. however each teaching stage is coherent and the neural network is not too large so the whole optimization does not take too much time. 感知机们分别的“教育”由遗传算法来承担由于这样的算法的缺乏换句话说搜索到的这样的算法有限限制了“输入”参数变量的数量借助这样算法得到的参数变量的值然而每一步骤的“教育”是密切配合补充的。因此效果还是不错这样这个神经网络不会太大整个的优化也不会耗费太多的时间。 the very first stage preceding the teaching of an nn consists in optimization of the bts. 在“教育”nn之前的一步是对bts进行优化。 in order not to lose ourselves we will record the stage number in the input of the ats identified as quotpassquot. identifiers of inputs corresponding with the stage number will and in the number equal to this stage number. 为了不使我们自己也被搞糊涂了我们将已经测试通过的ats的输入参数变量记录上”通过”quotpassquot的步骤号stage number.输入s参数变量的标识符将和stage number步骤号一致等同。 thus lets start preparations for optimization and teaching the nn. lets set the initial deposit as 1000000 in order not to create an artificial margin call during optimization and the input to be optimized as quotbalancequot in expert advisor properties on the tab of quottestingquot in the strategy tester and start genetic algorithm. 这样我们开始对这个nn进行优化和“教育”的准备。存入初始保证金为100万以便于在优化期间不产生人为的补充保证金的通知。input参数变量是按“余额”进行优化设置ea的strategy tester的测试的属性tab为quottestingquot 。开始运行遗传算法。 lets go to the quotinputsquot tab of the eas properties and specify the volume of positions to be opened by assigning the value 1 to the identifier quotlotsquot. 在这个ea的开仓量 quotlotsquot.的值设为1 lot。 optimization will be performed according to the model: quotopen prices only fastest method to analyze the bar just completed only for eas that explicitly control bar openingquot since this method is available in the ats algorithm. 从这个ats算法明确地有效开始实施优化所采用复盘模型是“仅用开盘价以最快速的方法分析刚形成的柱线”。 stage 1 of optimization. optimization of the bts: 优化步骤1bts的优化 set the value 1 for the input quotpassquot. 设置为 1 为这input参数变量“为通过”the input quotpassquot。 we will optimize only inputs that correspond with the first stage i.e. that end in 1. thus we check only these inputs for optimization and uncheck all others. 我们仅仅优化步骤1相关的那些inputs参数变量即尾标为 1 的参数变量于是我们仅仅测试优化有关的inputs而不测试其他的变量参数 tp1 - takeprofit of the bts. it is optimized with the values within the range of 10 to 100 step 1 tp1bts的所取的止盈值takeprofit。在step 1优化的值的范围在10到100 sl1 - stoploss of the bts. it is optimized with the values within the range of 10 to 100 step 1 sl1bts的所取的止损值stoploss。在step 1优化的值的范围在10到100 。 p1 - period of cci used in the bts. it is optimized with the values within the range of 3 to 100 step 1 p1 用于bts的cci的周期值。在step 1 优化的值的范围在 3到100 below are the results of the bts optimization: 下面是bts优化的结果 stage 2. teaching the perceptron responsible for short positions: 步骤 2 “教育负责管“开空仓”short positions的感知机 set the value 2 according to the stage number for the input quotpassquot. 根据步骤的步骤号设置input参数变量 的quotpassquot的值为 2。 uncheck the inputs checked for optimization in the previous stage. just in case save in a file the inputs obtained at the previous stage. 不测试那些已经测试过的优化了的以前步骤的inputs.变量参数。以防万一保存以前步骤获得的inputs变量参数值到一个文件中去 check the inputs for optimization according to our rule: their identifiers must end in 2: 根据我们的规则必须是测试那些是在尾标为 2的inputs变量参数。 x12 x22 x32 x42 - weight numbers of the perceptron that recognizes short positions. it is optimized with the values within the range of 0 to 200 step 1 x12 x22 x32 x42 是识别并开空仓的感知机的权重它们的值在step 1时被优化在范围0 to 200 tp2 - takeprofit of positions opened by the perceptron. it is optimized with the values within the range of 10 to 100 step 1 tp2 takeprofit 是感知机所开的仓的止盈值它们的值在step 1时被优化在范围10 to 100。 sl2 - stoploss of positions opened by the perceptron. it is optimized with the values within the range of 10 to 100 step 1 sl2 stoplos 在 step 1它是感知机所开的仓的止损值被优化值的范围在 10 to 100 p2 - the period of the values of price difference to be analyzed by the perceptron. it is optimized with the values within the range of 3 to 100 step 1. p2 感知机所分析的价格差的周期值 iicci函数的一个参数period - averaging period for calculation在step 1 它的值所优化的范围在3 to 100 lets start teaching it using optimization with a genetic algorithm. the obtained results are given below: 现在开始用遗传算法来优化“教育”nn让它“学习”市场获得的结果如下 stage 3. teaching the perceptron responsible for long positions: 步骤 3 “教育”负责开多仓的感知机“学习”市场。 set the value 3 according to the stage number for the input quotpassquot. 设置值 3 根据步骤的步骤号说明这些input变量参数已经“通过”the input quotpassquot uncheck the inputs checked for optimization in the previous stage. just in case save in a file the inputs obtained at the previous stage. 同样不测试那些已经测试过的优化了的以前步骤的inputs.变量参数值以防万一保存以前步骤获得的inputs.变量参数值 到一个文件中去 check the inputs for optimization according to our rule: their identifiers must end in 3: 根据我们的规则优化测试的inputs变量参数值必须是尾标为3的那些变量参数。 x13 x23 x33 x43 - weight numbers of the perceptron that recognizes long positions. it is optimized with the values within the range of 0 to 200 step 1. x13 x23 x33 x43是识别多仓的感知机的权重它们的值在step 1时被优化时得到的范围在0 to 200 tp3 - takeprofit of positions opened by the perceptron. it is optimized with the values within the range of 10 to 100 step 1 tp 3 takeprofit 是感知机所开的仓的“止盈值”它的值在step 1时被优化时的范围是在10 to 100。 sl3 - stoploss of positions opened by the perceptron. it is optimized with the values within the range of 10 to 100 step 1 sl3 stoploss 是感知机所开的仓的“止盈值”它们的值在step 1时被优化为范围是10 to 100。 p3 - the period of the values of price difference to be analyzed by the perceptron . it is optimized with the values within the range of 3 to 100 step 1. p3 -感知机所分析的价差的周期值。它在步骤 1 优化时得到的值的范围是 3 to 100 。 lets start teaching it using optimization with a genetic algorithm. the obtained results are given below: 启动采用遗传算法的优化来“教育”nn所获得的结果如下 stage 4 final. teaching the first layer i.e. teaching the perceptron that is in the upper layer: 步骤 4 最终步骤 “教育”第一层即“教育”在上层的感知机。 set the value 4 according to the stage number for the input quotpassquot. 根据步骤的步骤号设置值4 为输入通过for the input quotpassquot uncheck the inputs checked for optimization in the previous stage. just in case save in a file the inputs obtained at the previous stage. 不测试那些在之前步骤已经测试过的优化了的“输入” inputs 意思是已经在之前步骤优化过的变量的参数值就不再优化它们了。以防万一将之前步骤获得的这些变量的参数值存到一个文件中去。 check the inputs for optimization according to our rule: their identifiers must end in 4: 根据我们的规则只测试优化标识符最后位是4的那些inputs变量的参数值 x14 x24 x34 x44 - weight numbers of the perceptron of the first layer. it is optimized with the values within the range of 0 to 200 step 1. x14 x24 x34 x44 是第一层感知机参数的权重值。在步骤 1 时它们被优化的值的范围在0 to 200 。 p4 - the period of the values of price difference to be analyzed by the perceptron. it is optimized with the values within the range of 3 to 100 step 1. p4 被感知机分析的价差的值的周期。在步骤 1 它的值的范围被优化在 3 to 100 。 lets start teaching it using optimization with a genetic algorithm. the obtained results are given below: 采用遗传算法来优化启动“教育”来教它“学习”。所获得结果如下 thats all the neural network has been taught. 这就是全部神经网络已经被“教育”了。 the ats has one more non-optimizable input mn - magic number. it is the identifier of positions for a trading system not to mix its orders with the orders opened manually or by other atses. the value of the magic number must be unique and not coincide with the magic numbers of positions that have not been opened by this specific expert advisor. 这个ats有一个不能被优化的input参数 mn- magic number.魔法号它是一个交易系统它所开的仓位的识别符为的是不和手动开仓或其他atses开的仓位混淆。这个magic number的值必须是唯一的并且和这个特别的ea尚未开仓的magic numbers不一致。 p.s. the size of the initial deposit is found as the doubled absolute drawdown i.e. we consider some safety resources for it. 出于保证有一些安全保险的考虑初始保证金的金额设置是考虑为绝对最大回落的两倍 the ea given in the source codes is not optimized. 这个ea的源代码没有优化。 if you need to replace the built-in bts with the algorithm of another trading system you must modify the contents of the function basictradingsystem. 如果你需要置换嵌入另一个交易系统算法的bts你必须修改bts功能的内部。 in order not to enter the initial and the final values and the values of steps for optimization you can take the ready file combo.set place it in the folder tester mt4 and upload to the eas properties in tester. 以便于不输入优化时的初值终值和步长你可采用已备好的combo.set文件把它放置到mt4的 tester 目录并加载这个ea的属性properties到strategy tester。 re-optimization of the ea is to be performed at a weekend i.e. on saturday or on sunday but only if the results of the preceding week were unprofitable. the presence of losses means that the market has changed and the re-optimization is necessary. the presence of profits means that the ats does not need any re-optimization and recognizes market patterns quite well. 这个ea的再优化可在周末进行
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026江苏宿迁市沭阳县教师发展中心择优比选研训员6人备考题库附答案详解(b卷)
- 2026江西铜业集团南方公司春季校园招聘11人考试参考试题及答案解析
- 2026中国电信校园招聘“优才计划”专项招聘备考题库含答案详解(典型题)
- 2026年江苏省省属事业单位统一招聘人员621人考试备考试题及答案解析
- 2026四川宜宾丽雅城市建设发展有限公司下属子公司第一批员工招聘4人备考题库(完整版)附答案详解
- 2026四川遂宁射洪平安街道招聘1人备考题库及参考答案详解(a卷)
- 2026广东梅州市人民医院第2批招聘43人备考题库附完整答案详解(典优)
- 2026上海AI实验室访问学者计划全球招募备考题库含答案详解(预热题)
- 2026新疆昌吉州昌吉农高集团电商公司招聘专业运营人才10人考试参考题库及答案解析
- 国泰君安期货2026届金衍新星SSP招募备考题库附答案详解(能力提升)
- 2025-2030中国电子体温计行业市场全景调研及投资价值评估咨询报告
- 氢氟酸安全操作培训课件
- 劳动课件水培绿萝
- 十年(2016-2025)高考英语真题分类汇编:专题19 完形填空记叙文(全国)(原卷版)
- 汽车维修安全教育培训课件
- 基于PLC的自动咖啡机控制系统设计
- 2025年湖北省事业单位工勤技能考试题库(含答案)
- 施工现场安全检查记录表(周)以及详细记录
- 2025年度中国质量检验检测科学研究院招聘工作人员(1人)笔试备考试题附答案详解(典型题)
- 2026年中考英语复习:24类话题作文+范文
- 数据中心供配电系统概述
评论
0/150
提交评论