




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
10万智能EA来源全球外汇网+-+/| FX185mq4 |/| Copyright 2006, Hua Ai (aha) |/| |/+-+#property copyright Copyright 2006, Hua Ai (aha)#property link /*Bago system can be categorized as a trend following system based on the cross of ema 5 and ema 12. When used properly on hourly chart it can capture daily swings of 100+ pips.The use of small number emas gives Bago system the sensitivity to generate early signals following 10-20 minutes scale waves, but also produces a great deal of false signals that can quickly drain a traders account. So filters are extremely important for Bago system.While Bago system is largely a discretionary system, the integration of two excellent filters may make it possible to use a computer programgenerate signals with great high successful rate. This program is writtern to investigate this possiblity.The mechanism to generate a raw Bago signal is simple: ema 5 crosses ema 12 in the same direction as RSI 21 crosses 50 level. To abstract real signals, we need to pay attention to context: where the price are,and when the crosses happens.The greatest meaning of integrating Vegas tunnel into Bago system is, the tunnel as well as its fibo lines changes the original plain 2-dspace into a twisted 2-d space. The twisted price trends now have thecoordinates. With this coordinates system we may see the entry and exitwith higher accuracy.So, this program will first construct the simple rules upon which the the raw signals are generated, then will add rules to filter those signals. Those new rules are quantified as parameters so they can be easily changed and optimized based on the output results.Enough talking, now come to business.*/Adjustable parameters/*extern intTrailingStop = 30;extern intCrossEffectiveTime = 2; extern intTunnelBandWidth= 0;extern intTunnelSafeZone = 120;extern intHardStopLoss = 30;extern intStopLossToFibo = 20;extern boolLondonOpen = true;extern boolNewYorkOpen = true;extern boolTokyoOpen = true;*/extern intFasterEMA = 5;extern intSlowerEMA = 12;extern intRSIPeriod = 21;extern double TotalLots = 3.0;extern intTPLevel1 = 55;extern double TPLevel1Lots = 1.0;extern intTPLevel2 = 89;extern double TPLevel2Lots = 1.0;extern intTPLevel3 = 144;/Parameters optimized for different pairsintTrailingStop = 30;intCrossEffectiveTime = 2; intTunnelBandWidth= 0;intTunnelSafeZone = 120;intHardStopLoss = 30;intStopLossToFibo = 20;boolLondonOpen = true;boolNewYorkOpen = true;boolTokyoOpen = true;/ Indicator buffers to mark the signaldouble CrossUp;double CrossDown;/ State registers store cross up/down information bool EMACrossedUp;bool EMACrossedDown;bool RSICrossedUp;bool RSICrossedDown;bool TunnelCrossedUp;bool TunnelCrossedDown;/ Cross up/down info should expire in a couple of bars./ Timer registers to control the EMACrossedUpTimer;int RSICrossedUpTimer;int EMACrossedDownTimer;int RSICrossedDownTimer;/bool startup;/int SignalLabeled; / 0: initial state; 1: up; 2: down./bool upalert,downalert;/+-+/| expert initialization function |/+-+int init()if (Symbol() = EURUSD) TrailingStop = 25; CrossEffectiveTime= 2; TunnelBandWidth = 5; TunnelSafeZone = 120; HardStopLoss = 30; StopLossToFibo = 50; LondonOpen = true; / ok NewYorkOpen = true; / the best TokyoOpen = false;/ disasterelse if (Symbol() = GBPUSD) TrailingStop = 50; CrossEffectiveTime= 2; TunnelBandWidth = 8; TunnelSafeZone = 160; HardStopLoss = 30; StopLossToFibo = 15; LondonOpen = true; / ok NewYorkOpen = false;/ so so TokyoOpen = true; / the bestelse if (Symbol() = USDCHF) TrailingStop = 70; CrossEffectiveTime= 2; TunnelBandWidth = 9; TunnelSafeZone = 160; HardStopLoss = 30; StopLossToFibo = 30; LondonOpen = true; / Great NewYorkOpen = true; / Ok TokyoOpen = true; / so soelse if (Symbol() = AUDUSD) TrailingStop = 60; CrossEffectiveTime= 2; TunnelBandWidth = 6; TunnelSafeZone = 70; HardStopLoss = 30; StopLossToFibo = 30; LondonOpen = true; / Great NewYorkOpen = true; / Ok TokyoOpen = true; / so so/ No crossEMACrossedUp = false;RSICrossedUp = false;TunnelCrossedUp = false;EMACrossedDown = false;RSICrossedDown = false;TunnelCrossedDown = false;/ Reset timersEMACrossedUpTimer = 0;RSICrossedUpTimer = 0;EMACrossedDownTimer = 0;RSICrossedDownTimer = 0;/-return(0);/+-+/| expert deinitialization function |/+-+int deinit()/-EMACrossedUp = false;RSICrossedUp = false;TunnelCrossedUp = false;EMACrossedDown = false;RSICrossedDown = false;TunnelCrossedDown = false;EMACrossedUpTimer = 0;RSICrossedUpTimer = 0;EMACrossedDownTimer = 0;RSICrossedDownTimer = 0;/-return(0);/+-+/| expert start function |/+-+int start() int i, cnt, total, ticket, orders;double fasterEMAnow, slowerEMAnow;double fasterEMAprevious, slowerEMAprevious;double RSInow, RSIprevious;double VegasTunnelFast, VegasTunnelSlow;double VegasPriceCrossedL, VegasPriceCrossedS;if (Minute()2 & Seconds() 50) & (RSIprevious =CrossEffectiveTime) RSICrossedUp = false; / Reset state register when crossed 3 bars ago / Check if there is a RSI cross down if (RSInow 50) & (RSICrossedDown = false) RSICrossedUp= false; RSICrossedDown = true; if (RSICrossedDown = true) RSICrossedDownTimer+; / Record the number of bars the cross has happened else RSICrossedDownTimer=0; / Reset the timer once the cross is reversed if (RSICrossedDownTimer=CrossEffectiveTime) RSICrossedDown = false; / Reset register when crossed 3 bars ago / Check if there is a EMA cross up if ( (fasterEMAnow slowerEMAnow) & (fasterEMAprevious =CrossEffectiveTime) EMACrossedUp = false; / Reset register when crossed 3 bars ago / Check if there is a EMA cross down if ( (fasterEMAnow slowerEMAprevious) & (EMACrossedDown = false) ) EMACrossedUp= false; EMACrossedDown = true; if (EMACrossedDown = true) EMACrossedDownTimer+; / Record the number of bars the cross has happened else EMACrossedDownTimer=0; / Reset the timer once the cross is reversed if (EMACrossedDownTimer=CrossEffectiveTime) EMACrossedDown = false; / Reset register when crossed 3 bars ago if (Close1VegasTunnelFast & Close1VegasTunnelSlow) & (Close2VegasTunnelFast | Close2VegasTunnelSlow) TunnelCrossedUp= true; TunnelCrossedDown = false; if (Close1VegasTunnelFast & Close1VegasTunnelFast | Close2VegasTunnelSlow) TunnelCrossedUp= false; TunnelCrossedDown = true; / * / Based on states, determine exit situations. / * total=OrdersTotal(); for(cnt=0;cnttotal;cnt+) OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()=(VegasTunnelSlow+TPLevel3*Point) if (OrderStopLoss()=(VegasTunnelSlow+TPLevel2*Point) VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderLots()1 & OrderOpenPrice()VegasTunnelSlow+(TPLevel2-12)*Point) OrderClose(OrderTicket(),TPLevel2Lots,Bid,3,Violet); /OrderModify(OrderTicket(),Ask,VegasPriceCrossedL+(TPLevel2-StopLossToFibo)*Point,OrderTakeProfit(),0); if (OrderStopLoss()=(VegasTunnelSlow+TPLevel1*Point) VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderLots()2 & OrderOpenPrice()VegasTunnelSlow+(TPLevel1-12)*Point) OrderClose(OrderTicket(),TPLevel1Lots,Bid,3,Violet); /OrderModify(OrderTicket(),Ask,VegasPriceCrossedL+(TPLevel1-StopLossToFibo)*Point,OrderTakeProfit(),0); if (OrderStopLoss()Bid-TrailingStop*Point) OrderModify(OrderTicket(),Ask,Bid-TrailingStop*Point,OrderTakeProfit(),0); continue; /Tunnel crossed, move stop to below the tunnel; VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderStopLoss()=(VegasTunnelSlow-TPLevel1*Point) VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderStopLoss()=(VegasTunnelSlow-TPLevel2*Point) VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderStopLoss()=(VegasTunnelSlow-TPLevel3*Point) VegasPriceCrossedL=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderStopLoss()VegasPriceCrossedL-(TPLevel3+StopLossToFibo)*Point) OrderModify(OrderTicket(),Ask,VegasPriceCrossedL-(TPLevel3+StopLossToFibo)*Point,OrderTakeProfit(),0); continue; else / Short Exits / When EMA or RSI crosses reverse, exit all lots if(EMACrossedUp = true) | (RSICrossedUp = true) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); continue; if(TunnelCrossedDown = true) if(AskAsk+TrailingStop*Point) OrderModify(OrderTicket(),Bid,Ask+TrailingStop*Point,OrderTakeProfit(),0); continue; / Reach 2nd TP level, close the 2nd lot, move up remainder stop to TPLevel2-StopLossToFibo / Or start trailing stop else if(Ask1 & OrderOpenPrice()VegasTunnelSlow-(TPLevel2-12)*Point) OrderClose(OrderTicket(),TPLevel2Lots,Ask,3,Violet); /OrderModify(OrderTicket(),Bid,VegasPriceCrossedS-(TPLevel2+StopLossToFibo)*Point,OrderTakeProfit(),0); if (OrderStopLoss()Ask+TrailingStop*Point) OrderModify(OrderTicket(),Bid,Ask+TrailingStop*Point,OrderTakeProfit(),0); continue; / Reach 2nd TP level, close the 2nd lot, move up remainder stop to TPLevel2-StopLossToFibo else if(Ask2 & OrderOpenPrice()VegasTunnelSlow-(TPLevel1-12)*Point) OrderClose(OrderTicket(),TPLevel1Lots,Ask,3,Violet); /OrderModify(OrderTicket(),Bid,VegasPriceCrossedS-(TPLevel1+StopLossToFibo)*Point,OrderTakeProfit(),0); if (OrderStopLoss()Ask+TrailingStop*Point) OrderModify(OrderTicket(),Bid,Ask+TrailingStop*Point,OrderTakeProfit(),0); continue; /Tunnel crossed, move stop to above the tunnel; VegasPriceCrossedS=(MathRound(10000*VegasTunnelSlow)/10000); if (OrderStopLoss()VegasPriceCrossedS+(TunnelBandWidth+StopLossToFibo)*Point) OrderModify(OrderTicket(),Bid,VegasPriceCrossedS+(TunnelBandWidth+StopLossToFibo)*Point,OrderTakeProfit(),0); continue; else if(AskVegasPriceCrossedS+(TPLevel1+StopLossToFibo)*Point) OrderModify(OrderTicket(),Bid,VegasPriceCrossedS+(TPLevel1+StopLossToFibo)*Point,OrderTakeProfit(),0); continue; / Reach 2nd TP level, close the 2nd lot, move up remainder stop to TPLevel2-StopLossT
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安顺市2025-2026学年七年级下学期语文期中测试试卷
- 安徽省滁州市南谯区2022-2023学年高三下学期高考二模化学考点及答案
- 2025教师教育实习总结
- 河南省新乡市红旗区2024-2025学年三年级上学期期末调研英语试卷
- 2024-2025学年山东省泰安市东平县青岛版(五年制)五年级下册期中测试数学试卷(含答案)
- 吊机购买合同范本
- 饰品订单合同范本
- 家具木工劳务合同范本
- 租客个人转租合同范本
- 策划意向金合同范本
- 中建材特种玻璃深加工一期工程项目环评报告
- T/GIEHA 013-2019商用厨房油烟管道系统清洗规范
- 团体标准解读及临床应用-成人经鼻高流量湿化氧疗技术规范2025
- DB34T 5137-2025电化学储能液冷系统设计技术要求
- 旧房拆除重建协议书
- 2025质量工程师笔试题库及答案
- 期货保密协议书
- 2025-2030年中国电力电容器行业市场经营管理及未来前景展望报告
- 中国儿童维生素A、维生素D临床应用专家共识(2024)解读课件
- 中医院医疗业务科室综合目标考核方案
- 船舶运输公司水上船舶运输安全应急预案
评论
0/150
提交评论