/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  h tTP : / /W WW . M e tAquotE s.n E t
   E-mail :  sU p P OR t @M E tAQUo T E S. n eT
*/
#property copyright "Copyright @ Rita Lasker"
#property link      "http://www.ritalasker.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

int G_period_76 = 66;
bool Gi_80 = FALSE;
string Gs_84 = "2029.09.24";
int Gi_92 = 33;
int G_period_96 = 14;
int G_period_100;
int Gi_104;
double G_ibuf_108[];
double G_ibuf_112[];
double G_ibuf_116[];
double G_ibuf_120[];
double G_ibuf_124[];
double G_ibuf_128[];
double G_ibuf_132[];
bool Gi_136 = TRUE;
bool Gi_140 = TRUE;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   Gi_136 = TRUE;
   Gi_140 = TRUE;
   G_period_100 = G_period_96 * 2 - 1;
   if (G_period_100 < G_period_76) Gi_104 = G_period_76;
   else Gi_104 = G_period_100;
   IndicatorBuffers(7);
   SetIndexBuffer(5, G_ibuf_124);
   SetIndexBuffer(6, G_ibuf_108);
   SetIndexBuffer(2, G_ibuf_112);
   SetIndexBuffer(3, G_ibuf_116);
   SetIndexBuffer(4, G_ibuf_120);
   SetIndexBuffer(0, G_ibuf_128);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_DASHDOTDOT, 4);
   SetIndexBuffer(1, G_ibuf_132);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_DASHDOTDOT, 4);
   IndicatorShortName(StringConcatenate("Octopus 2(", ")"));
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_0;
   double ima_on_arr_8;
   double ima_on_arr_16;
   double Ld_24;
   double Ld_32;
   double Ld_40;
   if (!Gi_136) return (0);
   if (Gs_84 != "") {
      if (TimeCurrent() > StrToTime(Gs_84) + 86400 * Gi_92) {
         Alert("Your Octopus 2 is expired!");
         Comment("Your Octopus 2 is expired!");
         Gi_136 = FALSE;
         return (0);
      }
   }
   if (Gi_140) {
      if (Gi_80) Gi_140 = FALSE;
      if (Bars <= Gi_104) return (0);
      Li_0 = IndicatorCounted();
      if (Li_0 < 1) {
         for (int Li_4 = Bars - Gi_104; Li_4 < Bars; Li_4++) {
            G_ibuf_108[Li_4] = 0.0;
            G_ibuf_112[Li_4] = 0.0;
            G_ibuf_116[Li_4] = 0.0;
            G_ibuf_120[Li_4] = 0.0;
            G_ibuf_124[Li_4] = 0.0;
         }
      }
      Li_0 = Bars - Li_0 - 1;
      for (Li_4 = Li_0; Li_4 >= 0; Li_4--) G_ibuf_120[Li_4] = iRSI(NULL, 0, G_period_96, PRICE_CLOSE, Li_4 + 1);
      for (Li_4 = Li_0; Li_4 >= 0; Li_4--) {
         G_ibuf_124[Li_4] = iMAOnArray(G_ibuf_120, 0, G_period_76, 0, MODE_EMA, Li_4);
         G_ibuf_112[Li_4] = MathAbs(G_ibuf_124[Li_4 + 1] - G_ibuf_124[Li_4]);
      }
      for (Li_4 = Li_0; Li_4 >= 0; Li_4--) G_ibuf_116[Li_4] = iMAOnArray(G_ibuf_112, 0, G_period_100, 0, MODE_EMA, Li_4);
      Li_4 = Li_0 + 1;
      Ld_32 = G_ibuf_108[Li_4];
      ima_on_arr_16 = iMAOnArray(G_ibuf_120, 0, G_period_76, 0, MODE_EMA, Li_4);
      while (Li_4 > 0) {
         Li_4--;
         ima_on_arr_8 = iMAOnArray(G_ibuf_120, 0, G_period_76, 0, MODE_EMA, Li_4);
         Ld_24 = 4.236 * iMAOnArray(G_ibuf_116, 0, G_period_100, 0, MODE_EMA, Li_4);
         Ld_40 = Ld_32;
         if (ima_on_arr_8 < Ld_32) {
            Ld_32 = ima_on_arr_8 + Ld_24;
            if (ima_on_arr_16 < Ld_40)
               if (Ld_32 > Ld_40) Ld_32 = Ld_40;
         } else {
            if (ima_on_arr_8 > Ld_32) {
               Ld_32 = ima_on_arr_8 - Ld_24;
               if (ima_on_arr_16 > Ld_40)
                  if (Ld_32 < Ld_40) Ld_32 = Ld_40;
            }
         }
         G_ibuf_108[Li_4] = Ld_32;
         ima_on_arr_16 = ima_on_arr_8;
         G_ibuf_128[Li_4] = 0;
         G_ibuf_132[Li_4] = 0;
         if (G_ibuf_124[Li_4] > G_ibuf_108[Li_4]) G_ibuf_128[Li_4] = 1;
         else G_ibuf_132[Li_4] = 1;
      }
   }
   return (0);
}
