TRUE Forex

Просмотр кода форекс советника Cheytach_EA_sym.mq4

#property copyright "Copyright 2013, Unknown Software Corp."
#property link      "http://www.cheytach.com"

 // made minor chenges, bug fixed
 // please be sure to have zigzag indicator in your folder
 // by sym  

//int G_acc_number_76 = 0;
//string Gs_80 = "2020.09.30 00:00";
extern int Magic = 123456;
extern double Lots = 0.01;
extern double Lots_Averaging_Plus = 0.01;
extern bool Auto_Lot = FALSE;
extern double Equity_Stop = 10000.0;
extern bool Hiden_TP = FALSE;
extern int TP = 30;
extern int SL = 0;
extern bool Trailing = FALSE;
extern int TS = 25;
extern int TS_Start = 10;
extern bool Close_By_SIgnal = TRUE;
extern bool Must_Profit = TRUE;
extern double Minimum_Profit = 2.0;
extern string Time_Info = "Time Trading Server";
extern int OpenHour = 0;
extern int CloseHour = 24;
int Gi_176 = 300;
extern string Coment1 = "ea ";
extern string _ = "=================================";
string Gs_196 = "Chey_Tach_1";
extern double Period1 = 5.0;
extern double Period2 = 12.0;
extern double Period3 = 35.0;
extern string Dev_Step_1 = "1,3";
extern string Dev_Step_2 = "1,3";
extern string Dev_Step_3 = "1,3";
extern int Symbol_1_Kod = 159;
extern int Symbol_2_Kod = 164;
extern int Symbol_3_Kod = 164;
extern string _____ = "";
extern bool Box.Alerts = FALSE;
extern bool Email.Alerts = FALSE;
extern bool Alert.Lv1 = FALSE;
extern bool Alert.Lv2 = FALSE;
extern bool Alert.Lv3 = FALSE;
string Gs_unused_292 = "Chey_Tach_2";
extern int Sift_x = 1;
extern int Sift_s = 1;
extern bool Averaging_Marti = TRUE;
extern int Step_Averaging = 20;
extern double Multiplier = 1.6;
extern bool Averaging_In_Next_Signal = TRUE;
extern int Max_OP = 15;
extern double TP_Money_Averaging = 4.0;
extern bool Hedging_Marti = FALSE;
extern int Step_Hedging = 20;
extern double Multiplier_Hedging = 2.0;
extern int Max_OP_Hedging = 20;
extern double TP_Money_Hedging = 1.0;
extern bool Averaging_Plus = FALSE;
extern int Step_Minimum = 10;
bool Gi_376 = FALSE;
bool Gi_380 = FALSE;
bool Gi_384 = FALSE;
bool Gi_388 = FALSE;
int Gi_unused_392 = 2;
string Gs_unused_396 = "WAIT";
bool Gi_404 = FALSE;
//string Gs_unused_408 = "terminal_dir \\ experts \\ files  ";
//string Gs_unused_416 = "terminal_dir \\ tester \\ files   ";
int Gi_unused_424 = 0;
double Gd_428;
double Gd_unused_436;
double Gd_444;
double Gd_452;
double G_spread_460;
double G_stoplevel_468;
bool Gi_unused_484 = TRUE;
bool Gi_unused_488 = TRUE;
bool Gi_496 = FALSE;
bool Gi_500 = FALSE;


// 1414C9756505DDFB8BA0A3B6FC9D691F
double f0_1(int Ai_0, int Ai_4) {
   double icustom_8 = iCustom(Symbol(), 0, Gs_196, Period1, Period2, Period3, Dev_Step_1, Dev_Step_2, Dev_Step_3, Symbol_1_Kod, Symbol_2_Kod, Symbol_3_Kod, _____, Box.Alerts,
      Email.Alerts, Alert.Lv1, Alert.Lv2, Alert.Lv3, Ai_0, Ai_4);
   if (icustom_8 > 99999.0) icustom_8 = 0;
   return (icustom_8);
}
                                                                                                                                                                                                                                                                                                                                                                                                                   
// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   string Ls_40;
   string Ls_48;
   Gd_unused_436 = Time[1];
   Gi_unused_392 = 2;
   if (Digits == 5 || Digits == 3 || Symbol() == "GOLD" || Symbol() == "GOLD." || Symbol() == "GOLDm") Gd_428 = 10.0 * Point;
   else Gd_428 = Point;
   string Ls_0 = " " + WindowExpertName() + " & Waiting New Tick";
   string Ls_8 = " INSTALING";
   int Li_16 = 1;
   int Li_20 = 1;
   int count_24 = 0;
   double bid_28 = Bid;
   if (!IsTradeAllowed()) Alert("ALLOW LIVE TRADING NOT CECKLIST !");
   if (!IsExpertEnabled()) {
      Alert("EXPERT ADVISORT IS DISABLE ");
      Comment("EXPERT ADVISORT IS DISABLE");
      return (0);
   }
   for (int count_36 = 0; count_36 < 10000; count_36++) {
      RefreshRates();
      Li_20++;
      if (Li_20 > 10) Li_20 = 11;
      if (Li_20 > 10) Li_16++;
      if (Li_16 > StringLen(Ls_0)) Li_16 = 0;
      Ls_40 = StringSubstr(Ls_0, 0, Li_16);
      Ls_48 = StringSubstr(Ls_8, 0, Li_20);
      Comment(Ls_48, " ", Ls_40);
      count_24++;
      if (count_24 > 10) {
         PlaySound("wait.wav");
         count_24 = 0;
      }
      Sleep(100);
      if (bid_28 != Bid) break;
   }
   Comment("SUCCEDED");
   PlaySound("Connect.wav");
   start();
   return (0);
}
                                                                                                                                                                                                                                                                                                                                                                                                             
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   Comment("");
   return (0);
}
                                                                                                                                                                                                                                                                                                                                                                               
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   double Ind2=iCustom(Symbol(),0,"Chey_Tach_2",0,0);
   double Ld_20;
   double Ld_28;
   double Ld_48;
   double Ld_56;
   double Ld_76;
   double Ld_84;
   double Ld_92;
   double Ld_100;
   string text_152;
   string text_160;
   string text_168;
   string text_176;
   string text_184;
   double Ld_192;
   double Ld_200;
   double Ld_208;
   double Ld_216;
   double Ld_224;
   double Ld_232;
   double Ld_240;
   if (Hiden_TP) {
      if (f0_10("b", Magic) > 0.0) {
         if (TP > 0 && Bid >= ObjectGet("TPB", OBJPROP_PRICE1)) Gi_496 = TRUE;
         if (Bid <= ObjectGet("SLB", OBJPROP_PRICE1)) Gi_496 = TRUE;
         if (Gi_496) {
            f0_8(OP_BUY, Magic);
            if (f0_10("b", Magic) > 0.0) return;
            Gi_496 = FALSE;
         }
      } else {
         f0_4("TPB", 9999, Gold);
         f0_4("SLB", 0, Gold);
      }
      if (f0_10("s", Magic) > 0.0) {
         if (TP > 0 && Ask <= ObjectGet("TPS", OBJPROP_PRICE1)) Gi_500 = TRUE;
         if (Ask >= ObjectGet("SLS", OBJPROP_PRICE1)) Gi_500 = TRUE;
         if (Gi_500) {
            f0_8(OP_SELL, Magic);
            if (f0_10("s", Magic) > 0.0) return;
            Gi_500 = FALSE;
         }
      } else {
         f0_4("TPS", 0, Gold);
         f0_4("SLS", 9999, Gold);
      }
   }
   bool Li_0 = FALSE;
   bool Li_4 = FALSE;
   string Ls_8 = "WAIT";
   for (int count_16 = 0; count_16 < 1000; count_16++) {
      Ld_20 = f0_1(4, count_16);
      Ld_28 = f0_1(5, count_16);
      if (Ld_20 > 0.0) {
         Ls_8 = "BUY";
         break;
      }
      if (Ld_28 > 0.0) {
         Ls_8 = "SELL";
         break;
      }
   }
   string Ls_36 = "WAIT";
   for (int index_44 = 0; index_44 < 1000; index_44++) {
      Ld_48 = ObjectGet("up_" + Time[index_44], OBJPROP_PRICE1);
      Ld_56 = ObjectGet("do_" + Time[index_44], OBJPROP_PRICE1);
      if (Ld_48 > 0.0) {
         Ls_36 = "BUY";
         break;
      }
      if (Ld_56 > 0.0) {
         Ls_36 = "SELL";
         break;
      }
   }
   string Ls_64 = "WAIT";
   for (int index_72 = 0; index_72 < 10000; index_72++) {
      Ld_76 = ObjectGet("up_" + Time[index_72], OBJPROP_PRICE1);
      Ld_84 = ObjectGet("do_" + Time[index_72], OBJPROP_PRICE1);
      Ld_92 = f0_1(4, index_72);
      Ld_100 = f0_1(5, index_72);
      if (Ld_92 > 0.0 && Ld_76 > 0.0) {
         Ls_64 = "BUY";
         break;
      }
      if (Ld_100 > 0.0 && Ld_84 > 0.0) {
         Ls_64 = "SELL";
         break;
      }
   }
   bool Li_108 = FALSE;
   bool Li_112 = FALSE;
   if (Ls_8 == "BUY" && Sift_x >= count_16 && Ls_36 == "BUY" && Sift_s >= index_44) Li_108 = TRUE;
   if (Ls_8 == "SELL" && Sift_x >= count_16 && Ls_36 == "SELL" && Sift_s >= index_44) Li_112 = TRUE;
   if (Close_By_SIgnal && Li_112 && !Must_Profit || f0_10("pfb", Magic) + f0_10("pfs", Magic) > Minimum_Profit) f0_8(OP_BUY, Magic);
   if (Close_By_SIgnal && Li_108 && !Must_Profit || f0_10("pfs", Magic) + f0_10("pfb", Magic) > Minimum_Profit) f0_8(OP_SELL, Magic);
   double Ld_116 = Lots;
   double Ld_124 = Lots;
   double Ld_132 = 0;
   string comment_140 = Coment1;
   if (Averaging_Marti) {
      Ld_132 = TP_Money_Averaging;
      if (f0_10("b", Magic) > 0.0) {
         if (f0_10("pfb", Magic) >= TP_Money_Averaging && f0_10("b", Magic) > 1.0 && f0_10("af", Magic) > 0.0) Gi_380 = TRUE;
         if ((!Averaging_In_Next_Signal) || Li_108 && f0_10("pb", Magic) - Ask >= Step_Averaging * Gd_428) {
            comment_140 = "A - " + Coment1;
            Li_0 = TRUE;
            Ld_116 = NormalizeDouble(f0_10("lb", Magic) * Multiplier,2); //<---------------- normalized lots
         } else Li_0 = FALSE;
      } else
         if (f0_10("b", Magic) < 1.0) Li_0 = Li_108;
      if (f0_10("s", Magic) > 0.0) {
         if (f0_10("pfs", Magic) >= TP_Money_Averaging && f0_10("s", Magic) > 1.0 && f0_10("af", Magic) > 0.0) Gi_376 = TRUE;
         if ((!Averaging_In_Next_Signal) || Li_112 && Bid - f0_10("ps", Magic) >= Step_Averaging * Gd_428) {
            comment_140 = "A - " + Coment1;
            Li_4 = TRUE;
            Ld_124 = NormalizeDouble(f0_10("ls", Magic) * Multiplier,2); //<---------------- normalized lots
         } else Li_4 = FALSE;
      } else
         if (f0_10("s", Magic) < 1.0) Li_4 = Li_112;
      if (Gi_380) {
         f0_8(OP_BUY, Magic);
         Print("TP MONEY Averaging BUY");
         if (f0_10("b", Magic) != 0.0) return;
         Gi_380 = FALSE;
      }
      if (Gi_376) {
         f0_8(OP_SELL, Magic);
         Print("TP MONEY Averaging SELL");
         if (f0_10("s", Magic) != 0.0) return;
         Gi_376 = FALSE;
      }
   } else {
      if (Hedging_Marti) {
         Ld_132 = TP_Money_Hedging;
         if (f0_10("tlb", Magic) - f0_10("tls", Magic) > 0.0) {
            if (f0_10("pb", Magic) - Bid >= Step_Hedging * Gd_428) {
               comment_140 = "H - " + Coment1;
               Li_4 = TRUE;
               Ld_124 = NormalizeDouble(f0_10("lb", Magic) * Multiplier_Hedging,2) ; //<---------------- normalized lots
            } else Li_4 = FALSE;
         } else
            if (f0_10("b", Magic) + f0_10("s", Magic) < 1.0) Li_0 = Li_108;
         if (f0_10("tls", Magic) - f0_10("tlb", Magic) > 0.0) {
            if (Ask - f0_10("ps", Magic) >= Step_Hedging * Gd_428) {
               comment_140 = "H - " + Coment1;
               Li_0 = TRUE;
               Ld_116 =  NormalizeDouble(f0_10("ls", Magic) * Multiplier_Hedging,2);  //<---------------- normalized lots
            } else Li_0 = FALSE;
         } else
            if (f0_10("b", Magic) + f0_10("s", Magic) < 1.0) Li_4 = Li_112;
         if (f0_10("b", Magic) + f0_10("b", Magic) > 1.0 && f0_10("af", Magic) > 0.0 && f0_10("pfs", Magic) + f0_10("pfb", Magic) >= TP_Money_Hedging) {
            Gi_380 = TRUE;
            Gi_376 = TRUE;
         }
         if (Gi_380) {
            f0_8(OP_BUY, Magic);
            Print("TP MONEY Hedging BUY");
            if (f0_10("b", Magic) != 0.0) return;
            Gi_380 = FALSE;
         }
         if (Gi_376) {
            f0_8(OP_SELL, Magic);
            Print("TP MONEY Hedging SELL");
            if (f0_10("s", Magic) != 0.0) return;
            Gi_376 = FALSE;
         }
      } else {
         Li_0 = Li_108;
         Li_4 = Li_112;
      }
   }
   if (Averaging_Plus) {
      if (f0_10("af", Magic) == 0.0) {
         if ((!Li_4) && !Li_0 && Ls_64 == "SELL" && (Ls_8 == "BUY" && count_16 < 1 && index_44 > 2) || (Ls_36 == "BUY" && Sift_s >= index_44 && count_16 > 2)) {
            if (f0_10("s", Magic) < 1.0 || f0_10("ps", Magic) - Bid > Step_Minimum * Gd_428) {
               Li_4 = TRUE;
               Ld_124 = Lots_Averaging_Plus;
            }
         }
         if ((!Li_0) && !Li_4 && Ls_64 == "BUY" && (Ls_8 == "SELL" && count_16 < 1 && index_44 > 2) || (Ls_36 == "SELL" && Sift_s >= index_44 && count_16 > 2)) {
            if (f0_10("b", Magic) < 1.0 || Ask - f0_10("pb", Magic) > Step_Minimum * Gd_428) {
               Li_0 = TRUE;
               Ld_116 = Lots_Averaging_Plus;
            }
         }
      }
   }
   int ticket_148 = 0;

         Gd_444 = MarketInfo(Symbol(), MODE_MINLOT);
         Gd_452 = MarketInfo(Symbol(), MODE_MAXLOT);
         G_spread_460 = MarketInfo(Symbol(), MODE_SPREAD);
         G_stoplevel_468 = MarketInfo(Symbol(), MODE_STOPLEVEL);
         f0_11(1, "EA Name", WindowExpertName());
         f0_11(2, "No Account ", AccountNumber());
         f0_11(3, "Leverage ", " 1 : " + DoubleToStr(AccountLeverage(), 0));
         f0_11(4, "Balance", DoubleToStr(AccountBalance(), 2));
         f0_11(5, "Equity", DoubleToStr(AccountEquity(), 2));
         f0_11(6, "Profit ", DoubleToStr(f0_10("pfb", Magic) + f0_10("pfs", Magic), 2));
         f0_11(7, "Total Buy ", DoubleToStr(f0_10("b", Magic), 0));
         f0_11(8, "Total Sell", DoubleToStr(f0_10("s", Magic), 0));
         f0_11(9, "Profit Buy | Target ", DoubleToStr(f0_10("pfb", Magic), 2) + " | " + DoubleToStr(Ld_132, 2));
         f0_11(10, "Profit Sell | Target", DoubleToStr(f0_10("pfs", Magic), 2) + " | " + DoubleToStr(Ld_132, 2));
         f0_11(11, "Signal x", Ls_8 + " Sift : " + DoubleToStr(count_16, 0));
         f0_11(12, "Signal s", Ls_36 + " Sift : " + DoubleToStr(index_44, 0));
         f0_11(13, "Trend  ", Ls_64 + " Sift : " + DoubleToStr(index_72, 0));
         text_152 = "g";
         if (ObjectFind("CC") != 0) ObjectCreate("CC", OBJ_LABEL, 0, 0, 0);
         ObjectSet("CC", OBJPROP_CORNER, 4);
         ObjectSet("CC", OBJPROP_XDISTANCE, 71);
         ObjectSet("CC", OBJPROP_YDISTANCE, 28);
         ObjectSet("CC", OBJPROP_BACK, TRUE);
         ObjectSetText("CC", text_152, 180, "Webdings", C'0x23,0x23,0x23');
         text_160 = "g";
         if (ObjectFind("CC1") != 0) ObjectCreate("CC1", OBJ_LABEL, 0, 0, 0);
         ObjectSet("CC1", OBJPROP_CORNER, 4);
         ObjectSet("CC1", OBJPROP_XDISTANCE, 35);
         ObjectSet("CC1", OBJPROP_YDISTANCE, 56);
         ObjectSet("CC1", OBJPROP_BACK, TRUE);
         ObjectSetText("CC1", text_160, 80, "Webdings", DimGray);
         text_168 = "g";
         if (ObjectFind("CC2") != 0) ObjectCreate("CC2", OBJ_LABEL, 0, 0, 0);
         ObjectSet("CC2", OBJPROP_CORNER, 4);
         ObjectSet("CC2", OBJPROP_XDISTANCE, 150);
         ObjectSet("CC2", OBJPROP_YDISTANCE, 57);
         ObjectSet("CC2", OBJPROP_BACK, TRUE);
         ObjectSetText("CC2", text_168, 150, "Webdings", C'0x40,0x40,0x40');
         text_176 = "g";
         if (ObjectFind("CC3") != 0) ObjectCreate("CC3", OBJ_LABEL, 0, 0, 0);
         ObjectSet("CC3", OBJPROP_CORNER, 4);
         ObjectSet("CC3", OBJPROP_XDISTANCE, 35);
         ObjectSet("CC3", OBJPROP_YDISTANCE, 150);
         ObjectSet("CC3", OBJPROP_BACK, TRUE);
         ObjectSetText("CC3", text_176, 80, "Webdings", DarkSlateGray);
         text_184 = "Cheytach EA";
         if (ObjectFind("CC4") != 0) ObjectCreate("CC4", OBJ_LABEL, 0, 0, 0);
         ObjectSet("CC4", OBJPROP_CORNER, 4);
         ObjectSet("CC4", OBJPROP_XDISTANCE, 131);
         ObjectSet("CC4", OBJPROP_YDISTANCE, 31);
         ObjectSet("CC4", OBJPROP_BACK, TRUE);
         ObjectSetText("CC4", text_184, 16, "Bell MT", Gold);
         Ld_192 = f0_10("b", Magic) + f0_10("s", Magic);
         if (Ld_116 < Gd_444) Ld_116 = Gd_444;
         if (Ld_116 > Gd_452) Ld_116 = Gd_452;
         if (Ld_124 < Gd_444) Ld_124 = Gd_444;
         if (Ld_124 > Gd_452) Ld_124 = Gd_452;
         Ld_200 = f0_10("b", Magic);
         Ld_208 = f0_10("s", Magic);
         if (Gi_176 > f0_9()) {
            if (Li_0 && f0_0() && f0_10("b", Magic) < Max_OP && Gi_384 != Time[1]) {
               ticket_148 = OrderSend(Symbol(), OP_BUY, NormalizeDouble(Ld_116 + 0.004, 2), Ask, 3, 0, 0, comment_140, Magic, 0, Blue);
               if (ticket_148 > 0)
                  if (Gi_404) f0_13("OP BUY_" + DoubleToStr(f0_10("tikb", Magic), 0));
            }
            if (Li_4 && f0_0() && f0_10("s", Magic) < Max_OP && Gi_388 != Time[1]) {
               ticket_148 = OrderSend(Symbol(), OP_SELL, NormalizeDouble(Ld_124 + 0.004, 2), Bid, 3, 0, 0, comment_140, Magic, 0, Red);
               if (ticket_148 > 0)
                  if (Gi_404) f0_13("OP SELL_" + DoubleToStr(f0_10("tiks", Magic), 0));
            }
         }
         if (Ld_200 < f0_10("b", Magic)) Gi_384 = Time[1];
         if (Ld_208 < f0_10("s", Magic)) Gi_388 = Time[1];
         if (Hiden_TP) {
            if (TP > 0) {
               if (f0_10("b", Magic) + f0_10("s", Magic) <= 1.0) {
                  Ld_216 = f0_10("pb", Magic) + TP * Gd_428;
                  f0_4("TPB", Ld_216, Red);
               } else f0_4("TPB", 99999, Red);
               if (f0_10("s", Magic) + f0_10("b", Magic) <= 1.0) {
                  Ld_224 = f0_10("ps", Magic) - TP * Gd_428;
                  f0_4("TPS", Ld_224, Red);
               } else f0_4("TPS", 0, Red);
            }
            if (SL > 0) {
               Ld_232 = ObjectGet("SLB", OBJPROP_PRICE1);
               if (Ld_232 == 0.0) f0_4("SLB", f0_10("pb", Magic) - SL * Gd_428, Red);
               Ld_240 = ObjectGet("SLS", OBJPROP_PRICE1);
               if (Ld_240 == 9999.0) f0_4("SLS", f0_10("ps", Magic) + SL * Gd_428, Red);
               if (f0_10("s", Magic) == 0.0) f0_4("SLS", 9999, Red);
               if (f0_10("b", Magic) == 0.0) f0_4("SLB", 0, Red);
            }
            if (Trailing && f0_10("af", Magic) == 0.0) {
               Ld_232 = ObjectGet("SLB", OBJPROP_PRICE1);
               if (Bid - TS * Gd_428 > Ld_232 && Bid - (TS_Start + TS) * Gd_428 >= f0_10("pb", Magic) && f0_10("pb", Magic) > 0.0) f0_4("SLB", Bid - TS * Gd_428, Yellow);
               Ld_240 = ObjectGet("SLS", OBJPROP_PRICE1);
               if (Ld_240 - Ask > TS * Gd_428 && f0_10("ps", Magic) - Ask >= (TS_Start + TS) * Gd_428) f0_4("SLS", Ask + TS * Gd_428, Yellow);
            }
         } else {
            if (Trailing && f0_10("af", Magic) == 0.0) f0_5();
            if (f0_10("b", Magic) <= 1.0) {
               f0_3(0);
               f0_6(0);
            }
            if (f0_10("s", Magic) <= 1.0) {
               f0_3(1);
               f0_6(1);
            }
         }
         Comment(Time[0], " ", f0_10("af", Magic), " ", Ld_232);

   return (0);
}
                                                                                                                                                                                                                                                                                                                                                                                                                         
