Navigation:Home > Content >

I-Custom_bams-bung_2_.mq4

Time: 2013-08-15 | Download file:I-Custom_bams-bung_2_.mq4

/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website:  H tTP : //W Ww. ME T aQUotE S.N eT
   E-mail : sup PO R T@ metaQuO t e S . N E t
*/

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 Black

extern string TimeFrame = "D1";
extern int RsiPeriod = 9;
extern int MaType = 1;
extern int MaPeriod = 2;
extern bool Interpolate = TRUE;
extern string arrowsIdentifier = "Bams-bung";
extern color arrowsUpColor = Lime;
extern color arrowsDnColor = Red;
extern bool alertsOn = FALSE;
extern bool alertsOnCurrent = FALSE;
extern bool alertsMessage = FALSE;
extern bool alertsSound = FALSE;
extern bool alertsEmail = FALSE;
double G_ibuf_136[];
double G_ibuf_140[];
double G_ibuf_144[];
string Gs_148;
bool Gi_156 = FALSE;
bool Gi_160 = FALSE;
int G_timeframe_164;
string Gs_nothing_168 = "nothing";
datetime G_time_176;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   IndicatorBuffers(3);
   SetIndexBuffer(0, G_ibuf_136);
   SetIndexLabel(0, "");
   SetIndexBuffer(1, G_ibuf_140);
   SetIndexLabel(1, "");
   SetIndexBuffer(2, G_ibuf_144);
   SetIndexLabel(2, "");
   if (TimeFrame == "calculate") {
      Gi_156 = TRUE;
      return (0);
   }
   if (TimeFrame == "returnBars") {
      Gi_160 = TRUE;
      return (0);
   }
   G_timeframe_164 = f0_0(TimeFrame);
   Gs_148 = WindowExpertName();
   IndicatorShortName("Bams-bung " + f0_3());
   return (0);
}

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

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int shift_0;
   int datetime_4;
   double Ld_8;
   int Li_16;
   string Ls_20 = "2014.03.25";
   int str2time_28 = StrToTime(Ls_20);
   if (TimeCurrent() >= str2time_28) {
      Alert(" Expired ... Please contact Bams-bung.com ");
      return (0);
   }
   int Li_32 = IndicatorCounted();
   if (Li_32 < 0) return (-1);
   if (Li_32 > 0) Li_32--;
   int Li_36 = MathMin(Bars - Li_32, Bars - 1);
   if (Gi_160) {
      G_ibuf_136[0] = Li_36 + 1;
      return (0);
   }
   if (G_timeframe_164 > Period()) Li_36 = MathMax(Li_36, MathMin(Bars - 1, iCustom(NULL, G_timeframe_164, Gs_148, "returnBars", 0, 0) * G_timeframe_164 / Period()));
   if (Gi_156) {
      for (int Li_40 = 0; Li_40 < Li_36; Li_40++) G_ibuf_136[Li_40] = iRSI(NULL, 0, RsiPeriod, PRICE_CLOSE, Li_40);
      for (Li_40 = 0; Li_40 < Li_36; Li_40++) G_ibuf_140[Li_40] = iMAOnArray(G_ibuf_136, 0, MaPeriod, 0, MaType, Li_40);
      return (0);
   }
   for (Li_40 = Li_36; Li_40 >= 0; Li_40--) {
      shift_0 = iBarShift(NULL, G_timeframe_164, Time[Li_40]);
      G_ibuf_136[Li_40] = iCustom(NULL, G_timeframe_164, Gs_148, "calculate", RsiPeriod, MaType, MaPeriod, 0, shift_0);
      G_ibuf_140[Li_40] = iCustom(NULL, G_timeframe_164, Gs_148, "calculate", RsiPeriod, MaType, MaPeriod, 1, shift_0);
      G_ibuf_144[Li_40] = G_ibuf_144[Li_40 + 1];
      if (G_ibuf_136[Li_40] > G_ibuf_140[Li_40]) G_ibuf_144[Li_40] = 1;
      if (G_ibuf_136[Li_40] < G_ibuf_140[Li_40]) G_ibuf_144[Li_40] = -1;
      f0_4(Time[Li_40]);
      if (G_ibuf_144[Li_40] != G_ibuf_144[Li_40 + 1]) {
         if (G_ibuf_144[Li_40] == 1.0) f0_1(Li_40, arrowsUpColor, 150, 0);
         if (G_ibuf_144[Li_40] == -1.0) f0_1(Li_40, arrowsDnColor, 153, 1);
      }
      if (G_timeframe_164 <= Period() || shift_0 == iBarShift(NULL, G_timeframe_164, Time[Li_40 - 1])) continue;
      if (Interpolate) {
         datetime_4 = iTime(NULL, G_timeframe_164, shift_0);
         for (int Li_44 = 1; Li_40 + Li_44 < Bars && Time[Li_40 + Li_44] >= datetime_4; Li_44++) {
         }
         Ld_8 = 1.0 / Li_44;
         for (int Li_48 = 1; Li_48 < Li_44; Li_48++) {
            G_ibuf_136[Li_40 + Li_48] = Li_48 * Ld_8 * (G_ibuf_136[Li_40 + Li_44]) + (1.0 - Li_48 * Ld_8) * G_ibuf_136[Li_40];
            G_ibuf_140[Li_40 + Li_48] = Li_48 * Ld_8 * (G_ibuf_140[Li_40 + Li_44]) + (1.0 - Li_48 * Ld_8) * G_ibuf_140[Li_40];
         }
      }
   }
   if (alertsOn) {
      if (alertsOnCurrent) Li_16 = 0;
      else Li_16 = 1;
      if (G_ibuf_144[Li_16] != G_ibuf_144[Li_16 + 1]) {
         if (G_ibuf_144[Li_16] == 1.0) f0_5("Trend UP");
         if (G_ibuf_144[Li_16] == -1.0) f0_5("Trend DOWN");
      }
   }
   return (0);
}

