/*
   Generated by EX4-TO-MQ4 decompiler V4.0.220.2 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "atfxtrader"
#property link      ""

#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 gi_76 = 34;
double gda_80[];
double gda_84[];
double gda_88[];
double gda_92[];
double gda_96[];
double gda_100[];
double gda_104[];
double gda_108[];

void init() {
   SetIndexBuffer(0, gda_80);
   SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 3, LawnGreen);
   SetIndexBuffer(1, gda_84);
   SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 3, LimeGreen);
   SetIndexBuffer(2, gda_88);
   SetIndexStyle(2, DRAW_HISTOGRAM, EMPTY, 3, DarkGreen);
   SetIndexBuffer(3, gda_92);
   SetIndexStyle(3, DRAW_HISTOGRAM, EMPTY, 3, Aqua);
   SetIndexBuffer(4, gda_96);
   SetIndexStyle(4, DRAW_HISTOGRAM, EMPTY, 3, Gold);
   SetIndexBuffer(5, gda_100);
   SetIndexStyle(5, DRAW_HISTOGRAM, EMPTY, 3, Orange);
   SetIndexBuffer(6, gda_104);
   SetIndexStyle(6, DRAW_HISTOGRAM, EMPTY, 3, OrangeRed);
   SetIndexBuffer(7, gda_108);
   SetIndexStyle(7, DRAW_HISTOGRAM, EMPTY, 3, SaddleBrown);
}

int start() {
   int li_8;
   double ld_12;
   string ls_20;
   string ls_28;
   double ld_36;
   int li_4 = IndicatorCounted();
   if (li_4 < 0) return/*(WARN)*/;
   if (li_4 > 0) li_4--;
   li_4 = Bars - li_4;
   for (int li_0 = 0; li_0 < li_4; li_0++) {
      ls_28 = TimeToStr(Time[li_0], TIME_MINUTES);
      gda_80[li_0] = 0;
      gda_84[li_0] = 0;
      gda_88[li_0] = 0;
      gda_92[li_0] = 0;
      gda_96[li_0] = 0;
      gda_100[li_0] = 0;
      gda_104[li_0] = 0;
      gda_108[li_0] = 0;
      ld_36 = iMA(NULL, 0, gi_76, 0, MODE_EMA, PRICE_TYPICAL, li_0);
      if (Close[li_0] >= ld_36) {
         ld_12 = Close[li_0] - ld_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) gda_80[li_0] = 1;
         else {
            if (ld_12 < 0.0003) gda_84[li_0] = 1;
            else {
               if (ld_12 < 0.0004) gda_88[li_0] = 1;
               else
                  if (ld_12 >= 0.0004) gda_92[li_0] = 1;
            }
         }
      } else {
         if (Close[li_0] < ld_36) {
            ld_12 = ld_36 - Close[li_0];
            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) gda_96[li_0] = 1;
            else {
               if (ld_12 < 0.0003) gda_100[li_0] = 1;
               else {
                  if (ld_12 < 0.0004) gda_104[li_0] = 1;
                  else
                     if (ld_12 >= 0.0004) gda_108[li_0] = 1;
               }
            }
         }
      }
   }
   return (0);
}
