/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website: HT T P :/ / W Ww.M e tA q UOT E S .nE t
   E-mail : S U PP O R T @M ETa qU O te S.N e t
*/
#property copyright "...."
#property link      "..."

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 DeepPink
#property indicator_color3 Blue
#property indicator_color4 DodgerBlue
#property indicator_color5 DarkGreen
#property indicator_color6 Lime
#property indicator_color7 DarkOrange
#property indicator_color8 Orange

double G_ibuf_76[];
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[];
int Gi_108;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(0, Gi_108 - 1);
   SetIndexBuffer(0, G_ibuf_76);
   SetIndexLabel(0, "Resistance M15");
   SetIndexArrow(0, 158);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(1, Gi_108 - 1);
   SetIndexBuffer(1, G_ibuf_80);
   SetIndexLabel(1, "Support M15");
   SetIndexArrow(1, 158);
   SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(2, Gi_108 - 1);
   SetIndexBuffer(2, G_ibuf_84);
   SetIndexLabel(2, "Resistance H1");
   SetIndexArrow(2, 158);
   SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(3, Gi_108 - 1);
   SetIndexBuffer(3, G_ibuf_88);
   SetIndexLabel(3, "Support H1");
   SetIndexArrow(3, 158);
   SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(4, Gi_108 - 1);
   SetIndexBuffer(4, G_ibuf_92);
   SetIndexLabel(4, "Resistance H4");
   SetIndexArrow(4, 158);
   SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(5, Gi_108 - 1);
   SetIndexBuffer(5, G_ibuf_96);
   SetIndexLabel(5, "Support H4");
   SetIndexArrow(5, 158);
   SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(6, Gi_108 - 1);
   SetIndexBuffer(6, G_ibuf_100);
   SetIndexLabel(6, "Resistance D1");
   SetIndexArrow(6, 158);
   SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexDrawBegin(7, Gi_108 - 1);
   SetIndexBuffer(7, G_ibuf_104);
   SetIndexLabel(7, "Support D1");
   SetIndexArrow(7, 158);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// 96EC5251B28E74964265F0BECA7519C4
int f0_0(string As_0, int Ai_8, int Ai_12) {
   if (Period() > Ai_8) return (-1);
   Ai_8 = Ai_8 / Period() * 2 + MathCeil(Ai_8 / Period() / 2);
   if (Ai_12 < Ai_8) return (-1);
   if (Ai_12 > Bars - Ai_8) return (-1);
   for (int Li_16 = 1; Li_16 <= Ai_8; Li_16++) {
      if (As_0 == "U") {
         if (High[Ai_12 + Li_16] > High[Ai_12]) return (-1);
         if (High[Ai_12 - Li_16] >= High[Ai_12]) return (-1);
      }
      if (As_0 == "L") {
         if (Low[Ai_12 + Li_16] < Low[Ai_12]) return (-1);
         if (Low[Ai_12 - Li_16] <= Low[Ai_12]) return (-1);
      }
   }
   return (1);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_0 = 1440;
   int Li_4 = 240;
   int Li_8 = 60;
   int Li_12 = 15;
   for (Gi_108 = Bars; Gi_108 >= 0; Gi_108--) {
      if (f0_0("U", Li_12, Gi_108) == 1) G_ibuf_76[Gi_108] = High[Gi_108];
      else G_ibuf_76[Gi_108] = G_ibuf_76[Gi_108 + 1];
      if (f0_0("L", Li_12, Gi_108) == 1) G_ibuf_80[Gi_108] = Low[Gi_108];
      else G_ibuf_80[Gi_108] = G_ibuf_80[Gi_108 + 1];
      if (f0_0("U", Li_8, Gi_108) == 1) G_ibuf_84[Gi_108] = High[Gi_108];
      else G_ibuf_84[Gi_108] = G_ibuf_84[Gi_108 + 1];
      if (f0_0("L", Li_8, Gi_108) == 1) G_ibuf_88[Gi_108] = Low[Gi_108];
      else G_ibuf_88[Gi_108] = G_ibuf_88[Gi_108 + 1];
      if (f0_0("U", Li_4, Gi_108) == 1) G_ibuf_92[Gi_108] = High[Gi_108];
      else G_ibuf_92[Gi_108] = G_ibuf_92[Gi_108 + 1];
      if (f0_0("L", Li_4, Gi_108) == 1) G_ibuf_96[Gi_108] = Low[Gi_108];
      else G_ibuf_96[Gi_108] = G_ibuf_96[Gi_108 + 1];
      if (f0_0("U", Li_0, Gi_108) == 1) G_ibuf_100[Gi_108] = High[Gi_108];
      else G_ibuf_100[Gi_108] = G_ibuf_100[Gi_108 + 1];
      if (f0_0("L", Li_0, Gi_108) == 1) G_ibuf_104[Gi_108] = Low[Gi_108];
      else G_ibuf_104[Gi_108] = G_ibuf_104[Gi_108 + 1];
   }
   return (0);
}
