/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  HTtP: // Ww W.m E tA Q u oT eS .NeT
   E-mail :  Su P POR T @Met aQ U Ot E S . N ET
*/
#property copyright "Copyright © 2013, Lucifer"
#property link      "Hell_Underground"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red

double G_ibuf_76[];
double G_ibuf_80[];
extern int Numberofbars = 2000;
extern int FasterEMA = 5;
extern int SlowerEMA = 200;
extern int RSIPeriod = 12;
extern int CCIPeriod = 21;
extern int STKPeriod = 5;
extern int STDPeriod = 3;
extern int STSlowing = 2;
extern int STOBought = 60;
extern int STOVSold = 40;
extern int ADXPeriod = 34;
extern int BULSPeriod = 50;
extern int BEARPeriod = 50;
extern int BollingerbandsPeriod = 20;
extern int BollingerbandsShift = 0;
extern double BollingerbandsDeviation = 1.6;
extern bool Alerts = TRUE;
bool Gi_156 = True;
bool Gi_160 = True;
bool Gi_164 = True;
bool Gi_168 = True;
bool Gi_172 = True;
bool Gi_176 = True;
bool Gi_180 = True;
bool Gi_184 = True;
bool Gi_188 = True;
bool Gi_192 = True;
bool Gi_196 = True;
bool Gi_200 = True;
bool Gi_204 = True;
bool Gi_208 = True;
int Gi_212 = 0;
bool Gi_216 = True;
bool Gi_220 = True;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 221);
   SetIndexDrawBegin(0, Bars - Numberofbars);
   SetIndexBuffer(0, G_ibuf_76);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 222);
   SetIndexDrawBegin(1, Bars - Numberofbars);
   SetIndexBuffer(1, G_ibuf_80);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_8;
   double ima_12;
   double ima_20;
   double ima_28;
   double ima_36;
   double irsi_44;
   double irsi_52;
   double icci_60;
   double icci_68;
   double istochastic_76;
   double istochastic_84;
   double istochastic_92;
   double istochastic_100;
   double iadx_108;
   double iadx_116;
   double iadx_124;
   double iadx_132;
   double ibullspower_140;
   double ibullspower_148;
   double ibearspower_156;
   double ibearspower_164;
   double Ld_172;
   double Ld_180;
   double ibands_192;
   double ibands_200;
   double ibands_208;
   double ibands_216;
   int Li_188 = IndicatorCounted();
   if (Li_188 < 0) return (-1);
   if (Li_188 > 0) Li_188--;
   int Li_0 = Bars - Li_188;
   for (int Li_4 = 0; Li_4 <= Li_0; Li_4++) {
      Li_8 = Li_4;
      Ld_172 = 0;
      Ld_180 = 0;
      for (Li_8 = Li_4; Li_8 <= Li_4 + 21; Li_8++) Ld_180 += MathAbs(High[Li_8] - Low[Li_8]);
      Ld_172 = Ld_180 / 10.0;
      ima_12 = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      ima_28 = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
      ima_20 = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      ima_36 = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
      irsi_44 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, Li_4);
      irsi_52 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, Li_4 + 1);
      icci_60 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, Li_4);
      icci_68 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, Li_4 + 1);
      istochastic_76 = iStochastic(NULL, 0, STKPeriod, STDPeriod, STSlowing, MODE_SMA, 0, MODE_MAIN, Li_4);
      istochastic_92 = iStochastic(NULL, 0, STKPeriod, STDPeriod, STSlowing, MODE_SMA, 0, MODE_MAIN, Li_4 + 1);
      istochastic_84 = iStochastic(NULL, 0, STKPeriod, STDPeriod, STSlowing, MODE_SMA, 0, MODE_SIGNAL, Li_4);
      istochastic_100 = iStochastic(NULL, 0, STKPeriod, STDPeriod, STSlowing, MODE_SMA, 0, MODE_SIGNAL, Li_4 + 1);
      iadx_108 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_PLUSDI, Li_4 + 1);
      iadx_124 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_PLUSDI, Li_4);
      iadx_116 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MINUSDI, Li_4 + 1);
      iadx_132 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MINUSDI, Li_4);
      ibullspower_140 = iBullsPower(NULL, 0, BULSPeriod, PRICE_CLOSE, Li_4);
      ibullspower_148 = iBullsPower(NULL, 0, BULSPeriod, PRICE_CLOSE, Li_4 + 1);
      ibearspower_156 = iBearsPower(NULL, 0, BEARPeriod, PRICE_CLOSE, Li_4);
      ibearspower_164 = iBearsPower(NULL, 0, BEARPeriod, PRICE_CLOSE, Li_4 + 1);
      ibands_192 = iBands(NULL, 0, BollingerbandsPeriod, BollingerbandsDeviation, BollingerbandsShift, PRICE_CLOSE, MODE_UPPER, Li_4);
      ibands_200 = iBands(NULL, 0, BollingerbandsPeriod, BollingerbandsDeviation, BollingerbandsShift, PRICE_CLOSE, MODE_LOWER, Li_4);
      ibands_208 = iBands(NULL, 0, BollingerbandsPeriod, BollingerbandsDeviation, BollingerbandsShift, PRICE_CLOSE, MODE_UPPER, Li_4 + 1);
      ibands_216 = iBands(NULL, 0, BollingerbandsPeriod, BollingerbandsDeviation, BollingerbandsShift, PRICE_CLOSE, MODE_LOWER, Li_4 + 1);
      if (Close[Li_4] > ibands_192 && Close[Li_4 + 1] >= ibands_208) {
         Gi_204 = FALSE;
         Gi_208 = TRUE;
      }
      if (Close[Li_4] < ibands_200 && Close[Li_4 + 1] <= ibands_216) {
         Gi_204 = TRUE;
         Gi_208 = FALSE;
      }
      if (ibullspower_140 > 0.0 && ibullspower_148 > ibullspower_140) {
         Gi_176 = FALSE;
         Gi_200 = TRUE;
      }
      if (ibearspower_156 < 0.0 && ibearspower_164 < ibearspower_156) {
         Gi_176 = TRUE;
         Gi_200 = FALSE;
      }
      if (iadx_108 < iadx_116 && iadx_124 > iadx_132) {
         Gi_172 = TRUE;
         Gi_196 = FALSE;
      }
      if (iadx_108 > iadx_116 && iadx_124 < iadx_132) {
         Gi_172 = FALSE;
         Gi_196 = TRUE;
      }
      if (istochastic_76 > istochastic_84 && istochastic_92 < istochastic_100 || istochastic_76 > STOVSold && istochastic_92 < STOVSold || istochastic_84 > STOVSold && istochastic_100 < STOVSold) {
         Gi_168 = TRUE;
         Gi_192 = FALSE;
      }
      if (istochastic_76 < istochastic_84 && istochastic_92 > istochastic_100 || istochastic_76 < STOBought && istochastic_92 > STOBought || istochastic_84 < STOBought &&
         istochastic_92 > STOBought) {
         Gi_168 = FALSE;
         Gi_192 = TRUE;
      }
      if (icci_60 > -100.0 && icci_68 < -100.0) {
         Gi_164 = TRUE;
         Gi_188 = FALSE;
      }
      if (icci_60 < 100.0 && icci_68 > 100.0) {
         Gi_164 = FALSE;
         Gi_188 = TRUE;
      }
      if (irsi_44 > 50.0 && irsi_52 < 50.0) {
         Gi_160 = TRUE;
         Gi_184 = FALSE;
      }
      if (irsi_44 < 50.0 && irsi_52 > 50.0) {
         Gi_160 = FALSE;
         Gi_184 = TRUE;
      }
      if (ima_12 > ima_20 && ima_28 < ima_36) {
         Gi_156 = TRUE;
         Gi_180 = FALSE;
      }
      if (ima_12 < ima_20 && ima_28 > ima_36) {
         Gi_156 = FALSE;
         Gi_180 = TRUE;
      }
      if (Gi_156 == TRUE && Gi_160 == TRUE && Gi_164 == TRUE && Gi_168 == TRUE && Gi_172 == TRUE && Gi_176 && Gi_204 == TRUE && Gi_212 != 1) {
         G_ibuf_76[Li_4] = Low[Li_4] - 1.3 * Ld_172;
         if (Li_4 <= 2 && Alerts && (!Gi_216)) {
            Alert(Symbol(), " ", Period(), "BUY");
            Gi_216 = TRUE;
            Gi_220 = FALSE;
         }
         Gi_212 = 1;
      } else {
         if (Gi_180 == TRUE && Gi_184 == TRUE && Gi_188 == TRUE && Gi_192 == TRUE && Gi_196 == TRUE && Gi_200 && Gi_208 == TRUE && Gi_212 != 2) {
            G_ibuf_80[Li_4] = High[Li_4] + 1.3 * Ld_172;
            if (Li_4 <= 2 && Alerts && (!Gi_220)) {
               Alert(Symbol(), " ", Period(), "SELL");
               Gi_220 = TRUE;
               Gi_216 = FALSE;
            }
            Gi_212 = 2;
         }
      }
   }
   return (0);
}