// 07CC694B9B3FC636710FA08B6922C42B
int f0_0() {
   bool Li_ret_0 = FALSE;
   if (OpenHour < CloseHour) {
      if (Hour() >= OpenHour && Hour() <= CloseHour) Li_ret_0 = TRUE;
   } else {
      if (OpenHour > CloseHour)
         if (Hour() >= OpenHour || Hour() <= CloseHour) Li_ret_0 = TRUE;
   }
   return (Li_ret_0);
}
                                                                                                                                                                                                                                                                                                                                                                                     
// B2F5FF47436671B6E533D8DC3614845D
double f0_10(string As_0, int A_magic_8) {
   double Ld_12 = 0;
   double Ld_20 = 0;
   double Ld_ret_28 = 0;
   double Ld_36 = 0;
   double Ld_44 = 0;
   double Ld_52 = 0;
   double Ld_60 = 0;
   double Ld_68 = 0;
   double Ld_76 = 0;
   double Ld_84 = 0;
   double Ld_92 = 0;
   double Ld_100 = 0;
   double Ld_108 = 0;
   double Ld_116 = 0;
   double Ld_124 = 0;
   double Ld_132 = 0;
   double Ld_140 = 0;
   double Ld_148 = 0;
   double Ld_156 = 0;
   double Ld_164 = 0;
   double Ld_172 = 0;
   double Ld_180 = 0;
   double Ld_188 = 0;
   double Ld_196 = 0;
   for (int pos_204 = 0; pos_204 < OrdersTotal(); pos_204++) {
      OrderSelect(pos_204, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == A_magic_8) {
         if (StringSubstr(OrderComment(), 0, 1) == "H" || StringSubstr(OrderComment(), 0, 1) == "A") Ld_196++;
         if (OrderType() == OP_BUY) {
            Ld_180 = OrderTicket();
            Ld_12++;
            Ld_36 = OrderOpenPrice();
            Ld_52 = OrderLots();
            Ld_68 = OrderTakeProfit();
            Ld_84 += OrderLots();
            Ld_108 += OrderProfit();
            Ld_148 = OrderLots();
            Ld_156 = 1;
            Ld_164 = OrderOpenPrice();
            Ld_172 = OrderLots();
         }
         if (OrderType() == OP_SELL) {
            Ld_188 = OrderTicket();
            Ld_20++;
            Ld_44 = OrderOpenPrice();
            Ld_60 = OrderLots();
            Ld_76 = OrderTakeProfit();
            Ld_92 += OrderLots();
            Ld_116 += OrderProfit();
            Ld_148 = OrderLots();
            Ld_156 = 2;
            Ld_164 = OrderOpenPrice();
            Ld_172 = OrderLots();
         }
         if (OrderType() == OP_SELLSTOP) Ld_100++;
         if (OrderType() == OP_BUYSTOP) Ld_124++;
         if (OrderType() == OP_SELLLIMIT) Ld_140++;
         if (OrderType() == OP_BUYLIMIT) Ld_132++;
      }
   }
   if (As_0 == "b") Ld_ret_28 = Ld_12;
   if (As_0 == "s") Ld_ret_28 = Ld_20;
   if (As_0 == "pb") Ld_ret_28 = Ld_36;
   if (As_0 == "ps") Ld_ret_28 = Ld_44;
   if (As_0 == "ls") Ld_ret_28 = Ld_60;
   if (As_0 == "lb") Ld_ret_28 = Ld_52;
   if (As_0 == "tps") Ld_ret_28 = Ld_76;
   if (As_0 == "tpb") Ld_ret_28 = Ld_68;
   if (As_0 == "tls") Ld_ret_28 = Ld_92;
   if (As_0 == "tlb") Ld_ret_28 = Ld_84;
   if (As_0 == "pfs") Ld_ret_28 = Ld_116;
   if (As_0 == "pfb") Ld_ret_28 = Ld_108;
   if (As_0 == "tikb") Ld_ret_28 = Ld_180;
   if (As_0 == "tiks") Ld_ret_28 = Ld_188;
   if (As_0 == "lt") Ld_ret_28 = Ld_148;
   if (As_0 == "af") Ld_ret_28 = Ld_196;
   if (As_0 == "ss") Ld_ret_28 = Ld_100;
   if (As_0 == "bs") Ld_ret_28 = Ld_124;
   if (As_0 == "sl") Ld_ret_28 = Ld_140;
   if (As_0 == "bl") Ld_ret_28 = Ld_132;
   if (As_0 == "lp") Ld_ret_28 = Ld_164;
   if (As_0 == "tip") Ld_ret_28 = Ld_156;
   if (As_0 == "ll") Ld_ret_28 = Ld_172;
   return (Ld_ret_28);
}
                                                                                                                                                                                                                                                                                                                                                                   
