/*
*/
#property copyright "Copyright © 2008, Forex Day Monster "
#property link      "http://www.forexprofitmonster.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Sienna
#property indicator_color2 Yellow
#property indicator_color3 Fuchsia

int gi_76 = 52;
int gi_80 = 5;
int gi_84 = 20;
double gd_88 = 2.0;
double g_pips_96 = 2.0;
double g_ibuf_104[];
double g_ibuf_108[];
double g_ibuf_112[];
int gi_116 = 0;
int g_bars_120 = 0;
int gi_unused_124 = 0;
double gd_128;
double gd_136;

int init() {
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 159);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 159);
   SetIndexBuffer(0, g_ibuf_104);
   SetIndexBuffer(1, g_ibuf_108);
   SetIndexBuffer(2, g_ibuf_112);
   IndicatorDigits(4);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double ld_28;
   double ld_44;
   double ld_52;
   double ld_60;
   double ld_68;
   double ld_76;
   double ld_84;
   string ls_0 = "2015.11.01";
   int l_str2time_8 = StrToTime(ls_0);
   if (TimeCurrent() >= l_str2time_8) {
      Alert(" Trial version has expired! Email support@forexprofitmonster.com with broker account number for rights to full version!");
      return (0);
   }
   int li_16 = 0;
   double ld_20 = 0.000000001;
   if (g_bars_120 == Bars) return (0);
   gd_128 = 2.0 / (gi_84 + 1);
   gd_136 = 2.0 / (gi_80 + 1);
   gi_116 = IndicatorCounted();
   if (Bars <= gi_76 + 2) return (0);
   if (gi_116 < 0) return (-1);
   if (gi_116 > 0) gi_116--;
   li_16 = Bars - gi_76 - 2;
   double ld_36 = Close[li_16 + 1];
   while (li_16 >= 0) {
      if (li_16 == Bars - gi_76 - 2) ld_36 = Close[li_16 + 1];
      ld_44 = MathAbs(Close[li_16] - (Close[li_16 + gi_76]));
      ld_20 = 0.000000001;
      for (int l_count_12 = 0; l_count_12 < gi_76; l_count_12++) ld_20 += MathAbs(Close[li_16 + l_count_12] - (Close[li_16 + l_count_12 + 1]));
      ld_52 = ld_44 / ld_20;
      ld_60 = gd_136 - gd_128;
      ld_68 = ld_52 * ld_60;
      ld_76 = ld_68 + gd_128;
      ld_28 = ld_36 + MathPow(ld_76, gd_88) * (Close[li_16] - ld_36);
      g_ibuf_104[li_16] = ld_28;
      ld_84 = ld_28 - ld_36;
      if (MathAbs(ld_84) > g_pips_96 * Point && ld_84 > 0.0) g_ibuf_108[li_16] = ld_28;
      else g_ibuf_108[li_16] = 0;
      if (MathAbs(ld_84) > g_pips_96 * Point && ld_84 < 0.0) g_ibuf_112[li_16] = ld_28;
      else g_ibuf_112[li_16] = 0;
      ld_36 = ld_28;
      li_16--;
   }
   g_bars_120 = Bars;
   return (0);
}