1赞

12评论

15收藏

Heiken_Ashi_Smoothed1lime

 

avatar 360 | 5233 人阅读 | 12 人评论 | 2018-03-12

QQ截图20180312165214.png

  1. //+------------------------------------------------------------------+
  2. //|                                         Heiken Ashi Smoothed.mq4 |
  3. //|                                                                  |
  4. //|                                                      mod by Raff |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright ?2006, Forex-TSD.com "
  7. #property link      "http://www.forex-tsd.com/"
  8. //----
  9. #property indicator_chart_window
  10. #property indicator_buffers 4
  11. #property indicator_color1 Black
  12. #property indicator_color2 Black
  13. #property indicator_color3 White
  14. #property indicator_color4 Lime
  15. //---- parameters
  16. extern int MaMetod =2;
  17. extern int MaPeriod=6;
  18. extern int MaMetod2 =3;
  19. extern int MaPeriod2=2;
  20. //---- buffers
  21. double ExtMapBuffer1[];
  22. double ExtMapBuffer2[];
  23. double ExtMapBuffer3[];
  24. double ExtMapBuffer4[];
  25. double ExtMapBuffer5[];
  26. double ExtMapBuffer6[];
  27. double ExtMapBuffer7[];
  28. double ExtMapBuffer8[];
  29. //----
  30. int ExtCountedBars=0;
  31. //+------------------------------------------------------------------+
  32. //| Custom indicator initialization function                         |
  33. //|------------------------------------------------------------------|
  34. int init()
  35.   {
  36. //---- indicators
  37.    IndicatorBuffers(8);
  38.    SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Black);
  39.    SetIndexBuffer(0, ExtMapBuffer1);
  40.    SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, Black);
  41.    SetIndexBuffer(1, ExtMapBuffer2);
  42.    SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, White);
  43.    SetIndexBuffer(2, ExtMapBuffer3);
  44.    SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, Lime);
  45.    SetIndexBuffer(3, ExtMapBuffer4);
  46. //----
  47.    SetIndexDrawBegin(0,5);
  48. //---- indicator buffers mapping
  49.    SetIndexBuffer(0,ExtMapBuffer1);
  50.    SetIndexBuffer(1,ExtMapBuffer2);
  51.    SetIndexBuffer(2,ExtMapBuffer3);
  52.    SetIndexBuffer(3,ExtMapBuffer4);
  53.    SetIndexBuffer(4,ExtMapBuffer5);
  54.    SetIndexBuffer(5,ExtMapBuffer6);
  55.    SetIndexBuffer(6,ExtMapBuffer7);
  56.    SetIndexBuffer(7,ExtMapBuffer8);
  57. //---- initialization done
  58.    return(0);
  59.   }
  60. //+------------------------------------------------------------------+
  61. //| Custor indicator deinitialization function                       |
  62. //+------------------------------------------------------------------+
  63. int deinit()
  64.   {
  65. //---- TODO: add your code here
  66. //----
  67.    return(0);
  68.   }
  69. //+------------------------------------------------------------------+
  70. //| Custom indicator iteration function                              |
  71. //+------------------------------------------------------------------+
  72. int start()
  73.   {
  74.    double maOpen, maClose, maLow, maHigh;
  75.    double haOpen, haHigh, haLow, haClose;
  76.    if(Bars<=10) return(0);
  77.    ExtCountedBars=IndicatorCounted();
  78. //---- check for possible errors
  79.    if (ExtCountedBars<0) return(-1);
  80. //---- last counted bar will be recounted
  81.    if (ExtCountedBars>0) ExtCountedBars--;
  82.    int pos=Bars-ExtCountedBars-1;
  83.    while(pos>=0)
  84.      {
  85.       maOpen=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_OPEN,pos);
  86.       maClose=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_CLOSE,pos);
  87.       maLow=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_LOW,pos);
  88.       maHigh=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_HIGH,pos);
  89. //----
  90.       haOpen=(ExtMapBuffer5[pos+1]+ExtMapBuffer6[pos+1])/2;
  91.       haClose=(maOpen+maHigh+maLow+maClose)/4;
  92.       haHigh=MathMax(maHigh, MathMax(haOpen, haClose));
  93.       haLow=MathMin(maLow, MathMin(haOpen, haClose));
  94.       if (haOpen<haClose)
  95.         {
  96.          ExtMapBuffer7[pos]=haLow;
  97.          ExtMapBuffer8[pos]=haHigh;
  98.         }
  99.       else
  100.         {
  101.          ExtMapBuffer7[pos]=haHigh;
  102.          ExtMapBuffer8[pos]=haLow;
  103.         }
  104.       ExtMapBuffer5[pos]=haOpen;
  105.       ExtMapBuffer6[pos]=haClose;
  106.       pos--;
  107.      }
  108.    int i;
  109.    for(i=0; i<Bars; i++) ExtMapBuffer1[i]=iMAOnArray(ExtMapBuffer7,Bars,MaPeriod2,0,MaMetod2,i);
  110.    for(i=0; i<Bars; i++) ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer8,Bars,MaPeriod2,0,MaMetod2,i);
  111.    for(i=0; i<Bars; i++) ExtMapBuffer3[i]=iMAOnArray(ExtMapBuffer5,Bars,MaPeriod2,0,MaMetod2,i);
  112.    for(i=0; i<Bars; i++) ExtMapBuffer4[i]=iMAOnArray(ExtMapBuffer6,Bars,MaPeriod2,0,MaMetod2,i);
  113. //----
  114.    return(0);
  115.   }
  116. //+------------------------------------------------------------------+
复制代码


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

评论|共 12 个

粉丝的粉丝

发表于 2018-8-6 22:54:29 | 显示全部楼层

不让下载   真恶心

qq堂

发表于 2018-9-23 12:46:11 | 显示全部楼层

相当不错,感谢无私分享精神!

金刚石

发表于 2019-7-4 17:47:45 | 显示全部楼层

相当不错,感谢无私分享精神!

找回心中的自己

发表于 2019-10-12 12:35:13 | 显示全部楼层

这个可以,谢谢

milkyway

发表于 2020-7-9 10:00:24 | 显示全部楼层

帮你顶下哈!!

金凝钰银

发表于 2020-7-11 12:29:34 | 显示全部楼层

谢谢楼主分享

zzetcw

发表于 2020-7-20 10:00:09 | 显示全部楼层

帮你顶下哈!!

wtwt328

发表于 2020-9-7 22:19:17 | 显示全部楼层

学习了,不错

oldai

发表于 2020-11-22 20:31:20 | 显示全部楼层

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

EA之家评论守则