// 3817848EF191468810FC4B1CFC855BA1
void f0_3(int Ai_0) {
   for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
      OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
         if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP && OrderTakeProfit() == 0.0 && TP > 0 && Ai_0 == 0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() + TP * Gd_428, 0, Yellow);
         if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP && OrderTakeProfit() == 0.0 && TP > 0 && Ai_0 == 1) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() - TP * Gd_428, 0, Yellow);
      }
   }
}
                                                                                                                                                                                                                                                                                                                                                                                           
// 54A2BF8C09ACE67D3513AAA1AA7AA0F3
void f0_6(int Ai_0) {
   for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
      OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
         if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP && OrderStopLoss() == 0.0 && SL > 0 && Ai_0 == 0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - SL * Gd_428, OrderTakeProfit(), 0, Yellow);
         if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP && OrderStopLoss() == 0.0 && SL > 0 && Ai_0 == 1) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + SL * Gd_428, OrderTakeProfit(), 0, Yellow);
      }
   }
}
                                                                                                                                                                                                                                                                                                                                                 
// 4D682EC4EED27C53849758BC13B6E179
void f0_5() {
   for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) {
      OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
         if (OrderType() == OP_BUY && TS > 0 && OrderStopLoss() < Bid - TS * Gd_428 && OrderOpenPrice() + (TS + TS_Start) * Gd_428 < Bid) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TS * Gd_428, OrderTakeProfit(), 0, Yellow);
         if (OrderType() == OP_SELL && TS > 0 && OrderStopLoss() > Ask + TS * Gd_428 || OrderStopLoss() == 0.0 && OrderOpenPrice() - (TS + TS_Start) * Gd_428 > Bid) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + TS * Gd_428, OrderTakeProfit(), 0, Yellow);
      }
   }
}
                                                                                                                                                                                                                                                                                                                                                                         
