论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1527回复:13
草龙
注册时间2004-12-17
[MT4-EA]2008-BUY-SELL-EA研究
楼主发表于:2014-01-03 07:05只看该作者倒序浏览
1楼 电梯直达
电梯直达
2008年的一个ea指标 学习者可以拿去做下研究///+-----------------------------------------------------------------+ //| Original idea from: BUY-SELL STOP.mq4 | //| Copyright 2008, Guillermo Arango | //| [email protected] | //+------------------------------------------------------------------+ #property copyright "Copyright 2008, Rob Turcotte" #property link "[email protected]" #property show_inputs extern int Level = 10; extern double Lots = 0.1; extern int TakeProfit=140; extern bool Place_buylimit = true; extern bool Place_selllimit = true; extern int GridSpacing=35; extern double GridUpperLimit=0; extern double GridLowerLimit=0; extern double StartPoint= 202.45; extern double MagicNum = 1001; int totalOpenOrders = 0; bool OpenOrders = false; int total, cnt, totalBuyStop, totalSellStop, totalBuy, totalSell, TSS, TBS; double spread; //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //----Establish if Stop Order filled total = OrdersTotal(); totalBuyStop = 0; totalSellStop = 0; totalSell = 0; totalBuy = 0; for(cnt = 0; cnt < total; cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNum) { if(OrderType() == OP_BUYSTOP) totalBuyStop++; if(OrderType() == OP_BUY) totalBuy++; } } for(cnt = 0; cnt < total; cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNum) { if(OrderType() == OP_SELLSTOP) totalSellStop++; if(OrderType() == OP_SELL) totalSell++; } } TSS = totalSellStop; TBS = totalBuyStop; Comment("TSS=", TSS, " TBS=", TBS); if(totalOpenOrders < (totalBuy + totalSell)) // Order just opened, open more pending orders { totalOpenOrders = totalBuy + totalSell; OpenPendingOrders(); } if(totalOpenOrders > 0) OpenOrders = true; if(OpenOrders == true && (totalBuy + totalSell) == 0) // all orders closed, close pending orders { ClosePendingOrders(); totalOpenOrders = 0; } if(totalBuyStop == 0 && totalSellStop == 0) //no open orders or pending orders, start cycle again { StartPoint = Ask; OpenPendingOrders(); } return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| script "send pending order with expiration data" | //+------------------------------------------------------------------+ int OpenPendingOrders() { int ticket; double CurrentLevel=0.00; double point; int TakeProfit1=TakeProfit; double StartPoint1=StartPoint; double GridUpperLimit= StartPoint1 + ((TakeProfit1+8)*Point); double GridLowerLimit= StartPoint1 - (TakeProfit1*Point); //---- spread = MarketInfo(Symbol(), MODE_SPREAD); point=MarketInfo(Symbol(),MODE_POINT); int total; total=OrdersTotal(); //---- CurrentLevel = GridLowerLimit; while(CurrentLevel < GridUpperLimit) while(true) { if (Place_selllimit) if(CurrentLevel < (Bid - (Point * Level))) ticket=OrderSend(Symbol(),OP_SELLSTOP,Lots,CurrentLevel,0,GridUpperLimit,GridLowerLimit+(spread*Point),"SELLSTOP",MagicNum,0,Red); if (Place_buylimit) if(CurrentLevel > (Ask + (Point * Level)) && CurrentLevel < (Ask + (Point * TakeProfit))) //ONLY BUY ABOVE ASK PRICE ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,CurrentLevel,0,GridLowerLimit,GridUpperLimit-(spread*Point),"BUYSTOP",MagicNum,0,Green); CurrentLevel = CurrentLevel + (GridSpacing * Point); if(CurrentLevel > GridUpperLimit) break; } //---- return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ // Close Pending Orders int ClosePendingOrders() { int total = OrdersTotal(); for(int i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNum) { switch(type) { //Close pending orders case OP_BUYLIMIT : case OP_BUYSTOP : case OP_SELLLIMIT : case OP_SELLSTOP : result = OrderDelete( OrderTicket() ); } OpenOrders = false; if(result == false) { Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() ); Sleep(3000); } } } return(0); }
TK29帖子1楼右侧xm竖版广告90-240
个性签名

阅尽天下指标
搬砖开始,始于2014

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
dafubin
注册时间2014-12-03
rfvedc
注册时间2014-12-26
yimose
注册时间2015-09-25
发表于:2015-11-15 12:53只看该作者
4楼
感谢楼主分享
creatlivefr
注册时间2015-12-02
philaychia
注册时间2015-12-07
发表于:2015-12-11 18:02只看该作者
6楼
不错的指标 ~谢谢楼主~ ,,,,,,,,,,,
philaychia
注册时间2015-12-07
jesseck
注册时间2015-09-04
发表于:2015-12-13 13:51只看该作者
8楼
看看。。。。。。。。。。。。。。。。
ningwutao
注册时间2016-01-29
hhggcc
注册时间2016-04-10
发表于:2016-06-17 12:54只看该作者
10楼
444444444444444444444444444444444444444444444444444
个性签名

韬客社区www.talkfx.co

haichong
注册时间2016-08-08
发表于:2016-08-09 15:18只看该作者
12楼
回复下载
pensh
注册时间2016-07-24
发表于:2016-08-14 12:59只看该作者
13楼
谢谢分享~
Pzxzx
注册时间2017-08-06
发表于:2017-08-08 23:28只看该作者
14楼
缺钱,灌水赚通宝,谢谢分享!!

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]