TRUE Forex

Просмотр кода форекс индикатора !!X12-MT4 4XTRAP.mq4

#property indicator_chart_window
#property indicator_buffers 8

#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Red
#property indicator_color7 Lime
#property indicator_color8 DodgerBlue

#property indicator_width1 3
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2
#property indicator_width7 2
#property indicator_width8 3

double g_ibuf_76[];
double g_ibuf_80[];
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
string gs_unused_108 = "L1";
string gs_unused_116 = "L2";
string gs_unused_124 = "H1";
string gs_unused_132 = "H2";
string gs_unused_140 = "L3";
string gs_unused_148 = "H3";
string gs_unused_156 = "L4";
string gs_unused_164 = "H4";
int g_fontsize_172 = 8;
double gd_176;
double gd_184;
double gd_192;
double gd_200;
double gd_208;
double gd_216;
double gd_224;
double gd_232;
double g_timeframe_240;
int gi_248 = 1;
int gi_252;
extern int Start_Time = 2;
double gd_460;
double gd_468;
double gd_476;
double gd_484;

int deinit() {
   ObjectDelete("L1");
   ObjectDelete("H1");
   ObjectDelete("L2");
   ObjectDelete("H2");
   ObjectDelete("L3");
   ObjectDelete("H3");
   ObjectDelete("L4");
   ObjectDelete("H4");
   
      ObjectDelete("R1");
      ObjectDelete("R2");
      ObjectDelete("R3");
      ObjectDelete("R4");
      
      ObjectDelete("S1");
      ObjectDelete("S2");
      ObjectDelete("S3");
      ObjectDelete("S4");
      
   return (0);
}

int init() {
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_NONE);
   SetIndexStyle(2, DRAW_NONE);
   SetIndexStyle(3, DRAW_NONE);
   SetIndexStyle(4, DRAW_NONE);
   SetIndexStyle(5, DRAW_NONE);
   SetIndexStyle(6, DRAW_NONE);
   SetIndexStyle(7, DRAW_NONE);
   SetIndexBuffer(0, g_ibuf_104);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_88);
   SetIndexBuffer(3, g_ibuf_96);
   SetIndexBuffer(4, g_ibuf_84);
   SetIndexBuffer(5, g_ibuf_100);
   SetIndexBuffer(6, g_ibuf_80);
   SetIndexBuffer(7, g_ibuf_76);
   string ls_0 = "4XTRAP";
   IndicatorShortName(ls_0);
   SetIndexLabel(0, ls_0);
   SetIndexDrawBegin(0, 1);
   return (0);
}

