/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website: H Ttp:// Www. M Et AQ u Otes. nE T
   E-mail : S UPp OR T@ meTa Q U O tes .net
*/
#property copyright "Copyright © 2009, Forexsignal30"
#property link      "http://www.forexsignal30.com"

#property indicator_separate_window
#property indicator_buffers 4

#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 Red

#property indicator_minimum -100.0
#property indicator_maximum 100.0

extern int     Depth  =  21;
extern int Deviation  =  5;
extern int  Backstep  =  3;

double G_ibuf_88[];
double G_ibuf_92[];
double G_ibuf_96[];
double G_ibuf_100[];
double G_ibuf_104[];
double G_ibuf_108[];
double G_ibuf_112[];

int init() {
   IndicatorBuffers(7);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 119);
   SetIndexBuffer(0, G_ibuf_96);
   SetIndexEmptyValue(0, 0.0);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 119);
   SetIndexBuffer(1, G_ibuf_100);
   SetIndexEmptyValue(1, 0.0);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(2, G_ibuf_104);
   SetIndexEmptyValue(2, 0.0);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexBuffer(3, G_ibuf_108);
   SetIndexEmptyValue(3, 0.0);
   SetIndexBuffer(4, G_ibuf_88);
   SetIndexBuffer(5, G_ibuf_92);
   SetIndexBuffer(6, G_ibuf_112);
   SetIndexEmptyValue(0, 0.0);
   SetIndexEmptyValue(1, 0.0);
   SetIndexEmptyValue(2, 0.0);
   ArraySetAsSeries(G_ibuf_88, TRUE);
   ArraySetAsSeries(G_ibuf_92, TRUE);
   IndicatorShortName("Forexsignal30.com");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double Ld_0;
   double Ld_8;
   double Ld_16;
   double Ld_24;
   double Ld_32;
   double Ld_40;
   bool Li_48;
   for (int i = Bars - Depth; i >= 0; i--) {
      Ld_0 = Low[iLowest(NULL, 0, MODE_LOW, Depth, i)];
      if (Ld_0 == Ld_40) Ld_0 = 0.0;
      else {
         Ld_40 = Ld_0;
         if (Low[i] - Ld_0 > Deviation * Point) Ld_0 = 0.0;
         else {
            for (int shift = 1; shift <= Backstep; shift++) {
               Ld_8 = G_ibuf_88[i + shift];
               if (Ld_8 != 0.0 && Ld_8 > Ld_0) G_ibuf_88[i + shift] = 0.0;
            }
         }
      }
      G_ibuf_88[i] = Ld_0;
      Ld_0 = High[iHighest(NULL, 0, MODE_HIGH, Depth, i)];
      if (Ld_0 == Ld_32) Ld_0 = 0.0;
      else {
         Ld_32 = Ld_0;
         if (Ld_0 - High[i] > Deviation * Point) Ld_0 = 0.0;
         else {
            for (shift = 1; shift <= Backstep; shift++) {
               Ld_8 = G_ibuf_92[i + shift];
               if (Ld_8 != 0.0 && Ld_8 < Ld_0) G_ibuf_92[i + shift] = 0.0;
            }
         }
      }
      G_ibuf_92[i] = Ld_0;
   }
   Ld_32 = -1;
   int Li_60 = -1;
   Ld_40 = -1;
   int Li_64 = -1;
   for (i = Bars - Depth; i >= 0; i--) {
      Ld_16 = G_ibuf_88[i];
      Ld_24 = G_ibuf_92[i];
      if (Ld_16 == 0.0 && Ld_24 == 0.0) continue;
      if (Ld_24 != 0.0) {
         if (Ld_32 > 0.0) {
            if (Ld_32 < Ld_24) G_ibuf_92[Li_60] = 0;
            else G_ibuf_92[i] = 0;
         }
         if (Ld_32 < Ld_24 || Ld_32 < 0.0) {
            Ld_32 = Ld_24;
            Li_60 = i;
         }
         Ld_40 = -1;
      }
      if (Ld_16 != 0.0) {
         if (Ld_40 > 0.0) {
            if (Ld_40 > Ld_16) G_ibuf_88[Li_64] = 0;
            else G_ibuf_88[i] = 0;
         }
         if (Ld_16 < Ld_40 || Ld_40 < 0.0) {
            Ld_40 = Ld_16;
            Li_64 = i;
         }
         Ld_32 = -1;
      }
   }
   for (i = Bars - 1; i >= 0; i--) {
      if (i >= Bars - Depth) {
         G_ibuf_88[i] = 0.0;
         G_ibuf_92[i] = 0.0;
      } else {
         if (G_ibuf_88[i] > 0.0) Li_48 = TRUE;
         Ld_8 = G_ibuf_92[i];
         if (Ld_8 != 0.0) {
            G_ibuf_88[i] = Ld_8;
            Li_48 = FALSE;
         }
      }
      if (Li_48) G_ibuf_112[i] = -1;
      else G_ibuf_112[i] = 1;
   }
   for (i = Bars - 4; i >= 0; i--) {
      if (G_ibuf_112[i] < 0.0) {
         if (G_ibuf_112[i + 2] > 0.0) {
            if (G_ibuf_112[i + 1] > 0.0) {
               G_ibuf_100[i + 1] = -70;
               G_ibuf_108[i + 1] = -70;
               G_ibuf_100[i] = -90;
               G_ibuf_108[i] = -90;
               G_ibuf_96[i] = -90;
               G_ibuf_104[i] = -90;
               continue;
            }
            G_ibuf_96[i] = -30;
            G_ibuf_104[i] = -30;
            continue;
         }
         if (G_ibuf_112[i + 1] > 0.0) {
            G_ibuf_96[i] = -90;
            G_ibuf_104[i] = -90;
            G_ibuf_100[i] = -90;
            G_ibuf_108[i] = -90;
            continue;
         }
         G_ibuf_96[i] = 0.001;
         G_ibuf_104[i] = 0.001;
      } else {
         if (G_ibuf_112[i + 2] > 0.0) {
            if (G_ibuf_112[i + 1] > 0.0) {
               G_ibuf_100[i] = 0.001;
               G_ibuf_108[i] = 0.001;
               continue;
            }
            G_ibuf_96[i] = 90;
            G_ibuf_104[i] = 90;
            G_ibuf_100[i] = 90;
            G_ibuf_108[i] = 90;
         } else {
            if (G_ibuf_112[i + 1] > 0.0) {
               G_ibuf_100[i] = 30;
               G_ibuf_108[i] = 30;
            } else {
               G_ibuf_96[i + 1] = 70;
               G_ibuf_104[i + 1] = 70;
               G_ibuf_96[i] = 90;
               G_ibuf_104[i] = 90;
               G_ibuf_100[i] = 90;
               G_ibuf_108[i] = 90;
            }
         }
      }
   }
   return (0);
}
