/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  h tT P: //wwW .met A quO t e S. n eT
   E-mail :  S U P PORT @ mE T Aqu Ot eS .ne T
*/
#property copyright "Copyright © 2009, thesecret"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Black
#property indicator_color4 Black

double G_ibuf_76[];
double G_ibuf_80[];
extern int FasterMode = 3;
extern int FasterMA = 2;
extern int SlowerMode = 3;
extern int SlowerMA = 5;
double G_time_100;

int init() {
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, G_ibuf_76);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, G_ibuf_80);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int Li_8;
   double ima_12;
   double ima_20;
   double ima_28;
   double ima_36;
   double ima_44;
   double ima_52;
   double Ld_60;
   double Ld_68;
   int Li_76 = IndicatorCounted();
   if (Li_76 < 0) return (-1);
   if (Li_76 > 0) Li_76--;
   int Li_0 = Bars - Li_76;
   for (int Li_4 = 0; Li_4 <= Li_0; Li_4++) {
      Li_8 = Li_4;
      Ld_60 = 0;
      Ld_68 = 0;
      for (Li_8 = Li_4; Li_8 <= Li_4 + 9; Li_8++) Ld_68 += MathAbs(High[Li_8] - Low[Li_8]);
      Ld_60 = Ld_68 / 10.0;
      ima_12 = iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, Li_4);
      ima_28 = iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, Li_4 + 1);
      ima_44 = iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, Li_4 - 1);
      ima_20 = iMA(NULL, 0, SlowerMA, 1, SlowerMode, PRICE_OPEN, Li_4);
      ima_36 = iMA(NULL, 0, SlowerMA, 1, SlowerMode, PRICE_OPEN, Li_4 + 1);
      ima_52 = iMA(NULL, 0, SlowerMA, 1, SlowerMode, PRICE_OPEN, Li_4 - 1);
      if (ima_12 > ima_20 && ima_28 < ima_36 && ima_44 > ima_52) {
         G_ibuf_76[Li_4] = Low[Li_4] - Ld_60 / 2.0;
         if (G_time_100 != Time[0]) Alert(Symbol(), "  M", Period(), " MA cross BUY");
         G_time_100 = Time[0];
      } else {
         if (ima_12 < ima_20 && ima_28 > ima_36 && ima_44 < ima_52) {
            G_ibuf_80[Li_4] = High[Li_4] + Ld_60 / 2.0;
            if (G_time_100 != Time[0]) Alert(Symbol(), "  M", Period(), " MA cross SELL");
            G_time_100 = Time[0];
         }
      }
   }
   return (0);
}
