Navigation:Home > Content >

Web_TrendZoom.mq4

Time: 2013-03-28 | Download file:Web_TrendZoom.mq4

#property copyright "Copyright © 2012, WebStudio"
#property link      "http://www.websstudio.com"

#property indicator_separate_window
#property indicator_minimum 2.0
#property indicator_maximum 4.0
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Black
#property indicator_color4 Black

extern color BarColorUp = Lime;
extern color BarColorDown = Red;
extern int BarWidth = 3;
extern bool Sound.Alert = TRUE;
extern bool Email.Alerts = TRUE;
int gi_96 = 110;
double g_ibuf_100[];
double g_ibuf_104[];
int g_period_108 = 13;
int g_period_112 = 34;
int g_period_116 = 8;
double g_ibuf_120[];
double g_ibuf_124[];
string g_symbol_128;
string gs_136;
string gs_dummy_144;
int g_digits_152;
int g_timeframe_156;
datetime g_time_160;
string gs_unused_164 = "";
int gi_unused_172 = 16777215;
string gs_176;
string gs_184;
int gi_unused_192;
double gd_196 = 3.0;
int gi_unused_204 = 255;
string g_name_208 = "cmtagtpbi01";
bool gi_216 = FALSE;

int init() {
   gi_unused_192 = 1;
   g_timeframe_156 = Period();
   gs_136 = f0_0(g_timeframe_156);
   g_symbol_128 = Symbol();
   g_digits_152 = Digits;
   gs_184 = "Web_TrendZ00m>>    " + Symbol() + " " + gs_136;
   gs_176 = gs_184 + "0";
   IndicatorShortName(gs_184);
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, BarWidth, BarColorUp);
   SetIndexArrow(0, gi_96);
   SetIndexBuffer(0, g_ibuf_100);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, BarWidth, BarColorDown);
   SetIndexArrow(1, gi_96);
   SetIndexBuffer(1, g_ibuf_104);
   SetIndexBuffer(2, g_ibuf_120);
   SetIndexBuffer(3, g_ibuf_124);
   IndicatorDigits(0);
   return (0);
}

int deinit() {
   ObjectDelete(g_name_208);
   Comment("");
   return (0);
}

int start() {
   int li_8;
   ObjectDelete(g_name_208);
   int li_12 = IndicatorCounted();
   if (li_12 > 0) li_12--;
   if (gi_216) li_8 = Bars - li_12;
   else li_8 = Bars;
   for (int li_16 = 0; li_16 < li_8; li_16++) {
      g_ibuf_104[li_16] = EMPTY_VALUE;
      g_ibuf_100[li_16] = EMPTY_VALUE;
      g_ibuf_120[li_16] = iMA(g_symbol_128, 0, g_period_108, 0, MODE_EMA, PRICE_CLOSE, li_16) - iMA(g_symbol_128, 0, g_period_112, 0, MODE_EMA, PRICE_CLOSE, li_16);
   }
   for (li_16 = 0; li_16 < li_8; li_16++) g_ibuf_124[li_16] = iMAOnArray(g_ibuf_120, Bars, g_period_116, 0, MODE_SMA, li_16);
   for (li_16 = 0; li_16 < li_8; li_16++) {
      if (g_ibuf_120[li_16] < g_ibuf_124[li_16]) g_ibuf_104[li_16] = gd_196;
      else g_ibuf_100[li_16] = gd_196;
   }
   if (li_16 > 100) gi_216 = TRUE;
   if (g_time_160 != Time[0] && Sound.Alert) {
      if (g_ibuf_100[1] == gd_196 && g_ibuf_100[2] != gd_196) {
         g_time_160 = Time[0];
         Alert(g_symbol_128, "  ", gs_136, " BUY  " + DoubleToStr(Close[0], g_digits_152));
         if (Email.Alerts) SendMail(Symbol() + " " + Period() + ": ", Symbol() + " " + Period() + ": TrendZoom BUY Alert @ " + DoubleToStr(Bid, Digits));
      }
      if (g_ibuf_104[1] == gd_196 && g_ibuf_104[2] != gd_196) {
         g_time_160 = Time[0];
         Alert(g_symbol_128, "  ", gs_136, " SELL " + DoubleToStr(Close[0], g_digits_152));
         if (Email.Alerts) SendMail(Symbol() + " " + Period() + ": ", Symbol() + " " + Period() + ": TrendZoom SELL Alert @ " + DoubleToStr(Bid, Digits));
      }
   }
   return (0);
}

string f0_0(int ai_0) {
   string ls_ret_4;
   switch (ai_0) {
   case 1:
      ls_ret_4 = "M1";
      break;
   case 5:
      ls_ret_4 = "M5";
      break;
   case 15:
      ls_ret_4 = "M15";
      break;
   case 30:
      ls_ret_4 = "M30";
      break;
   case 60:
      ls_ret_4 = "H1";
      break;
   case 240:
      ls_ret_4 = "H4";
      break;
   case 1440:
      ls_ret_4 = "D1";
      break;
   case 10080:
      ls_ret_4 = "W1";
      break;
   case 43200:
      ls_ret_4 = "MN";
   }
   return (ls_ret_4);
}

Recommend