// 2569208C5E61CB15E209FFE323DB48B7
void f0_1(int Ai_0, color A_color_4, int Ai_8, bool Ai_12) {
   string name_16 = arrowsIdentifier + ":" + Time[Ai_0];
   double Ld_24 = 3.0 * iATR(NULL, 0, 20, Ai_0) / 4.0;
   ObjectCreate(name_16, OBJ_ARROW, 0, Time[Ai_0], 0);
   ObjectSet(name_16, OBJPROP_ARROWCODE, Ai_8);
   ObjectSet(name_16, OBJPROP_COLOR, A_color_4);
   if (Ai_12) {
      ObjectSet(name_16, OBJPROP_PRICE1, High[Ai_0] + Ld_24);
      return;
   }
   ObjectSet(name_16, OBJPROP_PRICE1, Low[Ai_0] - Ld_24);
}

// 6ABA3523C7A75AAEA41CC0DEC7953CC5
void f0_2() {
   string name_0;
   string Ls_8 = arrowsIdentifier + ":";
   int str_len_16 = StringLen(Ls_8);
   for (int Li_20 = ObjectsTotal() - 1; Li_20 >= 0; Li_20--) {
      name_0 = ObjectName(Li_20);
      if (StringSubstr(name_0, 0, str_len_16) == Ls_8) ObjectDelete(name_0);
   }
}

// 9B1AEE847CFB597942D106A4135D4FE6
void f0_4(int Ai_0) {
   string name_4 = arrowsIdentifier + ":" + Ai_0;
   ObjectDelete(name_4);
}

// A9B24A824F70CC1232D1C2BA27039E8D
void f0_5(string As_0) {
   string str_concat_8;
   if (Gs_nothing_168 != As_0 || G_time_176 != Time[0]) {
      Gs_nothing_168 = As_0;
      G_time_176 = Time[0];
      str_concat_8 = StringConcatenate(Symbol(), " at ", TimeToStr(TimeLocal(), TIME_SECONDS), " Signal Arrow ", As_0);
      if (alertsMessage) Alert(str_concat_8);
      if (alertsEmail) SendMail(StringConcatenate(Symbol(), "Signal Arrow"), str_concat_8);
      if (alertsSound) PlaySound("alert2.wav");
   }
}

// 09CBB5F5CE12C31A043D5C81BF20AA4A
int f0_0(string As_0) {
   int Li_8;
   for (int Li_12 = StringLen(As_0) - 1; Li_12 >= 0; Li_12--) {
      Li_8 = StringGetChar(As_0, Li_12);
      if ((Li_8 > '`' && Li_8 < '{') || (Li_8 > 'Я' && Li_8 < 256)) As_0 = StringSetChar(As_0, Li_12, Li_8 - 32);
      else
         if (Li_8 > -33 && Li_8 < 0) As_0 = StringSetChar(As_0, Li_12, Li_8 + 224);
   }
   int timeframe_16 = 0;
   if (As_0 == "M1" || As_0 == "1") timeframe_16 = 1;
   if (As_0 == "M5" || As_0 == "5") timeframe_16 = 5;
   if (As_0 == "M15" || As_0 == "15") timeframe_16 = 15;
   if (As_0 == "M30" || As_0 == "30") timeframe_16 = 30;
   if (As_0 == "H1" || As_0 == "60") timeframe_16 = 60;
   if (As_0 == "H4" || As_0 == "240") timeframe_16 = 240;
   if (As_0 == "D1" || As_0 == "1440") timeframe_16 = 1440;
   if (As_0 == "W1" || As_0 == "10080") timeframe_16 = 10080;
   if (As_0 == "MN" || As_0 == "43200") timeframe_16 = 43200;
   if (timeframe_16 == 0 || timeframe_16 < Period()) timeframe_16 = Period();
   return (timeframe_16);
}

// 945D754CB0DC06D04243FCBA25FC0802
string f0_3() {
   switch (G_timeframe_164) {
   case PERIOD_M1:
      return ("M(1)");
   case PERIOD_M5:
      return ("M(5)");
   case PERIOD_M15:
      return ("M(15)");
   case PERIOD_M30:
      return ("M(30)");
   case PERIOD_H1:
      return ("H(1)");
   case PERIOD_H4:
      return ("H(4)");
   case PERIOD_D1:
      return ("D(1)");
   case PERIOD_W1:
      return ("W(1)");
   case PERIOD_MN1:
      return ("MN(1)");
   }
   return ("Unknown timeframe");
}

Recommend