老王吧 发表于 2017-12-27 11:46:32

MT4副图指标 CZI

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



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

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Black
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black

int g_period_76 = 34;
double g_ibuf_80[];
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
double g_ibuf_108[];

void OnInit(void)
{
   SetIndexBuffer(0, g_ibuf_80);
   SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 3, LawnGreen);
   SetIndexBuffer(1, g_ibuf_84);
   SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 3, LimeGreen);
   SetIndexBuffer(2, g_ibuf_88);
   SetIndexStyle(2, DRAW_HISTOGRAM, EMPTY, 3, DarkGreen);
   SetIndexBuffer(3, g_ibuf_92);
   SetIndexStyle(3, DRAW_HISTOGRAM, EMPTY, 3, Aqua);
   SetIndexBuffer(4, g_ibuf_96);
   SetIndexStyle(4, DRAW_HISTOGRAM, EMPTY, 3, Gold);
   SetIndexBuffer(5, g_ibuf_100);
   SetIndexStyle(5, DRAW_HISTOGRAM, EMPTY, 3, Orange);
   SetIndexBuffer(6, g_ibuf_104);
   SetIndexStyle(6, DRAW_HISTOGRAM, EMPTY, 3, OrangeRed);
   SetIndexBuffer(7, g_ibuf_108);
   SetIndexStyle(7, DRAW_HISTOGRAM, EMPTY, 3, SaddleBrown);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   int li_8;
   double ld_12;
   string ls_20;
   string ls_unused_28;
   double l_ima_36;
   int li_4 = IndicatorCounted();
   if (li_4 < 0) return(0);
   if (li_4 > 0) li_4--;
   li_4 = Bars - li_4;
   for (int li_0 = 0; li_0 < li_4; li_0++) {
      ls_unused_28 = TimeToStr(Time, TIME_MINUTES);
      g_ibuf_80 = 0;
      g_ibuf_84 = 0;
      g_ibuf_88 = 0;
      g_ibuf_92 = 0;
      g_ibuf_96 = 0;
      g_ibuf_100 = 0;
      g_ibuf_104 = 0;
      g_ibuf_108 = 0;
      l_ima_36 = iMA(NULL, 0, g_period_76, 0, MODE_EMA, PRICE_TYPICAL, li_0);
      if (Close >= l_ima_36) {
         ld_12 = Close - l_ima_36;
         li_8 = StringFind(Symbol(), "JPY", 0);
         ls_20 = StringSubstr(Symbol(), li_8, 3);
         if (ls_20 == "JPY") ld_12 /= 100.0;
         if (ld_12 < 0.0002) g_ibuf_80 = 1;
         else {
            if (ld_12 < 0.0003) g_ibuf_84 = 1;
            else {
               if (ld_12 < 0.0004) g_ibuf_88 = 1;
               else
                  if (ld_12 >= 0.0004) g_ibuf_92 = 1;
            }
         }
      } else {
         if (Close < l_ima_36) {
            ld_12 = l_ima_36 - Close;
            li_8 = StringFind(Symbol(), "JPY", 0);
            ls_20 = StringSubstr(Symbol(), li_8, 3);
            if (ls_20 == "JPY") ld_12 /= 100.0;
            if (ld_12 < 0.0002) g_ibuf_96 = 1;
            else {
               if (ld_12 < 0.0003) g_ibuf_100 = 1;
               else {
                  if (ld_12 < 0.0004) g_ibuf_104 = 1;
                  else
                     if (ld_12 >= 0.0004) g_ibuf_108 = 1;
               }
            }
         }
      }
   }
   return (rates_total);
}


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

帮你顶下哈!!
页: [1] 2 3
查看完整版本: MT4副图指标 CZI