一个神经网络的EA的示例.doc
《一个神经网络的EA的示例.doc》由会员分享,可在线阅读,更多相关《一个神经网络的EA的示例.doc(6页珍藏版)》请在三一办公上搜索。
1、一个神经网络的EA的示例含源码Combo_Right.mq4 软件简介 去年年底结束的国际大赛的第一名为Better所夺得 他采用的就是神经网络原理的EA 这使得用神经网络方法做EA成为不少人关注的焦点 这里翻译一篇采用神经网络做EA的不错的示例文章 当然附有源码是吸引人的地方 不过也许作者提出了研究神经网络EA的一些思考更为值得注意 作者提出了 1。“如果有飞机为什么还要教人类去飞” 意思是研究是经网络不必从零起步。MT4里已有了不错的“遗传算法” 文中介绍了如何利用MT4已有的“遗传算法” 2。大家都说做单子最重要的是“顺势而为”但更需要解决的是 “一个基于趋势的交易系统是不能成功交易在盘
2、整sideways trends 也不能识别市场的回调setbacks和逆转reversals.反向走势” 这可是抓到不少人心中的“痒处”有多少人不是到了该逆势时没转向而产生亏损呢 3。训练神经网络需要用多长的历史数据提出了并不是用的历史数据越长越好另外也不是训练的间隔越短越好文中提出了什么情况下有需再训练它。 等等。 下面是译文和作者的源码 The problem is stated for this automated trading system ATS as follows: ATS自动的智能的采用神经网络的交易系统的问题表述如下 Lets consider we have a bas
3、ic 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同时
4、需要用创建一个神经网络系统并教会它做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 呃英语说我们不需要再去发现“新大陆”它们是已经存在的东西进一步说如果我们已经有了汽车那为什么
5、还要教人如何跑得快如果有飞机为什么还要教人类去飞 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 ATS
6、es - 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.反
7、向走势当然你可以采用两个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 n
8、etwork 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
9、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.
10、神经网络的“教育”分成三步骤每一步骤“教育”一个感知机在任何一步骤这个优化了的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 t
11、he 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
12、 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的输入参数变量记录上”通过”qu
13、otpassquot的步骤号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 Advi
14、sor 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
15、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 openin
16、gquot 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 corr
17、espond 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的所取的止盈值T
18、akeProfit。在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
19、 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
20、 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: 根据我们的规则必须是测试那些是
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 一个 神经网络 EA 示例

链接地址:https://www.31ppt.com/p-2397685.html