Navigation´╝ÜHome > Content >

Guard-Liner.mq4

Time: 2013-01-27 | Download file:Guard-Liner.mq4

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 LimeGreen
#property indicator_color2 OrangeRed
#property indicator_color3 Black
#property indicator_color4 Gold
#property indicator_color5 DeepSkyBlue

double G_ibuf_76[];
double G_ibuf_80[];
double G_ibuf_84[];
double G_ibuf_88[];
double G_ibuf_92[];
extern int period = 10;
extern int price = 0;
extern bool Mode_Fast = FALSE;
extern bool Signals = FALSE;
extern int MA1period = 5;
extern int MA2period = 25;
extern int TypeMA1 = 0;
extern int TypeMA2 = 3;
double Gd_128 = 0.0;
double Gd_136 = 0.0;
double Gd_unused_144 = 0.0;
double Gd_152 = 0.0;
double Gd_160 = 0.0;
double Gd_168 = 0.0;
int Gi_unused_176 = 0;
int Gi_unused_180 = 0;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(0, G_ibuf_76);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(1, G_ibuf_80);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexLabel(2, "line");
   SetIndexBuffer(2, G_ibuf_84);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexLabel(3, "MA1 " + MA1period);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexLabel(4, "MA2 " + MA2period);
   SetIndexBuffer(3, G_ibuf_88);
   SetIndexBuffer(4, G_ibuf_92);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   for (int count_0 = 0; count_0 < Bars; count_0++) {
      ObjectDelete("SELL SIGNAL: " + DoubleToStr(count_0, 0));
      ObjectDelete("BUY SIGNAL: " + DoubleToStr(count_0, 0));
      ObjectDelete("EXIT: " + DoubleToStr(count_0, 0));
   }
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   double price_12;
   double Ld_unused_20;
   int Li_0 = IndicatorCounted();
   double low_28 = 0;
   double high_36 = 0;
   double Ld_44 = 1.2;
   if (Li_0 > 0) Li_0--;
   int Li_8 = Bars - Li_0;
   if (Mode_Fast) Li_8 = 100;
   for (int Li_4 = 0; Li_4 < Li_8; Li_4++) {
      high_36 = High[iHighest(NULL, 0, MODE_HIGH, period, Li_4)];
      low_28 = Low[iLowest(NULL, 0, MODE_LOW, period, Li_4)];
      switch (price) {
      case 1:
         price_12 = Open[Li_4];
         break;
      case 2:
         price_12 = Close[Li_4];
         break;
      case 3:
         price_12 = High[Li_4];
         break;
      case 4:
         price_12 = Low[Li_4];
         break;
      case 5:
         price_12 = (High[Li_4] + Low[Li_4] + Close[Li_4]) / 3.0;
         break;
      case 6:
         price_12 = (Open[Li_4] + High[Li_4] + Low[Li_4] + Close[Li_4]) / 4.0;
         break;
      case 7:
         price_12 = (Open[Li_4] + Close[Li_4]) / 2.0;
         break;
      default:
         price_12 = (High[Li_4] + Low[Li_4]) / 2.0;
      }
      Gd_128 = 0.66 * ((price_12 - low_28) / (high_36 - low_28) - 0.5) + 0.67 * Gd_136;
      Gd_128 = MathMin(MathMax(Gd_128, -0.999), 0.999);
      Gd_152 = MathLog((Gd_128 + 1.0) / (1 - Gd_128)) / 2.0 + Gd_160 / 2.0;
      G_ibuf_76[Li_4] = 0;
      G_ibuf_80[Li_4] = 0;
      if (Gd_152 < 0.0 && Gd_160 > 0.0) {
         if (Signals) {
            ObjectCreate("EXIT: " + DoubleToStr(Li_4, 0), OBJ_TEXT, 0, Time[Li_4], price_12);
            ObjectSetText("EXIT: " + DoubleToStr(Li_4, 0), "EXIT AT " + DoubleToStr(price_12, 4), 7, "Arial", White);
         }
         Gi_unused_176 = 0;
      }
      if (Gd_152 > 0.0 && Gd_160 < 0.0) {
         if (Signals) {
            ObjectCreate("EXIT: " + DoubleToStr(Li_4, 0), OBJ_TEXT, 0, Time[Li_4], price_12);
            ObjectSetText("EXIT: " + DoubleToStr(Li_4, 0), "EXIT AT " + DoubleToStr(price_12, 4), 7, "Arial", White);
         }
         Gi_unused_180 = 0;
      }
      if (Gd_152 >= 0.0) {
         G_ibuf_76[Li_4] = Gd_152;
         G_ibuf_84[Li_4] = Gd_152;
      } else {
         G_ibuf_80[Li_4] = Gd_152;
         G_ibuf_84[Li_4] = Gd_152;
      }
      Ld_unused_20 = Li_4;
      if (Gd_152 < (-Ld_44) && Gd_152 > Gd_160 && Gd_160 <= Gd_168) {
         if (Signals) {
            ObjectCreate("SELL SIGNAL: " + DoubleToStr(Li_4, 0), OBJ_TEXT, 0, Time[Li_4], price_12);
            ObjectSetText("SELL SIGNAL: " + DoubleToStr(Li_4, 0), "SELL AT " + DoubleToStr(price_12, 4), 7, "Arial", Red);
         }
         Gi_unused_180 = 1;
      }
      if (Gd_152 > Ld_44 && Gd_152 < Gd_160 && Gd_160 >= Gd_168) {
         if (Signals) {
            ObjectCreate("BUY SIGNAL: " + DoubleToStr(Li_4, 0), OBJ_TEXT, 0, Time[Li_4], price_12);
            ObjectSetText("BUY SIGNAL: " + DoubleToStr(Li_4, 0), "BUY AT " + DoubleToStr(price_12, 4), 7, "Arial", Lime);
         }
         Gi_unused_176 = 1;
      }
      Gd_136 = Gd_128;
      Gd_168 = Gd_160;
      Gd_160 = Gd_152;
   }
   for (Li_4 = 0; Li_4 < Li_8; Li_4++) G_ibuf_88[Li_4] = iMAOnArray(G_ibuf_84, Bars, MA1period, 0, TypeMA1, Li_4);
   for (Li_4 = 0; Li_4 < Li_8; Li_4++) G_ibuf_92[Li_4] = iMAOnArray(G_ibuf_88, Bars, MA2period, 0, TypeMA2, Li_4);
   return (0);
}

Recommend