Navigation:Home > Content >

FXSmooth_USDJPY.mq4

Time: 2010-04-11 | Download file:FXSmooth_USDJPY.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : [email protected]
*/

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green

extern bool soundAlerts = TRUE;
extern bool emailAlerts = FALSE;
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];

int init() {
   if (ObjectType("lbl") != 23) ObjectDelete("lbl");
   if (ObjectFind("lbl") == -1) ObjectCreate("lbl", OBJ_LABEL, 0, Time[5], Close[5]);
   ObjectSetText("lbl", "FXSmooth Indicator | FXSmooth.com");
   ObjectSet("lbl", OBJPROP_FONTSIZE, 12);
   ObjectSet("lbl", OBJPROP_XDISTANCE, 5);
   ObjectSet("lbl", OBJPROP_YDISTANCE, 20);
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_84);
   return (0);
}

int deinit() {
   ObjectDelete("lbl");
   return (0);
}

int start() {
   double ld_16;
   if (ObjectType("lbl") != 23) ObjectDelete("lbl");
   if (ObjectFind("lbl") == -1) ObjectCreate("lbl", OBJ_LABEL, 0, Time[5], Close[5]);
   ObjectSetText("lbl", "FXSmooth Indicator | FXSmooth.com");
   ObjectSet("lbl", OBJPROP_FONTSIZE, 12);
   ObjectSet("lbl", OBJPROP_XDISTANCE, 5);
   ObjectSet("lbl", OBJPROP_YDISTANCE, 20);
   double ld_0 = 50;
   double l_iatr_8 = iATR(Symbol(), 0, 50, 1);
   int l_bars_24 = Bars;
   int l_count_28 = 0;
   int li_32 = ld_0;
   double ld_36 = 0;
   double ld_44 = 0;
   double ld_52 = 0;
   double ld_60 = 0;
   double ld_68 = 0;
   double ld_76 = 0;
   double ld_84 = 0;
   double ld_92 = 0;
   for (int li_100 = l_bars_24 - 1; li_100 >= 0; li_100--) {
      ld_36 = 0;
      ld_44 = 0;
      ld_52 = 0;
      ld_60 = 0;
      ld_68 = 0;
      for (l_count_28 = 0; l_count_28 <= li_32 - 1; l_count_28++) {
         ld_36 += l_count_28;
         ld_44 += Close[li_100 + l_count_28];
         ld_52 += l_count_28 * (Close[li_100 + l_count_28]);
         ld_60 += l_count_28 * l_count_28;
         ld_68 += (Close[li_100 + l_count_28]) * (Close[li_100 + l_count_28]);
      }
      if (li_32 * ld_60 - ld_36 * ld_36 == 0.0) ld_76 = (li_32 * ld_52 - ld_36 * ld_44) / 0.00000001;
      else ld_76 = (li_32 * ld_52 - ld_36 * ld_44) / (li_32 * ld_60 - ld_36 * ld_36);
      ld_84 = (ld_44 + ld_76 * ld_36) / li_32;
      if (MathSqrt((li_32 * ld_60 - ld_36 * ld_36) * (li_32 * ld_68 - ld_44 * ld_44)) == 0.0) ld_92 = (li_32 * ld_52 - ld_36 * ld_44) / 0.00000001;
      else ld_92 = (li_32 * ld_52 - ld_36 * ld_44) / MathSqrt((li_32 * ld_60 - ld_36 * ld_36) * (li_32 * ld_68 - ld_44 * ld_44));
      g_ibuf_84[li_100] = ld_84 - ld_76 * li_32;
   }
   double ld_104 = 0;
   for (li_100 = l_bars_24 - 1; li_100 >= 0; li_100--) {
      if (g_ibuf_84[li_100] > g_ibuf_84[li_100 + 1]) {
         ld_104 += 0.1;
         g_ibuf_92[li_100] = ld_104;
         if (g_ibuf_88[li_100 + 1] != EMPTY_VALUE) g_ibuf_92[li_100 + 1] = g_ibuf_88[li_100 + 1];
      } else {
         ld_104 -= 0.1;
         g_ibuf_88[li_100] = ld_104;
         if (g_ibuf_92[li_100 + 1] != EMPTY_VALUE) g_ibuf_88[li_100 + 1] = g_ibuf_92[li_100 + 1];
      }
   }
   if (g_ibuf_84[1] > g_ibuf_84[2] && g_ibuf_84[2] <= g_ibuf_84[3] && High[0] == Low[0] && High[0] == Close[0] && High[0] == Low[0]) {
      ld_16 = Low[iLowest(Symbol(), 0, MODE_LOW, 4, 0)] - l_iatr_8 / 2.0;
      if (soundAlerts) Alert("Long trade at " + Symbol() + "! Stop Loss at " + ld_16);
      if (emailAlerts) SendMail("Long trade at " + Symbol() + "!", "Long trade at " + Symbol() + "! Stop Loss at " + ld_16);
   }
   if (g_ibuf_84[1] < g_ibuf_84[2] && g_ibuf_84[2] >= g_ibuf_84[3] && High[0] == Low[0] && High[0] == Close[0] && High[0] == Low[0]) {
      ld_16 = High[iHighest(Symbol(), 0, MODE_HIGH, 4, 0)] + l_iatr_8 / 2.0;
      if (soundAlerts) Alert("Short trade at " + Symbol() + "! Stop Loss at " + ld_16);
      if (emailAlerts) SendMail("Short trade at " + Symbol() + "!", "Short trade in at " + Symbol() + "! Stop Loss at " + ld_16);
   }
   return (0);
}

Recommend