int start() {
   double lda_12[20];
   double lda_16[20];
   int l_ind_counted_0 = IndicatorCounted();
   int li_44 = 1;
   ArrayResize(lda_12, gi_248);
   ArrayResize(lda_16, gi_248);
   ArrayInitialize(lda_12, 0);
   ArrayInitialize(lda_16, 0);
   ArrayCopySeries(lda_16, 1, Symbol(), PERIOD_D1);
   ArrayCopySeries(lda_12, 2, Symbol(), PERIOD_D1);
   double ld_36 = lda_16[1];
   double ld_28 = lda_12[1];
   for (li_44 = 1; li_44 < gi_248; li_44++)
      if (ld_36 > lda_16[li_44]) ld_36 = lda_16[li_44];
   for (li_44 = 1; li_44 < gi_248; li_44++)
      if (ld_28 < lda_12[li_44]) ld_28 = lda_12[li_44];
   if (l_ind_counted_0 == 0) {
      g_timeframe_240 = Period();
      if (g_timeframe_240 > 240.0) return (-1);
      ObjectCreate("L2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("L2", "                 Sell TP1", g_fontsize_172, "Arial", White);
      ObjectCreate("H2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("H2", "                 Buy TP1", g_fontsize_172, "Arial", White);
      ObjectCreate("L3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("L3", "                 Sell TP2", g_fontsize_172, "Arial", White);
      ObjectCreate("H3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("H3", "                 Buy TP2", g_fontsize_172, "Arial", White);
      ObjectCreate("L4", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("L4", "                 Sell TP3", g_fontsize_172, "Arial", White);
      ObjectCreate("H4", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("H4", "                 Buy TP3", g_fontsize_172, "Arial", White);
      ObjectCreate("L1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("L1", "               OP Sell", g_fontsize_172, "Arial", White);
      ObjectCreate("H1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("H1", "               OP Buy", g_fontsize_172, "Arial", White);
   }
   if (l_ind_counted_0 < 0) return (-1);
   int li_4 = Bars - l_ind_counted_0 - 1;
   for (int li_8 = li_4; li_8 >= 0; li_8--) {
      if (TimeDay(Time[li_8]) != TimeDay(Time[li_8 + 1])) {
         gi_252 = (ld_28 - ld_36) / Point;
         gd_460 = gi_252 / 2.5 * Point;
         gd_468 = 1.000 * gi_252 * Point;
         gd_476 = 1.500 * gi_252 * Point;
         gd_484 = 2.000 * gi_252 * Point;
         gd_224 = gd_460 + (Open[li_8 - Start_Time]);
         gd_200 = gd_468 + (Open[li_8 - Start_Time]);
         gd_208 = gd_476 + (Open[li_8 - Start_Time]);
         gd_216 = gd_484 + (Open[li_8 - Start_Time]);
         gd_232 = Open[li_8 - Start_Time] - gd_460;
         gd_176 = Open[li_8 - Start_Time] - gd_468;
         gd_184 = Open[li_8 - Start_Time] - gd_476;
         gd_192 = Open[li_8 - Start_Time] - gd_484;
         ObjectMove("L1", 0, Time[li_8 - Start_Time], gd_232);
         ObjectMove("H1", 0, Time[li_8 - Start_Time], gd_224);
         ObjectMove("L2", 0, Time[li_8 - Start_Time], gd_176);
         ObjectMove("H2", 0, Time[li_8 - Start_Time], gd_200);
         ObjectMove("L3", 0, Time[li_8 - Start_Time], gd_184);
         ObjectMove("H3", 0, Time[li_8 - Start_Time], gd_208);
         ObjectMove("L4", 0, Time[li_8 - Start_Time], gd_192);
         ObjectMove("H4", 0, Time[li_8 - Start_Time], gd_216);
      }
      g_ibuf_104[li_8 - Start_Time] = gd_232;
      g_ibuf_92[li_8 - Start_Time] = gd_176;
      g_ibuf_96[li_8 - Start_Time] = gd_184;
      g_ibuf_100[li_8 - Start_Time] = gd_192;
      g_ibuf_76[li_8 - Start_Time] = gd_224;
      g_ibuf_88[li_8 - Start_Time] = gd_200;
      g_ibuf_84[li_8 - Start_Time] = gd_208;
      g_ibuf_80[li_8 - Start_Time] = gd_216;
   }
   
   ObjectDelete("R1");
   ObjectCreate("R1", OBJ_TREND, 0, Time[0], g_ibuf_104[0], Time[24], g_ibuf_104[0]);
   ObjectSet("R1", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R1", OBJPROP_WIDTH, 3);
   ObjectSet("R1", OBJPROP_COLOR, DodgerBlue);  ObjectSet("R1", OBJPROP_BACK, 1);
   ObjectSet("R1", OBJPROP_RAY, 0); ObjectMove("R1", 0, Time[0],  g_ibuf_104[0]);
   
   ObjectDelete("R2");
   ObjectCreate("R2", OBJ_TREND, 0, Time[0], g_ibuf_96[0], Time[24], g_ibuf_96[0]);
   ObjectSet("R2", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R2", OBJPROP_WIDTH, 3);
   ObjectSet("R2", OBJPROP_COLOR, Crimson);  ObjectSet("R2", OBJPROP_BACK, 1);
   ObjectSet("R2", OBJPROP_RAY, 0); ObjectMove("R2", 0, Time[0],  g_ibuf_96[0]);
   
   ObjectDelete("R3");
   ObjectCreate("R3", OBJ_TREND, 0, Time[0], g_ibuf_92[0], Time[24], g_ibuf_92[0]);
   ObjectSet("R3", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R3", OBJPROP_WIDTH, 3);
   ObjectSet("R3", OBJPROP_COLOR, Crimson);  ObjectSet("R3", OBJPROP_BACK, 1);
   ObjectSet("R3", OBJPROP_RAY, 0); ObjectMove("R3", 0, Time[0],  g_ibuf_92[0]);
   
   ObjectDelete("R4");
   ObjectCreate("R4", OBJ_TREND, 0, Time[0], g_ibuf_100[0], Time[24], g_ibuf_100[0]);
   ObjectSet("R4", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R4", OBJPROP_WIDTH, 3);
   ObjectSet("R4", OBJPROP_COLOR, Crimson);  ObjectSet("R4", OBJPROP_BACK, 1);
   ObjectSet("R4", OBJPROP_RAY, 0); ObjectMove("R4", 0, Time[0],  g_ibuf_100[0]);
   
   ObjectDelete("S1");
   ObjectCreate("S1", OBJ_TREND, 0, Time[0], g_ibuf_76[0], Time[24], g_ibuf_76[0]);
   ObjectSet("S1", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S1", OBJPROP_WIDTH, 3);
   ObjectSet("S1", OBJPROP_COLOR, DodgerBlue);  ObjectSet("S1", OBJPROP_BACK, 1);
   ObjectSet("S1", OBJPROP_RAY, 0); ObjectMove("S1", 0, Time[0],  g_ibuf_76[0]);
   
   ObjectDelete("S2");
   ObjectCreate("S2", OBJ_TREND, 0, Time[0], g_ibuf_88[0], Time[24], g_ibuf_88[0]);
   ObjectSet("S2", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S2", OBJPROP_WIDTH, 3);
   ObjectSet("S2", OBJPROP_COLOR, Lime);  ObjectSet("S2", OBJPROP_BACK, 1);
   ObjectSet("S2", OBJPROP_RAY, 0); ObjectMove("S2", 0, Time[0],  g_ibuf_88[0]);
   
   ObjectDelete("S3");
   ObjectCreate("S3", OBJ_TREND, 0, Time[0], g_ibuf_84[0], Time[24], g_ibuf_84[0]);
   ObjectSet("S3", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S3", OBJPROP_WIDTH, 3);
   ObjectSet("S3", OBJPROP_COLOR, Lime);  ObjectSet("S3", OBJPROP_BACK, 1);
   ObjectSet("S3", OBJPROP_RAY, 0); ObjectMove("S3", 0, Time[0],  g_ibuf_84[0]);
   
   ObjectDelete("S4");
   ObjectCreate("S4", OBJ_TREND, 0, Time[0], g_ibuf_80[0], Time[24], g_ibuf_80[0]);
   ObjectSet("S4", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S4", OBJPROP_WIDTH, 3);
   ObjectSet("S4", OBJPROP_COLOR, Lime);  ObjectSet("S4", OBJPROP_BACK, 1);
   ObjectSet("S4", OBJPROP_RAY, 0); ObjectMove("S4", 0, Time[0],  g_ibuf_80[0]);
   
 /*  Comment("                                                                    ", 
      "\n", "-----------------------------------------------------------------------------------------------------", 
      "\n", "        KG_Trapping Mode V2 --> Start_Time input is value 0 to 23", 
      "\n", "-----------------------------------------------------------------------------------------------------", 
      "\n", "                                                                    ", 
      "\n", "Buy Stop: ", gd_224, "   SL: ", gd_232, "   TP1: ", gd_200, "   TP2: ", gd_208, "   TP3: ", gd_216, 
   "\n", "Sell  Stop: ", gd_232, "   SL: ", gd_224, "   TP1: ", gd_176, "   TP2: ", gd_184, "   TP3: ", gd_192);*/
   return (0);
}

Комментарии к исходному коду форекс индикатора !!X12-MT4 4XTRAP.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !!X12-MT4 4XTRAP v2.mq4
индикатор !!X13-MT4 WOODIES-CCI.mq4 »