// 716F6B30598BA30945D84485E61C1027
void f0_8(int A_cmd_0, int A_magic_4) {
   double Ld_12;
   for (int pos_8 = OrdersTotal() - 1; pos_8 >= 0; pos_8--) {
      OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == A_magic_4) {
         Ld_12 = 0;
         if (OrderType() == OP_BUY && A_cmd_0 == OP_BUY) {
            Ld_12 = OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue);
            if (Ld_12 > 0.0)
               if (Gi_404) f0_13("Close_BUY_" + DoubleToStr(OrderTicket(), 0));
         }
         if (OrderType() == OP_SELL && A_cmd_0 == OP_SELL) {
            Ld_12 = OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);
            if (Ld_12 > 0.0)
               if (Gi_404) f0_13("Close_SELL_" + DoubleToStr(OrderTicket(), 0));
         }
         if (OrderType() == A_cmd_0 && A_cmd_0 >= OP_BUYLIMIT) OrderDelete(OrderTicket());
      }
   }
}
                                                                                                                                                                                                                                                                                                                                                                                                             
// 7457CDD15D09BFC6C4DBB5D2B6F87390
double f0_9() {
   double Ld_ret_0 = 0;
   for (int pos_8 = OrdersHistoryTotal() - 1; pos_8 >= 0; pos_8--) {
      OrderSelect(pos_8, SELECT_BY_POS, MODE_HISTORY);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
         if (TimeDayOfYear(OrderOpenTime()) == DayOfYear() && TimeYear(OrderOpenTime()) == Year())
            if (OrderType() <= OP_SELL) Ld_ret_0++;
      }
   }
   return (Ld_ret_0);
}
                                                                                                                                                                                                                                                                                                                                                             

                                                                                                                                                                                                                                                                                                                                                                               
// C0E36F600151F785B9BE4CD446CB6655
void f0_11(int Ai_0, string As_4, string As_12) {
   int Li_20;
   int Li_24;
   switch (Ai_0) {
   case 1:
      Li_20 = 40;
      Li_24 = 60;
      break;
   case 2:
      Li_20 = 40;
      Li_24 = 75;
      break;
   case 3:
      Li_20 = 40;
      Li_24 = 90;
      break;
   case 4:
      Li_20 = 40;
      Li_24 = 105;
      break;
   case 5:
      Li_20 = 40;
      Li_24 = 120;
      break;
   case 6:
      Li_20 = 40;
      Li_24 = 135;
      break;
   case 7:
      Li_20 = 40;
      Li_24 = 150;
      break;
   case 8:
      Li_20 = 40;
      Li_24 = 165;
      break;
   case 9:
      Li_20 = 40;
      Li_24 = 180;
      break;
   case 10:
      Li_20 = 40;
      Li_24 = 195;
      break;
   case 11:
      Li_20 = 40;
      Li_24 = 210;
      break;
   case 12:
      Li_20 = 40;
      Li_24 = 225;
      break;
   case 13:
      Li_20 = 40;
      Li_24 = 240;
      break;
   case 14:
      Li_20 = 40;
      Li_24 = 255;
      break;
   case 15:
      Li_20 = 40;
      Li_24 = 270;
      break;
   case 16:
      Li_20 = 40;
      Li_24 = 285;
      break;
   case 17:
      Li_20 = 40;
      Li_24 = 300;
   }
   f0_12("baris" + Ai_0, As_4, 10, Li_20, Li_24, Gold, 0);
   f0_12("baris_" + Ai_0, ":", 10, Li_20 + 180, Li_24, Gold, 0);
   f0_12("baris-" + Ai_0, As_12, 10, Li_20 + 190, Li_24, Gold, 0);
}
                                                                                                                                                                                                                                                                                                                                                       
