Navigation:Home > Content >

PointZero.mq4

Time: 2011-07-15 | Download file:PointZero.mq4

#property copyright "Copyright © Pointzero-indicator.com"
#property link      "http://www.pointzero-indicator.com"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 LightBlue
#property indicator_color2 LightPink
#property indicator_color3 LightBlue
#property indicator_color4 LightPink
#property indicator_color5 DeepSkyBlue
#property indicator_color6 Tomato
#property indicator_color7 Blue
#property indicator_color8 Tomato

int Gia_76[] = {33, 42, 39, 40, 41, 59, 58, 64, 38, 61, 43, 36, 47, 63, 35, 91, 93};
extern bool CalculateOnBarClose = TRUE;
extern bool Signals = TRUE;
extern int ChannelPeriod = 5;
extern int ChannelSize = 2;
extern int Sensitivity = 4;
extern bool DisplayAlerts = FALSE;
extern bool EmailAlerts = FALSE;
extern string AlertCaption = "My Alert Name";
double G_ibuf_116[];
double G_ibuf_120[];
double G_ibuf_124[];
double G_ibuf_128[];
double G_ibuf_132[];
double G_ibuf_136[];
double G_ibuf_140[];
double G_ibuf_144[];
int G_count_148 = 0;
int G_count_152 = 0;
int Gi_156 = EMPTY_VALUE;
int Gi_160 = EMPTY_VALUE;
double Gd_164;
double Gd_172;
string Gs_180;
string Gs_188;
datetime G_time_196;
int Gi_200 = 1;
int Gi_204 = EMPTY_VALUE;
extern string NameSecondIndi = "PointZeroOscillator";

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   string Lsa_0[256];
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(0, G_ibuf_116);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(1, G_ibuf_120);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(2, G_ibuf_124);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(3, G_ibuf_128);
   SetIndexStyle(4, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(4, G_ibuf_132);
   SetIndexStyle(5, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(5, G_ibuf_136);
   SetIndexStyle(6, DRAW_ARROW, STYLE_DOT);
   SetIndexArrow(6, 233);
   SetIndexBuffer(6, G_ibuf_140);
   SetIndexStyle(7, DRAW_ARROW, STYLE_DOT);
   SetIndexArrow(7, 234);
   SetIndexBuffer(7, G_ibuf_144);
   IndicatorShortName("Point Zero");
   switch (Sensitivity) {
   case 5:
      Gd_164 = 0.05;
      Gd_172 = 0.5;
      break;
   case 4:
      Gd_164 = 0.04;
      Gd_172 = 0.4;
      break;
   case 3:
      Gd_164 = 0.03;
      Gd_172 = 0.3;
      break;
   case 2:
      Gd_164 = 0.02;
      Gd_172 = 0.2;
      break;
   case 1:
      Gd_164 = 0.01;
      Gd_172 = 0.1;
      break;
   default:
      Gd_164 = 0.05;
      Gd_172 = 0.5;
   }
   if (ChannelSize < 1) ChannelSize = 1;
   for (int index_8 = 0; index_8 < 256; index_8++) Lsa_0[index_8] = CharToStr(index_8);
   Gs_180 = Lsa_0[104] + Lsa_0[116] + Lsa_0[116] + Lsa_0[112] + Lsa_0[58] + Lsa_0[47] + Lsa_0[47] + Lsa_0[119] + Lsa_0[119] + Lsa_0[119] + Lsa_0[46] + Lsa_0[112] + Lsa_0[111] +
      Lsa_0[105] + Lsa_0[110] + Lsa_0[116] + Lsa_0[122] + Lsa_0[101] + Lsa_0[114] + Lsa_0[111] + Lsa_0[45] + Lsa_0[105] + Lsa_0[110] + Lsa_0[100] + Lsa_0[105] + Lsa_0[99] +
      Lsa_0[97] + Lsa_0[116] + Lsa_0[111] + Lsa_0[114] + Lsa_0[46] + Lsa_0[99] + Lsa_0[111] + Lsa_0[109];
   Gs_188 = Lsa_0[67] + Lsa_0[111] + Lsa_0[112] + Lsa_0[121] + Lsa_0[114] + Lsa_0[105] + Lsa_0[103] + Lsa_0[104] + Lsa_0[116] + Lsa_0[32] + Lsa_0[169] + Lsa_0[32] + Lsa_0[80] +
      Lsa_0[111] + Lsa_0[105] + Lsa_0[110] + Lsa_0[116] + Lsa_0[122] + Lsa_0[101] + Lsa_0[114] + Lsa_0[111] + Lsa_0[45] + Lsa_0[105] + Lsa_0[110] + Lsa_0[100] + Lsa_0[105] +
      Lsa_0[99] + Lsa_0[97] + Lsa_0[116] + Lsa_0[111] + Lsa_0[114] + Lsa_0[46] + Lsa_0[99] + Lsa_0[111] + Lsa_0[109];
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   double Ld_4;
   double Ld_12;
   double icustom_20;
   double icustom_28;
   double isar_36;
   double Ld_44;
   double Ld_52;
   double Ld_60;
   double Ld_68;
   double ihigh_76;
   double ilow_84;
   double iclose_92;
   double iopen_100;
   double iatr_108;
   double Ld_116;
   double Ld_124;
   double Ld_132;
   string Ls_140;
   string Ls_148;
   if (Bars <= 10) return (0);
   int Li_156 = 0;
   int ind_counted_160 = IndicatorCounted();
   int Li_164 = Bars - 1 - ind_counted_160;
   if (ind_counted_160 < 0) return (-1);
   if (CalculateOnBarClose == 1) Li_156 = 1;
   for (int Li_168 = Li_164; Li_168 >= Li_156; Li_168--) {
      Ld_4 = f0_0(Li_168);
      Ld_12 = f0_5(Li_168);
      icustom_20 = iCustom(Symbol(), 0, NameSecondIndi, CalculateOnBarClose, ChannelPeriod, 6, Li_168);
      icustom_28 = iCustom(Symbol(), 0, NameSecondIndi, CalculateOnBarClose, ChannelPeriod, 7, Li_168);
      isar_36 = iSAR(Symbol(), 0, Gd_164, Gd_172, Li_168);
      Ld_44 = f0_1(Li_168, 0);
      Ld_52 = f0_2(Li_168, 0);
      Ld_60 = f0_4(Li_168, 0);
      Ld_68 = f0_3(Li_168, 0);
      ihigh_76 = iHigh(Symbol(), 0, Li_168);
      ilow_84 = iLow(Symbol(), 0, Li_168);
      iclose_92 = iClose(Symbol(), 0, Li_168);
      iopen_100 = iOpen(Symbol(), 0, Li_168);
      iatr_108 = iATR(Symbol(), 0, 30, Li_168);
      Ld_116 = iatr_108 / 10.0 * ChannelSize;
      G_ibuf_116[Li_168] = EMPTY_VALUE;
      G_ibuf_120[Li_168] = EMPTY_VALUE;
      G_ibuf_124[Li_168] = EMPTY_VALUE;
      G_ibuf_128[Li_168] = EMPTY_VALUE;
      G_ibuf_132[Li_168] = EMPTY_VALUE;
      G_ibuf_136[Li_168] = EMPTY_VALUE;
      G_ibuf_140[Li_168] = EMPTY_VALUE;
      G_ibuf_144[Li_168] = EMPTY_VALUE;
      Gi_204 = EMPTY_VALUE;
      Gi_156 = EMPTY_VALUE;
      if (icustom_20 > icustom_28) {
         Ld_124 = icustom_20 + Ld_116;
         Ld_132 = icustom_28 - Ld_116;
         if (Ld_12 < Ld_4 && isar_36 > ihigh_76) {
            Gi_156 = 1;
            if (Li_168 > 0) {
               G_count_152++;
               G_count_148 = 0;
            }
            Ls_140 = "Strong Downtrend";
            Ls_148 = "SELL @ Stop-loss at " + DoubleToStr(isar_36, Digits);
            if (Gi_160 != TRUE && Signals == TRUE) {
               G_ibuf_144[Li_168 + 2] = EMPTY_VALUE;
               G_ibuf_144[Li_168 + 3] = EMPTY_VALUE;
               if (Ld_44 != 0.0) G_ibuf_144[Li_168 + 2] = Ld_44;
               else {
                  if (Ld_60 != 0.0) G_ibuf_144[Li_168 + 3] = Ld_60;
                  else G_ibuf_144[Li_168 + 2] = isar_36;
               }
               if (Li_168 > 0) {
                  Gi_204 = 1;
                  Gi_160 = TRUE;
               }
            }
         } else {
            Ls_148 = "Trail stop-loss to " + DoubleToStr(icustom_28, Digits);
            Ls_140 = "Downtrend";
            if (Li_168 > 0) {
               G_count_152 = 0;
               G_count_148 = 0;
            }
         }
         if (Gi_156 == 1 && G_count_152 <= 5) {
            G_ibuf_120[Li_168] = 0;
            G_ibuf_116[Li_168] = 0;
            G_ibuf_136[Li_168] = Ld_124;
            G_ibuf_132[Li_168] = Ld_132;
         } else {
            G_ibuf_120[Li_168] = Ld_124;
            G_ibuf_116[Li_168] = Ld_132;
            G_ibuf_132[Li_168] = 0;
            G_ibuf_136[Li_168] = 0;
         }
         G_ibuf_128[Li_168] = Ld_132;
         G_ibuf_124[Li_168] = Ld_124;
      } else {
         Ld_124 = icustom_20 - Ld_116;
         Ld_132 = icustom_28 + Ld_116;
         if (Ld_12 > Ld_4 && isar_36 < ilow_84) {
            Gi_156 = 0;
            if (Li_168 > 0) {
               G_count_148++;
               G_count_152 = 0;
            }
            Ls_140 = "Strong Uptrend";
            Ls_148 = "BUY @ Stop-loss at " + DoubleToStr(isar_36, Digits);
            if (Gi_160 != FALSE && Signals == TRUE) {
               G_ibuf_140[Li_168 + 2] = EMPTY_VALUE;
               G_ibuf_140[Li_168 + 3] = EMPTY_VALUE;
               if (Ld_52 != 0.0) G_ibuf_140[Li_168 + 2] = Ld_52;
               else {
                  if (Ld_68 != 0.0) G_ibuf_140[Li_168 + 3] = Ld_68;
                  else G_ibuf_140[Li_168 + 2] = isar_36;
               }
               if (Li_168 > 0) {
                  Gi_204 = 0;
                  Gi_160 = FALSE;
               }
            }
         } else {
            Ls_148 = "Trail stop-loss to " + DoubleToStr(icustom_20, Digits);
            Ls_140 = "Uptrend";
            if (Li_168 > 0) {
               G_count_152 = 0;
               G_count_148 = 0;
            }
         }
         if (Gi_156 == 0 && G_count_148 <= 5) {
            G_ibuf_120[Li_168] = 0;
            G_ibuf_116[Li_168] = 0;
            G_ibuf_136[Li_168] = Ld_124;
            G_ibuf_132[Li_168] = Ld_132;
         } else {
            G_ibuf_120[Li_168] = Ld_124;
            G_ibuf_116[Li_168] = Ld_132;
            G_ibuf_132[Li_168] = 0;
            G_ibuf_136[Li_168] = 0;
         }
         G_ibuf_128[Li_168] = Ld_124;
         G_ibuf_124[Li_168] = Ld_132;
      }
      Comment("\n---\n" + "POINT ZERO INDICATOR\n" + "---\n" + "Trend: " + Ls_140 
         + "\n" 
         + "Suggestion: " + Ls_148 
      + "\n---\n" + Gs_188);
   }
   if (G_time_196 != Time[0]) {
      if (Gi_204 == 0 && Gi_200 == FALSE) {
         if (DisplayAlerts == TRUE) Alert("Point Zero (" + AlertCaption + ") [" + Symbol() + "] Change to Uptrend");
         if (EmailAlerts == TRUE) SendMail("Point Zero (" + AlertCaption + ") [" + Symbol() + "]", Symbol() + ": Change to Uptrend");
      } else {
         if (Gi_204 == 1 && Gi_200 == FALSE) {
            if (DisplayAlerts == TRUE) Alert("Point Zero (" + AlertCaption + ") [" + Symbol() + "] Change to Downtrend");
            if (EmailAlerts == TRUE) SendMail("Point Zero (" + AlertCaption + ") [" + Symbol() + "]", Symbol() + ": Change to Downtrend");
         }
      }
      G_time_196 = Time[0];
      Gi_200 = FALSE;
   }
   return (0);
}

// 50257C26C4E5E915F022247BABD914FE
double f0_0(int Ai_0 = 1) {
   return (iCustom(Symbol(), 0, "Heiken Ashi", 2, Ai_0));
}

// A9B24A824F70CC1232D1C2BA27039E8D
double f0_5(int Ai_0 = 1) {
   return (iCustom(Symbol(), 0, "Heiken Ashi", 3, Ai_0));
}

// 667DC3F4F5B9C0B70229F573988AC7C0
double f0_1(int Ai_0 = 1, bool Ai_4 = FALSE) {
   double ihigh_8 = iHigh(Symbol(), 0, Ai_0 + 2);
   double ihigh_16 = iHigh(Symbol(), 0, Ai_0);
   double ihigh_24 = iHigh(Symbol(), 0, Ai_0 + 1);
   double ihigh_32 = iHigh(Symbol(), 0, Ai_0 + 3);
   double ihigh_40 = iHigh(Symbol(), 0, Ai_0 + 4);
   double ilow_48 = iLow(Symbol(), 0, Ai_0);
   double ilow_56 = iLow(Symbol(), 0, Ai_0 + 3);
   if (ihigh_8 > ihigh_16 && ihigh_8 > ihigh_24 && ihigh_8 > ihigh_32 && ihigh_8 > ihigh_40 && Ai_4 == FALSE && ilow_48 < ilow_56) return (ihigh_8);
   return (0);
}

// 945D754CB0DC06D04243FCBA25FC0802
double f0_2(int Ai_0 = 1, bool Ai_4 = FALSE) {
   double ilow_8 = iLow(Symbol(), 0, Ai_0 + 2);
   double ilow_16 = iLow(Symbol(), 0, Ai_0);
   double ilow_24 = iLow(Symbol(), 0, Ai_0 + 1);
   double ilow_32 = iLow(Symbol(), 0, Ai_0 + 3);
   double ilow_40 = iLow(Symbol(), 0, Ai_0 + 4);
   double ihigh_48 = iHigh(Symbol(), 0, Ai_0);
   double ihigh_56 = iHigh(Symbol(), 0, Ai_0 + 3);
   if (ilow_8 < ilow_16 && ilow_8 < ilow_24 && ilow_8 < ilow_32 && ilow_8 < ilow_40 && Ai_4 == FALSE && ihigh_48 > ihigh_56) return (ilow_8);
   return (0);
}

// A0F6E6535C856D4495BA899376567E48
double f0_4(int Ai_0 = 1, bool Ai_4 = FALSE) {
   double ihigh_8 = iHigh(Symbol(), 0, Ai_0 + 3);
   double ihigh_16 = iHigh(Symbol(), 0, Ai_0);
   double ihigh_24 = iHigh(Symbol(), 0, Ai_0 + 1);
   double ihigh_32 = iHigh(Symbol(), 0, Ai_0 + 2);
   double ihigh_40 = iHigh(Symbol(), 0, Ai_0 + 4);
   double ihigh_48 = iHigh(Symbol(), 0, Ai_0 + 5);
   double ihigh_56 = iHigh(Symbol(), 0, Ai_0 + 6);
   double ilow_64 = iLow(Symbol(), 0, Ai_0);
   double ilow_72 = iLow(Symbol(), 0, Ai_0 + 5);
   if (ihigh_8 > ihigh_16 && ihigh_8 > ihigh_24 && ihigh_8 > ihigh_32 && ihigh_8 > ihigh_40 && ihigh_8 > ihigh_48 && ihigh_8 > ihigh_56 && Ai_4 == FALSE && ilow_64 < ilow_72) return (ihigh_8);
   return (0);
}

// 9B1AEE847CFB597942D106A4135D4FE6
double f0_3(int Ai_0 = 1, bool Ai_4 = FALSE) {
   double ilow_8 = iLow(Symbol(), 0, Ai_0 + 3);
   double ilow_16 = iLow(Symbol(), 0, Ai_0);
   double ilow_24 = iLow(Symbol(), 0, Ai_0 + 1);
   double ilow_32 = iLow(Symbol(), 0, Ai_0 + 2);
   double ilow_40 = iLow(Symbol(), 0, Ai_0 + 4);
   double ilow_48 = iLow(Symbol(), 0, Ai_0 + 5);
   double ilow_56 = iLow(Symbol(), 0, Ai_0 + 6);
   double ihigh_64 = iHigh(Symbol(), 0, Ai_0);
   double ihigh_72 = iHigh(Symbol(), 0, Ai_0 + 5);
   if (ilow_8 < ilow_16 && ilow_8 < ilow_24 && ilow_8 < ilow_32 && ilow_8 < ilow_40 && ilow_8 < ilow_48 && ilow_8 < ilow_56 && Ai_4 == FALSE && ihigh_64 > ihigh_72) return (ilow_8);
   return (0);
}

Recommend