/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  h T TP:/ / WWW. m ETAQ UOtEs. n e t
   E-mail : S U p P oRT@m e t aQuo Te S. neT
*/
#property copyright "Copyright 2012, Top Lessons in Forex"
#property link      "http://toplessons.in/forex"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Green
#property indicator_color6 Crimson

extern int small_bar_count1 = 36;
extern int medium_bar_count1 = 60;
extern int big_bar_count1 = 156;
int Gi_88 = 159;
int Gi_92 = 162;
int Gi_96 = 162;
double G_ibuf_100[];
double G_ibuf_104[];
double G_ibuf_108[];
double G_ibuf_112[];
double G_ibuf_116[];
double G_ibuf_120[];
int Gi_124 = 1;
int Gi_128 = 1;
int Gi_132 = 1;
int Gi_136 = 1;
int Gi_140 = 1;
int Gi_144 = 1;
string Gs_148;
string Gs_156;
int Gi_unused_164;
int G_timeframe_168;
bool Gi_172;
bool Gi_176;
bool Gi_180;
int G_bars_184 = -1;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   int Lia_unused_0[];
   G_timeframe_168 = Period();
   Gs_156 = f0_2(G_timeframe_168);
   Gs_148 = Symbol();
   Gi_unused_164 = Digits;
   if (small_bar_count1 > 0.0) {
      SetIndexStyle(0, DRAW_ARROW);
      SetIndexArrow(0, Gi_88);
      SetIndexBuffer(0, G_ibuf_100);
      SetIndexEmptyValue(0, 0.0);
      SetIndexStyle(1, DRAW_ARROW);
      SetIndexArrow(1, Gi_88);
      SetIndexBuffer(1, G_ibuf_104);
      SetIndexEmptyValue(1, 0.0);
   }
   if (medium_bar_count1 > 0.0) {
      SetIndexStyle(2, DRAW_ARROW);
      SetIndexArrow(2, Gi_92);
      SetIndexBuffer(2, G_ibuf_108);
      SetIndexEmptyValue(2, 0.0);
      SetIndexStyle(3, DRAW_ARROW);
      SetIndexArrow(3, Gi_92);
      SetIndexBuffer(3, G_ibuf_112);
      SetIndexEmptyValue(3, 0.0);
   }
   if (big_bar_count1 > 0.0) {
      SetIndexStyle(4, DRAW_ARROW);
      SetIndexArrow(4, Gi_96);
      SetIndexBuffer(4, G_ibuf_116);
      SetIndexEmptyValue(4, 0.0);
      SetIndexStyle(5, DRAW_ARROW);
      SetIndexArrow(5, Gi_96);
      SetIndexBuffer(5, G_ibuf_120);
      SetIndexEmptyValue(5, 0.0);
   }
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// 1093464FCDFB80BE70432E26976AF888
void f0_0() {
   if (ObjectFind("tl_powered") != 0) {
      ObjectCreate("tl_powered", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("tl_powered", "© " + TimeYear(TimeCurrent()) + " TopLessons.In/Forex", 7, "Arial", Gold);
      ObjectSet("tl_powered", OBJPROP_CORNER, 2);
      ObjectSet("tl_powered", OBJPROP_XDISTANCE, 10);
      ObjectSet("tl_powered", OBJPROP_YDISTANCE, 10);
   }
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   string Ls_unused_0;
   f0_0();
   if (Bars != G_bars_184) {
      Gi_172 = TRUE;
      Gi_176 = TRUE;
      Gi_180 = TRUE;
   }
   if (small_bar_count1 > 0.0) f0_1(G_ibuf_100, G_ibuf_104, small_bar_count1, Gi_124, Gi_128);
   if (medium_bar_count1 > 0.0) f0_1(G_ibuf_108, G_ibuf_112, medium_bar_count1, Gi_132, Gi_136);
   if (big_bar_count1 > 0.0) f0_1(G_ibuf_116, G_ibuf_120, big_bar_count1, Gi_140, Gi_144);
   if (Gi_172) {
      if (G_ibuf_100[0] != 0.0) {
         Gi_172 = FALSE;
         PlaySound("brilliant_potential_long.wav");
      }
      if (G_ibuf_104[0] != 0.0) {
         Gi_172 = FALSE;
         PlaySound("brilliant_potential_short.wav");
      }
   }
   if (Gi_176) {
      if (G_ibuf_108[0] != 0.0) {
         Gi_176 = FALSE;
         PlaySound("brilliant_good_long.wav");
      }
      if (G_ibuf_112[0] != 0.0) {
         Gi_176 = FALSE;
         PlaySound("brilliant_good_short.wav");
      }
   }
   if (Gi_180) {
      if (G_ibuf_116[0] != 0.0) {
         Gi_180 = FALSE;
         PlaySound("brilliant_high_long.wav");
      }
      if (G_ibuf_120[0] != 0.0) {
         Gi_180 = FALSE;
         PlaySound("brilliant_high_short.wav");
      }
   }
   G_bars_184 = Bars;
   return (0);
}

// BE5275EB85F7B577DA8FD065F994B740
string f0_2(int Ai_0) {
   string Ls_ret_4;
   switch (Ai_0) {
   case 1:
      Ls_ret_4 = "M1";
      break;
   case 5:
      Ls_ret_4 = "M5";
      break;
   case 15:
      Ls_ret_4 = "M15";
      break;
   case 30:
      Ls_ret_4 = "M30";
      break;
   case 60:
      Ls_ret_4 = "H1";
      break;
   case 240:
      Ls_ret_4 = "H4";
      break;
   case 1440:
      Ls_ret_4 = "D1";
      break;
   case 10080:
      Ls_ret_4 = "W1";
      break;
   case 43200:
      Ls_ret_4 = "MN";
   }
   return (Ls_ret_4);
}

// 3CA4C22A90227AC4A7684A00FAEE2BA5
int f0_1(double &Ada_0[], double &Ada_4[], int Ai_8, int Ai_12, int Ai_16) {
   double Ld_20;
   double Ld_28;
   double Ld_36;
   double Ld_44;
   double Ld_52;
   double Ld_60;
   for (int Li_68 = Bars - Ai_8; Li_68 >= 0; Li_68--) {
      Ld_20 = Low[iLowest(NULL, 0, MODE_LOW, Ai_8, Li_68)];
      if (Ld_20 == Ld_60) Ld_20 = 0.0;
      else {
         Ld_60 = Ld_20;
         if (Low[Li_68] - Ld_20 > Ai_12 * Point) Ld_20 = 0.0;
         else {
            for (int Li_72 = 1; Li_72 <= Ai_16; Li_72++) {
               Ld_28 = Ada_0[Li_68 + Li_72];
               if (Ld_28 != 0.0 && Ld_28 > Ld_20) Ada_0[Li_68 + Li_72] = 0.0;
            }
         }
      }
      Ada_0[Li_68] = Ld_20;
      Ld_20 = High[iHighest(NULL, 0, MODE_HIGH, Ai_8, Li_68)];
      if (Ld_20 == Ld_52) Ld_20 = 0.0;
      else {
         Ld_52 = Ld_20;
         if (Ld_20 - High[Li_68] > Ai_12 * Point) Ld_20 = 0.0;
         else {
            for (Li_72 = 1; Li_72 <= Ai_16; Li_72++) {
               Ld_28 = Ada_4[Li_68 + Li_72];
               if (Ld_28 != 0.0 && Ld_28 < Ld_20) Ada_4[Li_68 + Li_72] = 0.0;
            }
         }
      }
      Ada_4[Li_68] = Ld_20;
   }
   Ld_52 = -1;
   int Li_76 = -1;
   Ld_60 = -1;
   int Li_80 = -1;
   for (Li_68 = Bars - Ai_8; Li_68 >= 0; Li_68--) {
      Ld_36 = Ada_0[Li_68];
      Ld_44 = Ada_4[Li_68];
      if (Ld_36 == 0.0 && Ld_44 == 0.0) continue;
      if (Ld_44 != 0.0) {
         if (Ld_52 > 0.0) {
            if (Ld_52 < Ld_44) Ada_4[Li_76] = 0;
            else Ada_4[Li_68] = 0;
         }
         if (Ld_52 < Ld_44 || Ld_52 < 0.0) {
            Ld_52 = Ld_44;
            Li_76 = Li_68;
         }
         Ld_60 = -1;
      }
      if (Ld_36 != 0.0) {
         if (Ld_60 > 0.0) {
            if (Ld_60 > Ld_36) Ada_0[Li_80] = 0;
            else Ada_0[Li_68] = 0;
         }
         if (Ld_36 < Ld_60 || Ld_60 < 0.0) {
            Ld_60 = Ld_36;
            Li_80 = Li_68;
         }
         Ld_52 = -1;
      }
   }
   return (0);
}
