Navigation:Home > Content >

#Web_Breakout.mq4

Time: 2011-02-02 | Download file:#Web_Breakout.mq4

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

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime

extern bool Sound.Alert = TRUE;
extern bool Email.Alerts = FALSE;
double g_ibuf_84[];
double g_ibuf_88[];
int gi_92 = 0;
int g_time_96 = 0;

int init() {
   SetIndexBuffer(0, g_ibuf_84);
   SetIndexBuffer(1, g_ibuf_88);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 218);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 217);
   SetIndexEmptyValue(0, 0.0);
   SetIndexEmptyValue(1, 0.0);
   SetIndexLabel(0, "Up");
   SetIndexLabel(1, "Down");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_8;
   bool li_16;
   double ld_20;
   int li_12 = IndicatorCounted();
   if (li_12 <= 2) li_8 = Bars - li_12 - 3;
   if (li_12 > 2) {
      li_12--;
      li_8 = Bars - li_12 - 1;
   }
   while (li_8 >= 2) {
      li_16 = FALSE;
      ld_20 = High[li_8];
      if (ld_20 > High[li_8 + 1] && ld_20 > High[li_8 + 2] && ld_20 > High[li_8 - 1] && ld_20 > High[li_8 - 2]) {
         li_16 = TRUE;
         g_ibuf_84[li_8] = ld_20;
      }
      if (!li_16 && Bars - li_8 - 1 >= 3) {
         if (ld_20 == High[li_8 + 1] && ld_20 > High[li_8 + 2] && ld_20 > High[li_8 + 3] && ld_20 > High[li_8 - 1] && ld_20 > High[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_84[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 4) {
         if (ld_20 >= High[li_8 + 1] && ld_20 == High[li_8 + 2] && ld_20 > High[li_8 + 3] && ld_20 > High[li_8 + 4] && ld_20 > High[li_8 - 1] && ld_20 > High[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_84[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 5) {
         if (ld_20 >= High[li_8 + 1] && ld_20 == High[li_8 + 2] && ld_20 == High[li_8 + 3] && ld_20 > High[li_8 + 4] && ld_20 > High[li_8 + 5] && ld_20 > High[li_8 - 1] && ld_20 > High[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_84[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 6) {
         if (ld_20 >= High[li_8 + 1] && ld_20 == High[li_8 + 2] && ld_20 >= High[li_8 + 3] && ld_20 == High[li_8 + 4] && ld_20 > High[li_8 + 5] && ld_20 > High[li_8 + 6] &&
            ld_20 > High[li_8 - 1] && ld_20 > High[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_84[li_8] = ld_20;
         }
      }
      li_16 = FALSE;
      ld_20 = Low[li_8];
      if (ld_20 < Low[li_8 + 1] && ld_20 < Low[li_8 + 2] && ld_20 < Low[li_8 - 1] && ld_20 < Low[li_8 - 2]) {
         li_16 = TRUE;
         g_ibuf_88[li_8] = ld_20;
      }
      if (!li_16 && Bars - li_8 - 1 >= 3) {
         if (ld_20 == Low[li_8 + 1] && ld_20 < Low[li_8 + 2] && ld_20 < Low[li_8 + 3] && ld_20 < Low[li_8 - 1] && ld_20 < Low[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_88[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 4) {
         if (ld_20 <= Low[li_8 + 1] && ld_20 == Low[li_8 + 2] && ld_20 < Low[li_8 + 3] && ld_20 < Low[li_8 + 4] && ld_20 < Low[li_8 - 1] && ld_20 < Low[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_88[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 5) {
         if (ld_20 <= Low[li_8 + 1] && ld_20 == Low[li_8 + 2] && ld_20 == Low[li_8 + 3] && ld_20 < Low[li_8 + 4] && ld_20 < Low[li_8 + 5] && ld_20 < Low[li_8 - 1] && ld_20 < Low[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_88[li_8] = ld_20;
         }
      }
      if (!li_16 && Bars - li_8 - 1 >= 6) {
         if (ld_20 <= Low[li_8 + 1] && ld_20 == Low[li_8 + 2] && ld_20 <= Low[li_8 + 3] && ld_20 == Low[li_8 + 4] && ld_20 < Low[li_8 + 5] && ld_20 < Low[li_8 + 6] && ld_20 < Low[li_8 - 1] &&
            ld_20 < Low[li_8 - 2]) {
            li_16 = TRUE;
            g_ibuf_88[li_8] = ld_20;
         }
      }
      li_8--;
   }
   if (Time[0] <= g_time_96 && 1) return (0);
   g_time_96 = Time[0];
   if (gi_92 <= 0) {
      if (g_ibuf_88[2] > 0.0) {
         gi_92 = 1;
         if (Sound.Alert) Alert("Trend (", Symbol(), ", ", Period(), ")  -  Up!!!");
         if (Email.Alerts) SendMail(Symbol() + " " + Period() + ": ", Symbol() + " " + Period() + ": WebBreakout BUY Alert @ " + DoubleToStr(Bid, Digits));
      }
   }
   if (gi_92 >= 0) {
      if (g_ibuf_84[2] > 0.0) {
         gi_92 = -1;
         if (Sound.Alert) Alert("Trend (", Symbol(), ", ", Period(), ")  -  Down!!!");
         if (Email.Alerts) SendMail(Symbol() + " " + Period() + ": ", Symbol() + " " + Period() + ": WebBreakout SELL Alert @ " + DoubleToStr(Bid, Digits));
      }
   }
   return (0);
}

Recommend