/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website: Htt p: //W W W . m E tAQuoTE s. n eT
   E-mail :  S U p p o RT@ M E t a q UO t E S. NE t
*/

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLime
#property indicator_color2 clrLime

int Gi_76 = 10;
int G_timeframe_80 = PERIOD_H4;
double G_ibuf_84[];
double G_ibuf_88[];
datetime Gia_92[];

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 228);
   SetIndexBuffer(0, G_ibuf_84);
   SetIndexEmptyValue(0, 0.0);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 230);
   SetIndexBuffer(1, G_ibuf_88);
   SetIndexEmptyValue(1, 0.0);
   if (Period() > G_timeframe_80) {
      Alert("Signal in Bamsbung-Trend2 ", G_timeframe_80);
      return (0);
   }
   ArrayCopySeries(Gia_92, 5, Symbol(), G_timeframe_80);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int count_0;
   double icustom_4;
   //string Ls_12 = "2014.03.25";
   //int str2time_20 = StrToTime(Ls_12);
   //if (TimeCurrent() >= str2time_20) {
   //   Alert(" Sory indicator #Bamsbung trend2 Expired Please contact www.bamsbung.com ");
   //   return (0);
   //}
   int Li_24 = IndicatorCounted();
   int Li_28 = 300;
   if (Li_24 < 0) return (-1);
   if (Li_24 > 0) Li_24--;
   Li_28 = Bars - Li_24;
   for (int index_32 = 0; index_32 < Li_28; index_32++) {
      if (Time[index_32] >= Gia_92[0]) count_0 = 0;
      else {
         count_0 = ArrayBsearch(Gia_92, Time[index_32 - 1], WHOLE_ARRAY, 0, MODE_DESCEND);
         if (Period() <= G_timeframe_80) count_0++;
      }
      for (int Li_36 = count_0; Li_36 < count_0 + 100; Li_36++) {
         icustom_4 = iCustom(NULL, G_timeframe_80, "ZigZag", Gi_76, 5, 3, 0, Li_36 + 1);
         if (icustom_4 != 0.0) break;
      }
      if (iClose(NULL, 0, index_32 + 1) <= icustom_4) G_ibuf_88[index_32] = icustom_4;
      else G_ibuf_88[index_32] = 0.0;
      if (iClose(NULL, 0, index_32 + 1) >= icustom_4) G_ibuf_84[index_32] = icustom_4;
      else G_ibuf_84[index_32] = 0.0;
      WindowRedraw();
   }
   return (0);
}
