论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:861回复:0
草龙
注册时间2004-12-17
[MT4指标]ADX Crossing交叉邮件提醒
楼主发表于:2014-01-09 08:33只看该作者倒序浏览
1楼 电梯直达
电梯直达
交叉后使用邮件提醒 //+------------------------------------------------------------------+ //| ADX Crossing.mq4 //| Amir //| Modified to give alert and send email by MrPip //+------------------------------------------------------------------+ #property copyright "Author - Amir" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red //---- input parameters extern int ADXbars=14; extern int CountBars=350; extern bool SoundON=true; extern bool EmailON=false; //---- buffers double val1; double val2; int flagval1 = 0; int flagval2 = 0; double b4plusdi,nowplusdi,b4minusdi,nowminusdi; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line IndicatorBuffers(2); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,108); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,108); SetIndexBuffer(0,val1); SetIndexBuffer(1,val2); GlobalVariableSet("AlertTime"+Symbol()+Period(),CurTime()); GlobalVariableSet("SignalType"+Symbol()+Period(),OP_SELLSTOP); // GlobalVariableSet("LastAlert"+Symbol()+Period(),0); //---- return(0); } int deinit() { GlobalVariableDel("AlertTime"+Symbol()+Period()); GlobalVariableDel("SignalType"+Symbol()+Period()); // GlobalVariableDel("LastAlert"+Symbol()+Period()); return(0); } //+------------------------------------------------------------------+ //| ADX Crossing | //+------------------------------------------------------------------+ int start() { double tmp=0; if (CountBars>=Bars) CountBars=Bars; if (CountBars>=1000) CountBars=950; SetIndexDrawBegin(0,Bars-CountBars + 12); SetIndexDrawBegin(1,Bars-CountBars + 12); int i,shift,counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- initial zero if(counted_bars<1) { for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0; for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0; } for (shift = CountBars; shift>=0; shift--) { b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift-1); nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift); b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift-1); nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift); if (b4plusdi>b4minusdi && nowplusdinowminusdi) { if (shift == 1 && flagval2==0) { flagval2=1; flagval1=0; } val2[shift]=High[shift]+5*Point; } } if (flagval1==1 && CurTime() > GlobalVariableGet("AlertTime"+Symbol()+Period()) && GlobalVariableGet("SignalType"+Symbol()+Period())!=OP_BUY) { // Print("Last Alert before BUY = ",GlobalVariableGet("LastAlert"+Symbol()+Period())); // if (GlobalVariableGet("LastAlert"+Symbol()+Period()) < 0.5) // { if (SoundON) Alert("BUY signal at Ask=",Ask,", Bid=",Bid,", Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period()); if (EmailON) SendMail("BUY signal alert","BUY signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period()); // } tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60; GlobalVariableSet("AlertTime"+Symbol()+Period(),tmp); GlobalVariableSet("SignalType"+Symbol()+Period(),OP_SELL); // GlobalVariableSet("LastAlert"+Symbol()+Period(),1); } if (flagval2==1 && CurTime() > GlobalVariableGet("AlertTime"+Symbol()+Period()) && GlobalVariableGet("SignalType"+Symbol()+Period())!=OP_SELL) { // Print("Last Alert before SELL = ",GlobalVariableGet("LastAlert"+Symbol()+Period())); // if (GlobalVariableGet("LastAlert"+Symbol()+Period()) > -0.5) // { if (SoundON) Alert("SELL signal at Ask=",Ask,", Bid=",Bid,", Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period()); if (EmailON) SendMail("SELL signal alert","SELL signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period()); // } tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60; GlobalVariableSet("AlertTime"+Symbol()+Period(),tmp); GlobalVariableSet("SignalType"+Symbol()+Period(),OP_BUY); // GlobalVariableSet("LastAlert"+Symbol()+Period(),-1); } return(0); } //+------------------------------------------------------------------+ADX%20Crossing_alarm.jpgADX%20Crossing_alarm.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

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

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

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

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

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

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