/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website: h T Tp : / /w Ww.M E t a Q u OtES .N eT
   E-mail : s u P p ort @ M e T a QUO t Es.N et
*/

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red

int G_period_76 = 14;
double G_ibuf_80[];
double G_ibuf_84[];

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3);
   SetIndexBuffer(0, G_ibuf_80);
   SetIndexBuffer(1, G_ibuf_84);
   IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
   string Ls_0 = "Trend Direction(" + G_period_76 + ")";
   IndicatorShortName(Ls_0);
   SetIndexLabel(0, "UpTrend");
   SetIndexLabel(1, "DownTrend");
   SetIndexDrawBegin(0, G_period_76);
   SetIndexDrawBegin(1, G_period_76);
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_4;
   double irsi_8;
   for (int Li_0 = Bars - G_period_76 - 1; Li_0 >= 0; Li_0--) {
      irsi_8 = iRSI(NULL, 0, G_period_76, PRICE_CLOSE, Li_0);
      if (irsi_8 > 70.0) Li_4 = 1;
      if (irsi_8 < 30.0) Li_4 = -1;
      if (Li_4 > 0) {
         if (irsi_8 > 40.0) G_ibuf_80[Li_0] = 1.0;
         else G_ibuf_80[Li_0] = 1.0;
         G_ibuf_84[Li_0] = 0;
      }
      if (Li_4 < 0) {
         if (irsi_8 < 60.0) G_ibuf_84[Li_0] = 1.0;
         else G_ibuf_84[Li_0] = 1.0;
         G_ibuf_80[Li_0] = 0;
      }
   }
   return (0);
}
