[MT4指标]MACD:双色、双线、报警的MT指标。
 //+------------------------------------------------------------------+
//|                                         MACD_ColorHist_Alert.mq4 |
//|                                    Copyright ?2006, Robert Hill |
//|                                                                  |
//+------------------------------------------------------------------+
#property  copyright "Copyright ?2006, Robert Hill"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Aqua
#property  indicator_color2  Red
#property  indicator_color3  Green
#property  indicator_color4  Red
//---- indicator parameters
extern bool SoundON=true;
extern bool EmailON=false;
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double     ind_buffer1;
double     ind_buffer2;
double HistogramBufferUp;
double HistogramBufferDown;
int flagval1 = 0;
int flagval2 = 0;
//---- variables
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
//   IndicatorBuffers(3);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(0,ind_buffer1);
   SetIndexDrawBegin(0,SlowEMA);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,ind_buffer2);
   SetIndexDrawBegin(1,SignalSMA);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexBuffer(2,HistogramBufferUp);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexBuffer(3,HistogramBufferDown);
//   SetIndexDrawBegin(2,SlowEMA + SignalSMA);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   SetIndexLabel(2,"Histogram");
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   double temp;
   
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i
//+------------------------------------------------------------------+
//|                                         MACD_ColorHist_Alert.mq4 |
//|                                    Copyright ?2006, Robert Hill |
//|                                                                  |
//+------------------------------------------------------------------+
#property  copyright "Copyright ?2006, Robert Hill"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Aqua
#property  indicator_color2  Red
#property  indicator_color3  Green
#property  indicator_color4  Red
//---- indicator parameters
extern bool SoundON=true;
extern bool EmailON=false;
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double     ind_buffer1;
double     ind_buffer2;
double HistogramBufferUp;
double HistogramBufferDown;
int flagval1 = 0;
int flagval2 = 0;
//---- variables
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
//   IndicatorBuffers(3);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(0,ind_buffer1);
   SetIndexDrawBegin(0,SlowEMA);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,ind_buffer2);
   SetIndexDrawBegin(1,SignalSMA);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexBuffer(2,HistogramBufferUp);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexBuffer(3,HistogramBufferDown);
//   SetIndexDrawBegin(2,SlowEMA + SignalSMA);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   SetIndexLabel(2,"Histogram");
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   double temp;
   
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i发表于:2006-10-08 01:46只看该作者
4楼 
非常感谢一直在找,真的谢谢你了!!!请问是关于MACD快线穿越慢线的警报吗?是自动的吗?谢谢
韬客社区www.talkfx.co
发表于:2006-10-09 06:19只看该作者
5楼 
风雨兄,这两天用你这个东西,怎么老是乱拉警报,一天的信号多得很,但是实际看了又不是,我没搞懂怎么会事,是还要设置什么吗?
韬客社区www.talkfx.co
发表于:2006-10-09 06:24只看该作者
6楼 
这个是MACD金叉死叉的警报吗?????还望你来指点一下
韬客社区www.talkfx.co
发表于:2006-10-09 07:35只看该作者
7楼 
非常感谢楼主!
发表于:2006-10-10 05:14只看该作者
8楼 
怎么引用,不懂。
韬客外汇论坛TALKFOREX.COM
9楼 
原帖由 linkey100 于 2006-10-9 14:19 发表 风雨兄,这两天用你这个东西,怎么老是乱拉警报,一天的信号多得很,但是实际看了又不是,我没搞懂怎么会事,是还要设置什么吗?
互相学习、促进交流、共同提高。
发表于:2006-10-10 11:52只看该作者
10楼 
报警是它的最主要特色,还可电邮报警
韬客社区www.talkfx.co
发表于:2006-10-11 02:48只看该作者
11楼 
不是嫌麻烦,只是没有搞懂他为什么要报警,我看他报警的提示往往看不出个所以然,我也不会编程,又看不懂。请问风雨兄你这指标报警的时候是什么条件满足了就报警呢?
韬客社区www.talkfx.co
发表于:2006-10-11 02:52只看该作者
12楼 
不好意思,我真的很想搞明白,请原谅我的愚钝!
韬客社区www.talkfx.co
13楼 
原帖由 linkey100 于 2006-10-11 10:48 发表 不是嫌麻烦,只是没有搞懂他为什么要报警,我看他报警的提示往往看不出个所以然,我也不会编程,又看不懂。请问风雨兄你这指标报警的时候是什么条件满足了就报警呢?
互相学习、促进交流、共同提高。
发表于:2006-10-11 03:09只看该作者
14楼 
我截了一张图来说明我的想法,希望风雨兄或者论坛其他的兄弟懂的也帮一帮嘛,独乐乐不如众乐乐,在此谢过了!!!!!!!!!!!! 截图.GIF
截图.GIF
 截图.GIF
截图.GIF韬客社区www.talkfx.co
发表于:2006-10-11 03:13只看该作者
15楼 
我不是想搞得非常明白,只是想这指标在MACD双线交叉的时候就立即报警!你说这个可以发到邮箱,我也不是太懂(这个我自己去找帖子看),还希望风雨兄不要怪我麻烦你,呵呵。
韬客社区www.talkfx.co
发表于:2006-10-11 04:05只看该作者
16楼 
60分钟的好象是比较怪
楼上,你的其他时段的是这样的吗
韬客社区www.talkfx.co
17楼 
等我先看看是怎么回事儿。
在有结果之前,请按照我前面说的,把它的报警先禁止掉。
互相学习、促进交流、共同提高。
发表于:2006-10-12 05:27只看该作者
18楼 
原帖由 风雨无阻 于 2006-10-11 17:55 发表 等我先看看是怎么回事儿。 在有结果之前,请按照我前面说的,把它的报警先禁止掉。
韬客社区www.talkfx.co
发表于:2006-10-17 03:54只看该作者
20楼 
热切盼望风雨兄的改进,我对你表示十万分的感谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
韬客社区www.talkfx.co



