// D2986AC8CB6BD55892099C1FFD6B1F6F
void f0_12(string A_name_0, string A_text_8, int A_fontsize_16, int A_x_20, int A_y_24, color A_color_28, int A_corner_32) {
   if (ObjectFind(A_name_0) < 0) ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0, 0, 0);
   ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_32);
   ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_20);
   ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_24);
   ObjectSetText(A_name_0, A_text_8, A_fontsize_16, "Arial", A_color_28);
}
                                                                                                                                                                                                                                                                                                                                                                                     
// D7BA9BBFDA42B9657F14EE37EF76150B
void f0_13(string A_name_0) {
   if (ObjectFind(A_name_0) < 0) ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0, 0, 0);
   ObjectSet(A_name_0, OBJPROP_CORNER, 3);
   ObjectSet(A_name_0, OBJPROP_XDISTANCE, 20);
   ObjectSet(A_name_0, OBJPROP_YDISTANCE, 20);
   ObjectSetText(A_name_0, A_name_0, 12, "Arial", Gold);
   string name_8 = Symbol() + "_" + A_name_0 + ".gif";
   int file_16 = FileOpen(name_8, FILE_CSV|FILE_READ);
   if (file_16 < 1) {
      if (!WindowScreenShot(name_8, 640, 480)) Print("eror scren chart " + GetLastError());
      else {
         Print("capture!");
         PlaySound("Alert.wav");
      }
   }
   ObjectDelete(A_name_0);
}
                                                                                                                                                                                                                                                                                                                                                       
