Navigation:Home > Content >

envelopes~.mq4

Time: 2018-04-13 | Download file:envelopes~.mq4

/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  H T t p : // wWw.m E T aqU ote S.N E T
   E-mail : S Up P orT @m e t a QUOtE S . NE T
*/
#property copyright "Fxpro System"
#property link      "http://www.fxprosystem.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 CLR_NONE
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Lime

extern string TimeFrame = "Current";
int Gi_84 = 56;
extern int Price = 0;
double Gd_92 = 3.0;
int G_period_100 = 100;
extern double TrendThreshold = 0.5;
bool Gi_112 = FALSE;
bool Gi_116 = FALSE;
bool Gi_120 = FALSE;
bool Gi_124 = FALSE;
bool Gi_128 = FALSE;
double G_ibuf_132[];
double G_ibuf_136[];
double G_ibuf_140[];
double G_ibuf_144[];
double G_ibuf_148[];
double G_ibuf_152[];
int G_timeframe_156;
bool Gi_160;
datetime G_time_164;
double Gd_168;
bool G_bool_176;
string Gsa_180[] = {"M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN"};
int Gia_184[] = {1, 5, 15, 30, 60, 240, 1440, 10080, 43200};

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   G_bool_176 = MarketInfo(Symbol(), MODE_MARGINCALCMODE) == 0.0 && MarketInfo(Symbol(), MODE_PROFITCALCMODE) == 0.0 && Digits % 2 == 1;
   Gd_168 = MarketInfo(Symbol(), MODE_TICKSIZE);
   if (G_bool_176) Gd_168 = 10.0 * Gd_168;
   G_timeframe_156 = f0_5(TimeFrame);
   IndicatorBuffers(6);
   SetIndexBuffer(0, G_ibuf_132);
   SetIndexDrawBegin(0, Gi_84 * (G_timeframe_156 / Period()));
   SetIndexBuffer(1, G_ibuf_136);
   SetIndexDrawBegin(1, Gi_84 * (G_timeframe_156 / Period()));
   SetIndexBuffer(2, G_ibuf_140);
   SetIndexDrawBegin(2, Gi_84 * (G_timeframe_156 / Period()));
   SetIndexBuffer(3, G_ibuf_144);
   SetIndexDrawBegin(3, Gi_84 * (G_timeframe_156 / Period()));
   SetIndexBuffer(4, G_ibuf_148);
   SetIndexDrawBegin(4, Gi_84 * (G_timeframe_156 / Period()));
   SetIndexBuffer(5, G_ibuf_152);
   SetIndexDrawBegin(5, Gi_84 * (G_timeframe_156 / Period()));
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_0 = IndicatorCounted();
   if (Li_0 < 0) return (-1);
   if (Li_0 > 0) Li_0--;
   double Ld_20 = G_timeframe_156 / Period();
   int Li_16 = MathMin(Bars - 1, Bars - Li_0 + Gi_84 * Ld_20);
   int Li_28 = 0;
   int Li_32 = 999;
   double Ld_36 = G_ibuf_132[Li_16 + 1];
   double Ld_44 = 0;
   double Ld_52 = 0;
   double Ld_60 = G_ibuf_132[Li_16 + 1];
   double Ld_unused_68 = 0;
   for (int Li_4 = Li_16; Li_4 >= 0; Li_4--) {
      if (G_timeframe_156 == Period()) Li_28 = Li_4;
      else Li_28 = iBarShift(Symbol(), G_timeframe_156, Time[Li_4]);
      if (Li_28 == Li_32) {
         G_ibuf_132[Li_4] = G_ibuf_132[Li_4 + 1] + (Ld_36 - Ld_60) * (1 / Ld_20);
         G_ibuf_136[Li_4] = G_ibuf_132[Li_4] + Ld_44;
         G_ibuf_140[Li_4] = G_ibuf_132[Li_4] - Ld_44;
         f0_4(Li_4, Ld_52);
      } else {
         Li_32 = Li_28;
         Ld_60 = Ld_36;
         Ld_36 = f0_2(Li_28);
         Ld_44 = iATR(NULL, G_timeframe_156, G_period_100, Li_28 + 10) * Gd_92;
         if (Ld_44 == 0.0) Ld_44 = 1;
         if (Ld_20 > 1.0) G_ibuf_132[Li_4] = Ld_60 + (Ld_36 - Ld_60) * (1 / Ld_20);
         else G_ibuf_132[Li_4] = Ld_36;
         G_ibuf_136[Li_4] = G_ibuf_132[Li_4] + Ld_44;
         G_ibuf_140[Li_4] = G_ibuf_132[Li_4] - Ld_44;
         Ld_52 = (Ld_36 - Ld_60) / (Ld_44 / Gd_92 / 10.0);
         f0_4(Li_4, Ld_52);
      }
   }
   f0_0();
   return (0);
}

