Navigation:Home > Content >

7.mq4

Time: 2012-04-02 | Download file:7.mq4

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

double G_ibuf_76[];
double G_ibuf_80[];
extern int Fastsignal = 4;
extern int Slowsignal = 8;
extern bool SoundON = TRUE;
double Gd_96;
double Gd_unused_104 = EMPTY_VALUE;

int init() {
   SetIndexStyle(0, DRAW_ARROW, EMPTY, 3);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, G_ibuf_76);
   SetIndexStyle(1, DRAW_ARROW, EMPTY, 3);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, G_ibuf_80);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int Li_8;
   double ima_12;
   double ima_20;
   double ima_28;
   double ima_36;
   double ima_44;
   double ima_52;
   double Ld_60;
   double Ld_68;
   int Li_76 = IndicatorCounted();
   if (Li_76 < 0) return (-1);
   if (Li_76 > 0) Li_76--;
   int Li_0 = Bars - Li_76;
   for (int Li_4 = 0; Li_4 <= Li_0; Li_4++) {
      Li_8 = Li_4;
      Ld_60 = 0;
      Ld_68 = 0;
      for (Li_8 = Li_4; Li_8 <= Li_4 + 9; Li_8++) Ld_68 += MathAbs(High[Li_8] - Low[Li_8]);
      Ld_60 = Ld_68 / 10.0;
      ima_12 = iMA(NULL, 0, Fastsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      ima_28 = iMA(NULL, 0, Fastsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
      ima_44 = iMA(NULL, 0, Fastsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4 - 1);
      ima_20 = iMA(NULL, 0, Slowsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      ima_36 = iMA(NULL, 0, Slowsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
      ima_52 = iMA(NULL, 0, Slowsignal, 0, MODE_EMA, PRICE_CLOSE, Li_4 - 1);
      if (ima_12 > ima_20 && ima_28 < ima_36 && ima_44 > ima_52) G_ibuf_76[Li_4] = Low[Li_4] - Ld_60 / 2.0;
      else
         if (ima_12 < ima_20 && ima_28 > ima_36 && ima_44 < ima_52) G_ibuf_80[Li_4] = High[Li_4] + Ld_60 / 2.0;
      if (SoundON == TRUE && Li_4 == 1 && G_ibuf_76[Li_4] > G_ibuf_80[Li_4] && Gd_96 != Time[0]) {
         Alert("Sell Signal ", Symbol(), " ", Period());
         Gd_96 = Time[0];
      }
      if (SoundON == TRUE && Li_4 == 1 && G_ibuf_76[Li_4] < G_ibuf_80[Li_4] && Gd_96 != Time[0]) {
         Alert("Buy Signal ", Symbol(), " ", Period());
         Gd_96 = Time[0];
      }
   }
   return (0);
}

Recommend