20评论

3收藏

MT4副图指标 CZI

avatar 老王吧 | 4085 人阅读 | 20 人评论 | 2017-12-27

CZI指标根据均线和收盘价在副图创建柱状线,不同颜色代表不同的行情。

USDJPYM30.png

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

  8. #property indicator_separate_window
  9. #property indicator_buffers 8
  10. #property indicator_color1 Black
  11. #property indicator_color2 Black
  12. #property indicator_color3 Black
  13. #property indicator_color4 Black
  14. #property indicator_color5 Black
  15. #property indicator_color6 Black
  16. #property indicator_color7 Black
  17. #property indicator_color8 Black

  18. int g_period_76 = 34;
  19. double g_ibuf_80[];
  20. double g_ibuf_84[];
  21. double g_ibuf_88[];
  22. double g_ibuf_92[];
  23. double g_ibuf_96[];
  24. double g_ibuf_100[];
  25. double g_ibuf_104[];
  26. double g_ibuf_108[];

  27. void OnInit(void)
  28.   {
  29.    SetIndexBuffer(0, g_ibuf_80);
  30.    SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 3, LawnGreen);
  31.    SetIndexBuffer(1, g_ibuf_84);
  32.    SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 3, LimeGreen);
  33.    SetIndexBuffer(2, g_ibuf_88);
  34.    SetIndexStyle(2, DRAW_HISTOGRAM, EMPTY, 3, DarkGreen);
  35.    SetIndexBuffer(3, g_ibuf_92);
  36.    SetIndexStyle(3, DRAW_HISTOGRAM, EMPTY, 3, Aqua);
  37.    SetIndexBuffer(4, g_ibuf_96);
  38.    SetIndexStyle(4, DRAW_HISTOGRAM, EMPTY, 3, Gold);
  39.    SetIndexBuffer(5, g_ibuf_100);
  40.    SetIndexStyle(5, DRAW_HISTOGRAM, EMPTY, 3, Orange);
  41.    SetIndexBuffer(6, g_ibuf_104);
  42.    SetIndexStyle(6, DRAW_HISTOGRAM, EMPTY, 3, OrangeRed);
  43.    SetIndexBuffer(7, g_ibuf_108);
  44.    SetIndexStyle(7, DRAW_HISTOGRAM, EMPTY, 3, SaddleBrown);
  45. }

  46. int OnCalculate(const int rates_total,
  47.                 const int prev_calculated,
  48.                 const datetime &time[],
  49.                 const double &open[],
  50.                 const double &high[],
  51.                 const double &low[],
  52.                 const double &close[],
  53.                 const long &tick_volume[],
  54.                 const long &volume[],
  55.                 const int &spread[])
  56.   {
  57.    int li_8;
  58.    double ld_12;
  59.    string ls_20;
  60.    string ls_unused_28;
  61.    double l_ima_36;
  62.    int li_4 = IndicatorCounted();
  63.    if (li_4 < 0) return(0);
  64.    if (li_4 > 0) li_4--;
  65.    li_4 = Bars - li_4;
  66.    for (int li_0 = 0; li_0 < li_4; li_0++) {
  67.       ls_unused_28 = TimeToStr(Time[li_0], TIME_MINUTES);
  68.       g_ibuf_80[li_0] = 0;
  69.       g_ibuf_84[li_0] = 0;
  70.       g_ibuf_88[li_0] = 0;
  71.       g_ibuf_92[li_0] = 0;
  72.       g_ibuf_96[li_0] = 0;
  73.       g_ibuf_100[li_0] = 0;
  74.       g_ibuf_104[li_0] = 0;
  75.       g_ibuf_108[li_0] = 0;
  76.       l_ima_36 = iMA(NULL, 0, g_period_76, 0, MODE_EMA, PRICE_TYPICAL, li_0);
  77.       if (Close[li_0] >= l_ima_36) {
  78.          ld_12 = Close[li_0] - l_ima_36;
  79.          li_8 = StringFind(Symbol(), "JPY", 0);
  80.          ls_20 = StringSubstr(Symbol(), li_8, 3);
  81.          if (ls_20 == "JPY") ld_12 /= 100.0;
  82.          if (ld_12 < 0.0002) g_ibuf_80[li_0] = 1;
  83.          else {
  84.             if (ld_12 < 0.0003) g_ibuf_84[li_0] = 1;
  85.             else {
  86.                if (ld_12 < 0.0004) g_ibuf_88[li_0] = 1;
  87.                else
  88.                   if (ld_12 >= 0.0004) g_ibuf_92[li_0] = 1;
  89.             }
  90.          }
  91.       } else {
  92.          if (Close[li_0] < l_ima_36) {
  93.             ld_12 = l_ima_36 - Close[li_0];
  94.             li_8 = StringFind(Symbol(), "JPY", 0);
  95.             ls_20 = StringSubstr(Symbol(), li_8, 3);
  96.             if (ls_20 == "JPY") ld_12 /= 100.0;
  97.             if (ld_12 < 0.0002) g_ibuf_96[li_0] = 1;
  98.             else {
  99.                if (ld_12 < 0.0003) g_ibuf_100[li_0] = 1;
  100.                else {
  101.                   if (ld_12 < 0.0004) g_ibuf_104[li_0] = 1;
  102.                   else
  103.                      if (ld_12 >= 0.0004) g_ibuf_108[li_0] = 1;
  104.                }
  105.             }
  106.          }
  107.       }
  108.    }
  109.    return (rates_total);
  110. }
复制代码


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

评论|共 20 个

935284259

发表于 2020-1-23 14:21:37 | 显示全部楼层

前排支持下

也简单快乐

发表于 2020-3-29 19:27:44 | 显示全部楼层

支持一下:lol

战狼之家

发表于 2020-5-11 12:35:38 | 显示全部楼层

沙发!沙发!

微不足道

发表于 2020-6-9 16:08:11 | 显示全部楼层

我是个凑数的。。。

小小

发表于 2020-6-18 10:41:56 | 显示全部楼层

我是个凑数的。。。

繁华落幕

发表于 2020-7-6 19:12:59 | 显示全部楼层

学习了,不错

caoer

发表于 2020-7-14 19:47:58 | 显示全部楼层

谢谢楼主分享

曾祥平

发表于 2020-8-22 13:46:33 | 显示全部楼层

帮你顶下哈!!

故乡

发表于 2020-8-28 16:32:16 | 显示全部楼层

帮你顶下哈!!

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

EA之家评论守则