9评论

4收藏

MACD_EMA

avatar 老王吧 | 3524 人阅读 | 9 人评论 | 2017-12-27

EURGBPM30.png

  1. //+------------------------------------------------------------------+
  2. //|                                                     MACD_EMA.mq4 |
  3. //|                                     Copyright @2006, Robert Hill |
  4. //+------------------------------------------------------------------+
  5. #property copyright "下载更多外汇EA,外汇指标,交易系统,就到【外汇EA之家】"
  6. #property link      "http://www.eazhijia.com"

  7. #property  indicator_separate_window
  8. #property  indicator_buffers 4
  9. #property  indicator_color1  Aqua
  10. #property  indicator_color2  Red
  11. #property  indicator_color3  Green
  12. #property  indicator_color4  Red
  13. #property  indicator_level1  0

  14. extern int FastEMA=12;
  15. extern int SlowEMA=26;
  16. extern int SignalSMA=9;

  17. double     ind_buffer1[];
  18. double     ind_buffer2[];
  19. double HistogramBufferUp[];
  20. double HistogramBufferDown[];
  21. int flagval1 = 0;
  22. int flagval2 = 0;
  23. //+------------------------------------------------------------------+
  24. //| Custom indicator initialization function                         |
  25. //+------------------------------------------------------------------+
  26. int init()
  27.   {
  28.    IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
  29.    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
  30.    SetIndexBuffer(0,ind_buffer1);
  31.    SetIndexDrawBegin(0,SlowEMA);
  32.    SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
  33.    SetIndexBuffer(1,ind_buffer2);
  34.    SetIndexDrawBegin(1,SignalSMA);
  35.    SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
  36.    SetIndexBuffer(2,HistogramBufferUp);
  37.    SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
  38.    SetIndexBuffer(3,HistogramBufferDown);
  39.    IndicatorShortName("MACD-EMA("+FastEMA+","+SlowEMA+","+SignalSMA+")");
  40.    SetIndexLabel(0,"MACD");
  41.    SetIndexLabel(1,"Signal");
  42.    SetIndexLabel(2,"Histogram");
  43.    Comment("www.eazhijia.com");
  44.    return(0);
  45.   }
  46. //+------------------------------------------------------------------+
  47. //| Moving Averages Convergence/Divergence                           |
  48. //+------------------------------------------------------------------+
  49. int start(){
  50.    int limit;
  51.    double temp;
  52.    int counted_bars=IndicatorCounted();
  53.    if(counted_bars<0) return(-1);
  54.    if(counted_bars>0) counted_bars--;
  55.    limit=Bars-counted_bars;
  56.    for(int i=0; i<limit; i++)
  57.       ind_buffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
  58.    for(i=0; i<limit; i++)
  59.       ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,SignalSMA,0,MODE_EMA,i);
  60.    for(i=0; i<limit; i++)
  61.    {
  62.       HistogramBufferUp[i] = 0;
  63.       HistogramBufferDown[i] = 0;
  64.       temp = ind_buffer1[i] - ind_buffer2[i];
  65.       if (temp >= 0)
  66.         HistogramBufferUp[i] = temp;
  67.       else
  68.         HistogramBufferDown[i] = temp;
  69.    }
  70.    return(0);
  71.   }
复制代码


MACD_EMA.mq4
""
还没有人打赏,支持一下

评论|共 9 个

素颜。

发表于 2018-9-12 15:21:49 | 显示全部楼层

不错不错,楼主您辛苦了。。。

无念法师

发表于 2018-10-16 21:51:47 | 显示全部楼层

正需要这个,谢谢大神

jaryk

发表于 2019-3-7 23:09:34 | 显示全部楼层

好东西。谢谢

背离赤道

发表于 2020-6-14 15:35:20 | 显示全部楼层

难得一见的好帖

齐心共赢

发表于 2020-7-24 15:36:51 | 显示全部楼层

谢谢楼主分享

sibinwave

发表于 2020-8-23 15:00:23 | 显示全部楼层

谢谢楼主分享

带你学外汇

发表于 2020-9-4 10:47:29 | 显示全部楼层

帮你顶下哈!!

lf880

发表于 2021-7-23 10:36:48 | 显示全部楼层

支持下

鑫鑫

发表于 2021-7-30 21:31:03 | 显示全部楼层

您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则