// B9CE7D9E248CB7A5F56E37D82D57F919
void f0_4(int Ai_0, double Ad_4) {
   G_ibuf_144[Ai_0] = EMPTY_VALUE;
   G_ibuf_148[Ai_0] = EMPTY_VALUE;
   G_ibuf_152[Ai_0] = EMPTY_VALUE;
   if (Gi_112) {
      if (Ad_4 > TrendThreshold) {
         G_ibuf_144[Ai_0] = G_ibuf_132[Ai_0];
         return;
      }
      if (Ad_4 < -1.0 * TrendThreshold) {
         G_ibuf_148[Ai_0] = G_ibuf_132[Ai_0];
         return;
      }
      G_ibuf_152[Ai_0] = G_ibuf_132[Ai_0];
   }
}

// 903F1C1EE8C338A3230B05F557408C88
double f0_2(int Ai_0) {
   double Ld_4 = (Gi_84 + 1) * iClose(Symbol(), G_timeframe_156, Ai_0);
   double Ld_12 = Gi_84 + 1;
   int Li_20 = 1;
   for (int Li_24 = Gi_84; Li_20 <= Gi_84; Li_24--) {
      Ld_4 += Li_24 * iClose(Symbol(), G_timeframe_156, Ai_0 + Li_20);
      Ld_12 += Li_24;
      if (Li_20 <= Ai_0) {
         if (iTime(Symbol(), G_timeframe_156, Ai_0 - Li_20) <= Time[0]) {
            Ld_4 += Li_24 * iClose(Symbol(), G_timeframe_156, Ai_0 - Li_20);
            Ld_12 += Li_24;
         }
      }
      Li_20++;
   }
   return (Ld_4 / Ld_12);
}

// 304CD8F881C2EC9D8467D17452E084AC
void f0_0() {
   int Li_0;
   if (Gi_116) {
      if (Close[0] > G_ibuf_136[0]) Li_0 = 1;
      else {
         if (Close[0] < G_ibuf_140[0]) Li_0 = -1;
         else Gi_160 = FALSE;
      }
      if ((!Gi_160) && G_time_164 != Time[0]) {
         if (Li_0 == 1) f0_6("up");
         if (Li_0 == -1) f0_6("down");
      }
   }
}

// DA717D55A7C333716E8D000540764674
void f0_6(string As_0) {
   string str_concat_8;
   if (Gi_160 == FALSE) {
      Gi_160 = TRUE;
      G_time_164 = Time[0];
      str_concat_8 = StringConcatenate(Symbol(), " at ", TimeToStr(TimeLocal(), TIME_SECONDS), " " + f0_1(G_timeframe_156) + " TMA bands price penetrated ", As_0, " band");
      if (Gi_120) Alert(str_concat_8);
      if (Gi_128) SendMail(StringConcatenate(Symbol(), "TMA bands "), str_concat_8);
      if (Gi_124) PlaySound("alert2.wav");
   }
}

// B9EDCDEA151586E355292E7EA9BE516E
int f0_5(string As_0) {
   As_0 = f0_3(As_0);
   for (int Li_8 = ArraySize(Gia_184) - 1; Li_8 >= 0; Li_8--)
      if (As_0 == Gsa_180[Li_8] || As_0 == "" + Gia_184[Li_8]) return (MathMax(Gia_184[Li_8], Period()));
   return (Period());
}

// 7D88CF3FD85F1B80B60FD9BDB9E59896
string f0_1(int Ai_0) {
   for (int Li_4 = ArraySize(Gia_184) - 1; Li_4 >= 0; Li_4--)
      if (Ai_0 == Gia_184[Li_4]) return (Gsa_180[Li_4]);
   return ("");
}

// 92DFF40263F725411B5FB6096A8D564E
string f0_3(string As_0) {
   int Li_20;
   string Ls_ret_8 = As_0;
   for (int Li_16 = StringLen(As_0) - 1; Li_16 >= 0; Li_16--) {
      Li_20 = StringGetChar(Ls_ret_8, Li_16);
      if ((Li_20 > '`' && Li_20 < '{') || (Li_20 > 'Я' && Li_20 < 256)) Ls_ret_8 = StringSetChar(Ls_ret_8, Li_16, Li_20 - 32);
      else
         if (Li_20 > -33 && Li_20 < 0) Ls_ret_8 = StringSetChar(Ls_ret_8, Li_16, Li_20 + 224);
   }
   return (Ls_ret_8);
}

Recommend