/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "MojoFX - Conversion only"
#property link      "http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue

extern int MA_Period = 250;
extern double b = 0.4;
double g_ibuf_88[];
double gda_92[];
double gda_96[];
double gda_100[];
double gda_104[];
double gda_108[];
double gda_112[];
double gd_116;
double gd_124;
double gd_132;
double gd_140;
double gd_148;
double gd_156;
double gd_164;
double gd_172;
double gd_180;

int init() {
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, Blue);
   IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
   IndicatorShortName("T3 THV" + MA_Period);
   SetIndexDrawBegin(0, 100);
   SetIndexBuffer(0, g_ibuf_88);
   gd_116 = 0;
   gd_124 = 0;
   gd_132 = 0;
   gd_140 = 0;
   gd_148 = 0;
   gd_156 = 0;
   gd_164 = 0;
   gd_172 = 0;
   gd_180 = 0;
   gd_172 = b * b;
   gd_180 = gd_172 * b;
   gd_116 = -gd_180;
   gd_124 = 3.0 * (gd_172 + gd_180);
   gd_132 = -3.0 * (2.0 * gd_172 + b + gd_180);
   gd_140 = 3.0 * b + 1.0 + gd_180 + 3.0 * gd_172;
   gd_148 = MA_Period;
   if (gd_148 < 1.0) gd_148 = 1;
   gd_148 = (gd_148 - 1.0) / 2.0 + 1.0;
   gd_156 = 2 / (gd_148 + 1.0);
   gd_164 = 1 - gd_156;
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   if (li_4 < 0) return (-1);
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4 - 1;
   ArrayResize(gda_92, Bars + 1);
   ArrayResize(gda_96, Bars + 1);
   ArrayResize(gda_100, Bars + 1);
   ArrayResize(gda_104, Bars + 1);
   ArrayResize(gda_108, Bars + 1);
   ArrayResize(gda_112, Bars + 1);
   for (int li_8 = li_0; li_8 >= 0; li_8--) {
      gda_92[Bars - li_8] = gd_156 * Close[li_8] + gd_164 * (gda_92[Bars - li_8 - 1]);
      gda_96[Bars - li_8] = gd_156 * (gda_92[Bars - li_8]) + gd_164 * (gda_96[Bars - li_8 - 1]);
      gda_100[Bars - li_8] = gd_156 * (gda_96[Bars - li_8]) + gd_164 * (gda_100[Bars - li_8 - 1]);
      gda_104[Bars - li_8] = gd_156 * (gda_100[Bars - li_8]) + gd_164 * (gda_104[Bars - li_8 - 1]);
      gda_108[Bars - li_8] = gd_156 * (gda_104[Bars - li_8]) + gd_164 * (gda_108[Bars - li_8 - 1]);
      gda_112[Bars - li_8] = gd_156 * (gda_108[Bars - li_8]) + gd_164 * (gda_112[Bars - li_8 - 1]);
      g_ibuf_88[li_8] = gd_116 * (gda_112[Bars - li_8]) + gd_124 * (gda_108[Bars - li_8]) + gd_132 * (gda_104[Bars - li_8]) + gd_140 * (gda_100[Bars - li_8]);
   }
   return (0);
}
