MT4编程请进!
以下是秃鹫老师的一个均线交叉指标,能否恳请懂编程的加上发送Email功能?最好是当均线形成交叉时的下一个K线开盘时发!谢谢!
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Lime
#property indicator_color4 Red
extern int EMA1=10;
extern int EMA2=20;
extern bool AlertOn = FALSE;
double upBuffer;
double dnBuffer;
double line1;
double line2;
datetime preTime=0;
void init() {
SetIndexBuffer(0,line1);
SetIndexBuffer(1,line2);
SetIndexBuffer(2,upBuffer);
SetIndexBuffer(3,dnBuffer);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(2,217);
SetIndexArrow(3,218);
}
bool up(int t){
if(line1[t]>line2[t])
return(true);
else return(false);
}
bool dn(int t){
if(line1[t]0) counted_bars--;
limit=Bars-counted_bars;
for(int t=0; tpreTime ) {
if(upBuffer[0]>0) {Alert(Symbol(),Period(),"均线上交"); preTime=Time[0];}
if(dnBuffer[0]>0) {Alert(Symbol(),Period(),"均线下交"); preTime=Time[0];}
}
}
}