Navigation´╝ÜHome > Content >

superfast005.mq4

Time: 2010-05-06 | Download file:superfast005.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.438.3 [-]
   Website: https://purebeam.biz
   E-mail : purebeam@gmail.com
*/

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

extern int PERIOD = 12;
double gd_80 = 1.2;
extern int SL_add_pips = 168;
extern int TP_distance_pips = 323;
extern bool EmailAlerts = TRUE;
extern string text_options = "=== Text Options ===";
extern int X = 10;
extern int Y = 10;
extern int CORNER = 3;
extern string FONT_NAME = "Courier New";
extern int FONT_SIZE = 12;
extern color TEXT_COLOR = Yellow;
int gi_136 = -1;
int g_ma_method_140 = MODE_SMA;
int g_applied_price_144 = PRICE_CLOSE;
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
double g_ibuf_164[];
double g_ibuf_168[];
double g_ibuf_172[];
datetime g_time_176;

void f0_1(string as_0, double ad_8, double ad_16, double ad_24) {
   string ls_32;
   string ls_40;
   string ls_48;
   string ls_56;
   string ls_64;
   if (Time[0] != g_time_176) {
      g_time_176 = Time[0];
      if (ad_24 != 0.0) ls_48 = " at price " + DoubleToStr(ad_24, 4);
      else ls_48 = "";
      if (ad_8 != 0.0) ls_40 = ", TakeProfit on " + DoubleToStr(ad_8, 4);
      else ls_40 = "";
      if (ad_16 != 0.0) ls_32 = ", StopLoss on " + DoubleToStr(ad_16, 4);
      else ls_32 = "";
      Alert("SUPERFAST " + as_0 + ls_48 + ls_40 + ls_32 + " ", Symbol(), ", ", Period(), " minutes chart");
      ls_56 = "SUPERFAST  " + as_0 + ls_48;
      ls_64 = "SUPERFAST  " + as_0 + ls_48 + ls_40 + ls_32 + " " + Symbol() + ", " + Period() + " minutes chart";
      if (EmailAlerts) SendMail(ls_56, ls_64);
   }
}

int init() {
   IndicatorBuffers(7);
   SetIndexBuffer(0, g_ibuf_148);
   SetIndexBuffer(1, g_ibuf_152);
   SetIndexBuffer(2, g_ibuf_156);
   SetIndexBuffer(3, g_ibuf_160);
   SetIndexBuffer(4, g_ibuf_164);
   SetIndexBuffer(5, g_ibuf_168);
   SetIndexBuffer(6, g_ibuf_172);
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexLabel(0, "SUPERFAST ");
   SetIndexLabel(0, "SUPERFAST ");
   SetIndexShift(0, gi_136);
   SetIndexShift(1, gi_136);
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(1, 0);
   IndicatorDigits(Digits);
   IndicatorShortName("SuperFast (" + PERIOD + ")");
   if (PERIOD < 2) PERIOD = 2;
   SetIndexLabel(0, "1");
   SetIndexLabel(1, "2");
   SetIndexLabel(2, "3");
   SetIndexLabel(3, "4");
   SetIndexDrawBegin(0, PERIOD - 1);
   SetIndexDrawBegin(1, PERIOD - 1);
   SetIndexDrawBegin(2, PERIOD - 1);
   SetIndexDrawBegin(3, PERIOD - 1);
   gd_80 /= 100.0;
   return (0);
}

void deinit() {
   ObjectDelete("Text_SIGNAL");
   WindowRedraw();
}

int start() {
   double close_0;
   double ld_8;
   double ld_16;
   int li_24;
   if (Bars <= PERIOD) return (0);
   int ind_counted_28 = IndicatorCounted();
   if (ind_counted_28 < 0) return (-1);
   if (ind_counted_28 == 0) {
      li_24 = Bars - PERIOD - 1;
      for (int index_32 = 0; index_32 < Bars; index_32++) {
         g_ibuf_148[index_32] = 0;
         g_ibuf_152[index_32] = 0;
      }
   } else li_24 = Bars - ind_counted_28 - 1;
   for (int li_36 = li_24; li_36 > 0; li_36--) {
      g_ibuf_164[li_36] = (gd_80 / 100.0 + 1.0) * iMA(NULL, 0, PERIOD, 0, g_ma_method_140, g_applied_price_144, li_36);
      g_ibuf_168[li_36] = (1 - gd_80 / 100.0) * iMA(NULL, 0, PERIOD, 0, g_ma_method_140, g_applied_price_144, li_36);
      g_ibuf_172[li_36] = g_ibuf_172[li_36 + 1];
      if (Close[li_36] > g_ibuf_164[li_36 + 1]) g_ibuf_172[li_36] = 1;
      if (Close[li_36] < g_ibuf_168[li_36 + 1]) g_ibuf_172[li_36] = -1;
      g_ibuf_156[li_36] = 0;
      g_ibuf_160[li_36] = 0;
      if (g_ibuf_172[li_36] > 0.0) {
         if (g_ibuf_168[li_36] < g_ibuf_168[li_36 + 1]) g_ibuf_168[li_36] = g_ibuf_168[li_36 + 1];
         g_ibuf_148[li_36] = g_ibuf_168[li_36];
         if (g_ibuf_172[li_36 + 1] < 0.0) g_ibuf_156[li_36] = Low[li_36] - iATR(NULL, 0, PERIOD, li_36) / 2.0;
         g_ibuf_152[li_36] = 0;
      } else {
         if (g_ibuf_164[li_36] > g_ibuf_164[li_36 + 1]) g_ibuf_164[li_36] = g_ibuf_164[li_36 + 1];
         g_ibuf_152[li_36] = g_ibuf_164[li_36];
         if (g_ibuf_172[li_36 + 1] > 0.0) g_ibuf_160[li_36] = High[li_36] + iATR(NULL, 0, PERIOD, li_36) / 2.0;
         g_ibuf_148[li_36] = 0;
      }
      if (li_36 == 1) {
         close_0 = Close[1];
         if (g_ibuf_156[1] != 0.0 && g_ibuf_160[1] == 0.0) {
            ld_8 = Low[1] - SL_add_pips * Point;
            ld_16 = close_0 + TP_distance_pips * Point;
            f0_1("Buy signal", ld_16, ld_8, close_0);
         }
         if (g_ibuf_160[1] != 0.0 && g_ibuf_156[1] == 0.0) {
            ld_8 = High[1] + SL_add_pips * Point;
            ld_16 = close_0 - TP_distance_pips * Point;
            f0_1("Sell signal", ld_16, ld_8, close_0);
         }
      }
   }
   string ls_40 = "";
   if (g_ibuf_148[1] > 0.0) ls_40 = "LATEST SIGNAL: BUY - TREND BULLISH";
   if (g_ibuf_152[1] > 0.0) ls_40 = "LATEST SIGNAL: SELL - TREND BEARISH";
   f0_0("Text_SIGNAL", ls_40, TEXT_COLOR, X, Y, CORNER);
   return (0);
}

void f0_0(string a_name_0, string a_text_8, color a_color_16, int a_x_20, int a_y_24, int a_corner_28) {
   if (ObjectFind(a_name_0) == 0 || ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0)) {
      ObjectSet(a_name_0, OBJPROP_COLOR, a_color_16);
      ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_20);
      ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_24);
      ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_28);
      ObjectSet(a_name_0, OBJPROP_FONTSIZE, FONT_SIZE);
      ObjectSetText(a_name_0, a_text_8, FONT_SIZE, FONT_NAME);
   }
}

Recommend