// 4618C2B26E9E222B2CF19471E1F2AF8C
void f0_4(string A_name_0, double A_price_8, color A_color_16) {
   string name_20 = " " + A_name_0;
   string name_28 = A_name_0;
   if (ObjectFind(name_20) != 0) ObjectCreate(name_20, OBJ_TREND, 0, iTime(Symbol(), 0, 1440 / Period()), A_price_8, TimeCurrent(), A_price_8);
   else {
     // ObjectMove(name_20, 0, iTime(Symbol(), 0, 1440 / Period()), A_price_8);
      ObjectMove(name_20, 1, TimeCurrent() + 300 * Period(), A_price_8);
   }
   ObjectSet(name_20, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(name_20, OBJPROP_COLOR, A_color_16);
   ObjectSet(name_20, OBJPROP_RAY, FALSE);
   if (ObjectFind(name_28) != 0) ObjectCreate(name_28, OBJ_TEXT, 0, iTime(Symbol(), PERIOD_D1, 0), A_price_8);
   else ObjectMove(name_28, 0, iTime(Symbol(), PERIOD_D1, 0), A_price_8);
   ObjectSetText(name_28, name_28, 8, "Arial", CLR_NONE);
   ObjectSet(name_28, OBJPROP_COLOR, A_color_16);
}

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

  • X
  • 0% загружено
« советник Cheytach_EA33.mq4
советник Chin Breakout Alert V.1.1.mq4 »