Navigation:Home > Content >

TriangleHedge-TypeR_Demo_v11~.mq4

Time: 2011-12-23 | Download file:TriangleHedge-TypeR_Demo_v11~.mq4

#import "TriangleHedge TypeR.dll"
   bool isEntryState(double& a0[], double& a1[], double& a2[], double& a3[]);
   int getPair2Signal(double a0, double a1, double a2, double a3, double& a4[], double& a5[]);
#import

bool gi_76 = FALSE;
string gs_eurgbp_80 = "EURGBP";
string gs_eurusd_88 = "EURUSD";
string gs_gbpusd_96 = "GBPUSD";
extern int MagicNumber = 84114;
extern int TradeStartHour = 0;
extern int TradeEndHour = 0;
extern string separator1 = "=====-- Entry --=====";
extern int RatioPeriod = 14;
extern double BuyRatio = 30.0;
extern double SellRatio = 70.0;
extern double Pair1Level = -400.0;
extern string separator2 = "=====-- Entry Common --=====";
extern int MaxHoldPositionSet = 10;
extern bool MM = TRUE;
extern double Risk = 5.0;
extern double LotsScale = 1.0;
extern string OComments = "";
extern int Slippage = 3;
extern string separator3 = "=====-- Exit Common --=====";
extern double ExitProfit123 = 50.0;
extern double ExitProfit23 = 50.0;
extern double ExitStopLoss123 = -800.0;
extern double ExitStopLoss23 = 10.0;
extern bool MondayMode = FALSE;
extern bool FridayMode = FALSE;
int gi_244 = 0;
int gi_248 = 0;
string gs_252;
string gs_260;
string gs_268;
double g_minlot_276;
double g_minlot_284;
double g_minlot_292;
double g_point_300;
double g_point_308;
double g_point_316;
int g_timeframe_324;
int gi_328;
int gi_332;
int gi_336;
string g_symbol_340;
string g_symbol_348;
string g_symbol_356;
double g_bid_364;
double g_bid_372;
double g_bid_380;
double gd_388;
double gd_396;
double gd_404;
bool gi_412 = TRUE;
bool gi_416 = TRUE;
bool gi_420 = TRUE;
int g_time_424 = 0;
int g_time_428 = 0;
double g_bid_432 = 0.0;
double g_bid_440 = 0.0;
int gia_448[200];
int g_count_452;
int gi_456 = 200;

double f0_4(double ad_0) {
   if (gi_412) return (ad_0);
   return (ad_0 / 100.0);
}

double f0_12(double ad_0) {
   if (gi_412) return (ad_0);
   return (100.0 * ad_0);
}

int init() {
   int li_4;
   gs_252 = Symbol();
   g_timeframe_324 = Period();
   int li_8 = -1;
   int li_12 = -1;
   for (int li_0 = 0; li_0 < StringLen(gs_252); li_0++) {
      li_4 = StringGetChar(gs_252, li_0);
      if (li_4 >= 'A' && li_4 <= 'Z') {
         if (li_8 >= 0 && li_12 == -1) li_12 = li_0;
      } else
         if (li_8 == -1) li_8 = li_0;
   }
   if (li_8 >= 0 && li_12 >= 0) gs_260 = StringSubstr(gs_252, li_8, li_12 - li_8);
   else {
      if (li_8 == -1 && li_12 == -1) gs_260 = "";
      else {
         gs_260 = "";
         Comment("’К‰Э–ј‚МЋж“ѕ‚ЙЋё”s‚µ‚Ь‚µ‚Ѕ. ", gs_252);
      }
   }
   gs_268 = StringSubstr(gs_252, StringLen(gs_260) + 6);
   g_symbol_340 = gs_260 + gs_eurgbp_80 + gs_268;
   g_symbol_348 = gs_260 + gs_eurusd_88 + gs_268;
   g_symbol_356 = gs_260 + gs_gbpusd_96 + gs_268;
   g_minlot_276 = MarketInfo(g_symbol_340, MODE_MINLOT);
   g_minlot_284 = MarketInfo(g_symbol_348, MODE_MINLOT);
   g_minlot_292 = MarketInfo(g_symbol_356, MODE_MINLOT);
   g_point_300 = MarketInfo(g_symbol_340, MODE_POINT);
   g_point_308 = MarketInfo(g_symbol_348, MODE_POINT);
   g_point_316 = MarketInfo(g_symbol_356, MODE_POINT);
   gi_328 = MarketInfo(g_symbol_340, MODE_DIGITS);
   gi_332 = MarketInfo(g_symbol_348, MODE_DIGITS);
   gi_336 = MarketInfo(g_symbol_356, MODE_DIGITS);
   if (gi_328 == 3 || gi_328 == 5) gd_388 = 10.0;
   else gd_388 = 1.0;
   if (gi_332 == 3 || gi_332 == 5) gd_396 = 10.0;
   else gd_396 = 1.0;
   if (gi_336 == 3 || gi_336 == 5) gd_404 = 10.0;
   else gd_404 = 1.0;
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double icustom_0;
   double icustom_8;
   double lda_16[][8];
   int li_68;
   int cmd_72;
   int ticket_84;
   int li_88;
   int li_92;
   int datetime_104;
   string ls_108;
   bool li_116;
   string ls_120;
   string comment_128;
   int li_136;
   int li_140;
   int cmd_144;
   int li_148;
   int li_152;
   int li_156;
   int li_160;
   int li_164;
   double ld_168;
   bool li_184;
   double lda_228[3];
   double lda_232[3];
   double lda_236[3];
   double lda_240[3];
   double lda_244[3];
   int cmd_248;
   if (TimeCurrent() >= D'06.01.2012 01:00') {
      Comment("Ћg—pЉъЊА‚р‰z‚¦‚Ь‚µ‚Ѕ");
      gi_416 = FALSE;
      return (0);
   }
   if (IsDemo() == FALSE) {
      Comment("‚±‚МEA‚Нѓfѓ‚ЊыЌАђк—p‚Е‚·");
      gi_416 = FALSE;
      return (0);
   }
   if (gi_420 == TRUE) {
      icustom_0 = iCustom(gs_252, g_timeframe_324, "KPotentialI", 0, 0);
      icustom_8 = iCustom(gs_252, g_timeframe_324, "KPotentialI", 1, 0);
      if (icustom_0 == 0.0 && icustom_8 == 0.0) {
         Comment("KPotentialI‚ЄЊ©‚В‚©‚и‚Ь‚№‚с");
         gi_416 = FALSE;
      }
   }
   if (gi_416 == FALSE) return (0);
   if (AccountCurrency() == "USD") gi_412 = TRUE;
   else gi_412 = FALSE;
   if (MM) {
      LotsScale = 4.0 * (f0_4(AccountBalance()) * Risk) / 1000000.0;
      LotsScale = NormalizeDouble(LotsScale / g_minlot_284, 0) * g_minlot_284;
   }
   g_bid_364 = MarketInfo(g_symbol_340, MODE_BID);
   g_bid_372 = MarketInfo(g_symbol_348, MODE_BID);
   g_bid_380 = MarketInfo(g_symbol_356, MODE_BID);
   datetime time_100 = Time[0];
   ArrayResize(lda_16, MaxHoldPositionSet + 1);
   for (int pos_60 = 0; pos_60 < MaxHoldPositionSet + 1; pos_60++) {
      lda_16[pos_60][0] = 0;
      lda_16[pos_60][1] = 0;
      lda_16[pos_60][2] = -1;
      lda_16[pos_60][3] = -1;
      lda_16[pos_60][4] = 0;
      lda_16[pos_60][5] = -1;
      lda_16[pos_60][6] = -1;
      lda_16[pos_60][7] = -1;
   }
   if (OrdersTotal() > 0) {
      for (pos_60 = OrdersTotal() - 1; pos_60 >= 0; pos_60--) {
         if (OrderSelect(pos_60, SELECT_BY_POS, MODE_TRADES) != FALSE) {
            if (OrderMagicNumber() == MagicNumber) {
               if (datetime_104 == 0) datetime_104 = TimeCurrent();
               f0_7(OrderComment(), li_92, ls_120);
               li_116 = FALSE;
               for (int index_64 = 0; index_64 < MaxHoldPositionSet + 1; index_64++) {
                  if (lda_16[index_64][0] == li_92) {
                     li_116 = TRUE;
                     li_136 = index_64;
                     break;
                  }
               }
               if (li_116 == FALSE) {
                  li_136 = li_88;
                  li_88++;
               }
               lda_16[li_136][0] = li_92;
               lda_16[li_136][1]++;
               if (OrderSymbol() == g_symbol_340) lda_16[li_136][5] = OrderTicket();
               else {
                  if (OrderSymbol() == g_symbol_348) {
                     lda_16[li_136][2] = OrderType();
                     lda_16[li_136][6] = OrderTicket();
                  } else {
                     if (OrderSymbol() == g_symbol_356) {
                        lda_16[li_136][3] = OrderType();
                        lda_16[li_136][7] = OrderTicket();
                     }
                  }
               }
               lda_16[li_136][4] += OrderProfit();
               datetime_104 = MathMin(datetime_104, li_92);
            }
         }
      }
   }
   int li_96 = li_88;
   f0_15();
   for (pos_60 = 0; pos_60 < OrdersHistoryTotal(); pos_60++) {
      if (OrderSelect(pos_60, SELECT_BY_POS, MODE_HISTORY) != FALSE) {
         if (OrderOpenTime() >= datetime_104 - 3600) {
            ls_108 = OrderComment();
            if (StringFind(ls_108, ",P1,") == -1 && StringFind(ls_108, ",P2,") == -1 && StringFind(ls_108, ",P3,") == -1) continue;
            f0_7(ls_108, li_92, ls_120);
            if (!f0_0(li_92)) f0_3(li_92);
         }
      }
   }
   string str_concat_176 = "";
   for (pos_60 = 0; pos_60 < li_96; pos_60++) {
      li_140 = lda_16[pos_60][1];
      ld_168 = lda_16[pos_60][4];
      li_152 = lda_16[pos_60][0];
      cmd_144 = lda_16[pos_60][2];
      li_148 = lda_16[pos_60][3];
      li_156 = lda_16[pos_60][5];
      li_160 = lda_16[pos_60][6];
      li_164 = lda_16[pos_60][7];
      str_concat_176 = StringConcatenate(str_concat_176, "count : " + DoubleToStr(li_140, 0) + ", " + "profit : " + DoubleToStr(ld_168, 2) + ", " + "ttime : " + TimeToStr(li_152, TIME_DATE|TIME_MINUTES) + "(" + li_152 + "), " + "P2Dir : " + DoubleToStr(cmd_144, 0) + ", " + "P3Dir : " + DoubleToStr(li_148, 0) + ", " + "Ticket : " + DoubleToStr(li_156, 0) + ", " + DoubleToStr(li_160, 0) + ", " + DoubleToStr(li_164, 0) 
      + "\n");
   }
   str_concat_176 = StringConcatenate(str_concat_176, "-------------------------------------------\n");
   double ld_188 = LotsScale * f0_12(ExitProfit123);
   double ld_196 = LotsScale * f0_12(ExitProfit23);
   double ld_204 = LotsScale * f0_12(ExitStopLoss123);
   double ld_212 = LotsScale * f0_12(ExitStopLoss23);
   double ld_220 = LotsScale * f0_12(Pair1Level);
   str_concat_176 = StringConcatenate(str_concat_176, "AccountCurrency : " + AccountCurrency() 
      + "\n", "LotsScale : " + LotsScale 
      + "\n", "ExitProfit123 : " + ld_188 
      + "\n", "ExitProfit23 : " + ld_196 
      + "\n", "ExitStopLoss123 : " + ld_204 
      + "\n", "ExitStopLoss23 : " + ld_212 
      + "\n", "Pair1Level : " + ld_220 
   + "\n");
   for (pos_60 = 0; pos_60 < li_96; pos_60++) {
      li_184 = FALSE;
      li_140 = lda_16[pos_60][1];
      ld_168 = lda_16[pos_60][4];
      li_152 = lda_16[pos_60][0];
      if (li_140 == 3) {
         if (ld_188 <= ld_168 || (ExitStopLoss123 < 0.0 && ld_168 <= ld_204)) li_184 = TRUE;
      } else {
         if (li_140 == 2) {
            if (ld_196 <= ld_168 || (ExitStopLoss23 < 0.0 && ld_168 <= ld_212)) li_184 = TRUE;
         } else {
            if (li_140 == 1)
               if (lda_16[pos_60][5] != -1.0) li_184 = TRUE;
         }
      }
      if (f0_0(li_152)) li_184 = TRUE;
      if (li_184) {
         f0_13(lda_16[pos_60][5], lda_16[pos_60][6], lda_16[pos_60][7]);
         if (gi_76) {
            Print("Exit profit:" + ld_168);
            PlaySound("connect.wav");
         }
         lda_16[pos_60][1] = 0;
         lda_16[pos_60][5] = -1;
         lda_16[pos_60][6] = -1;
         lda_16[pos_60][7] = -1;
      }
   }
   for (pos_60 = 0; pos_60 < li_96; pos_60++) {
      li_140 = lda_16[pos_60][1];
      ld_168 = lda_16[pos_60][4];
      li_152 = lda_16[pos_60][0];
      cmd_144 = lda_16[pos_60][2];
      li_148 = lda_16[pos_60][3];
      if (li_140 == 2 && ld_168 <= ld_220) {
         comment_128 = li_152 + ",P1," + OComments;
         cmd_72 = cmd_144;
         ticket_84 = OrderSend(g_symbol_340, cmd_72, f0_5(g_symbol_340), f0_11(g_symbol_340, cmd_72), Slippage * gd_388, 0.0, 0.0, comment_128, MagicNumber, 0, f0_10(cmd_72));
         if (gi_76) {
            Print("State1 : ", comment_128);
            PlaySound("alert.wav");
         }
         if (ticket_84 < 0) return (0);
         OrderSelect(ticket_84, SELECT_BY_TICKET, MODE_TRADES);
         OrderModify(OrderTicket(), OrderOpenPrice(), f0_14(g_symbol_340, cmd_72), f0_1(g_symbol_340, cmd_72), OrderExpiration(), f0_10(cmd_72));
         continue;
         return (0);
      }
   }
   double icustom_20 = iCustom(gs_252, g_timeframe_324, "PairRatio", g_symbol_348, g_symbol_356, RatioPeriod, 0, 0);
   double icustom_28 = iCustom(gs_252, g_timeframe_324, "PairRatio", g_symbol_348, g_symbol_356, RatioPeriod, 0, 1);
   lda_228[0] = iATR(g_symbol_340, PERIOD_M5, 20, 0);
   lda_228[1] = iATR(g_symbol_348, PERIOD_M5, 23, 0);
   lda_228[2] = iATR(g_symbol_356, PERIOD_M5, 29, 0);
   lda_232[0] = iATR(g_symbol_340, PERIOD_M5, 29, 30);
   lda_232[1] = iATR(g_symbol_348, PERIOD_M5, 20, 33);
   lda_232[2] = iATR(g_symbol_356, PERIOD_M5, 23, 41);
   lda_240[0] = iStdDev(g_symbol_340, PERIOD_M30, 25, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_240[1] = iStdDev(g_symbol_348, PERIOD_M30, 26, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_240[2] = iStdDev(g_symbol_356, PERIOD_M30, 25, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_244[0] = iMA(g_symbol_340, PERIOD_M30, 25, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_244[1] = iMA(g_symbol_348, PERIOD_M30, 26, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_244[2] = iMA(g_symbol_356, PERIOD_M30, 25, 0, MODE_SMMA, PRICE_CLOSE, 0);
   lda_236[0] = g_bid_364;
   lda_236[1] = g_bid_372;
   lda_236[2] = g_bid_380;
   str_concat_176 = StringConcatenate(str_concat_176, "PairRatio[0] : " + icustom_20 
      + "\n", "PairRatio[1] : " + icustom_28 
   + "\n");
   int cmd_76 = -1;
   int cmd_80 = -1;
   RefreshRates();
   if (f0_6()) {
      if (isEntryState(lda_228, lda_240, lda_244, lda_236)) {
         li_68 = getPair2Signal(BuyRatio, SellRatio, icustom_20, icustom_28, lda_240, lda_244);
         if (li_68 == 0) {
            cmd_76 = 0;
            cmd_80 = 1;
         }
         if (li_68 == 1) {
            cmd_76 = 1;
            cmd_80 = 0;
         }
      }
   }
   for (pos_60 = 0; pos_60 < li_96; pos_60++) {
      li_140 = lda_16[pos_60][1];
      ld_168 = lda_16[pos_60][4];
      li_152 = lda_16[pos_60][0];
      cmd_144 = lda_16[pos_60][2];
      li_148 = lda_16[pos_60][3];
      if (li_140 == 1 && cmd_144 != -1 && (!f0_0(li_152))) {
         comment_128 = li_152 + ",P3," + OComments;
         cmd_248 = f0_2(cmd_144);
         if (gi_76) {
            Print("State3 : ", comment_128);
            PlaySound("alert.wav");
         }
         ticket_84 = OrderSend(g_symbol_356, cmd_248, f0_5(g_symbol_356), f0_11(g_symbol_356, cmd_248), Slippage * gd_404, 0.0, 0.0, comment_128, MagicNumber, 0, f0_10(cmd_248));
         if (ticket_84 < 0) return (0);
         OrderSelect(ticket_84, SELECT_BY_TICKET, MODE_TRADES);
         OrderModify(OrderTicket(), OrderOpenPrice(), f0_14(g_symbol_356, cmd_248), f0_1(g_symbol_356, cmd_248), OrderExpiration(), f0_10(cmd_248));
         if (false) return (0);
      }
      if (li_140 == 1 && cmd_144 == -1 && (!f0_0(li_152))) {
         comment_128 = li_152 + ",P2," + OComments;
         cmd_248 = f0_2(li_148);
         if (gi_76) {
            Print("State2 : ", comment_128);
            PlaySound("alert.wav");
         }
         ticket_84 = OrderSend(g_symbol_348, cmd_248, f0_5(g_symbol_348), f0_11(g_symbol_348, cmd_248), Slippage * gd_396, 0.0, 0.0, comment_128, MagicNumber, 0, f0_10(cmd_248));
         if (ticket_84 < 0) return (0);
         OrderSelect(ticket_84, SELECT_BY_TICKET, MODE_TRADES);
         OrderModify(OrderTicket(), OrderOpenPrice(), f0_14(g_symbol_348, cmd_248), f0_1(g_symbol_348, cmd_248), OrderExpiration(), f0_10(cmd_248));
         continue;
         return (0);
      }
   }
   if (cmd_80 != -1 && li_96 < MaxHoldPositionSet && g_time_428 < time_100) {
      comment_128 = time_100 + ",P3," + OComments;
      if (gi_76) {
         Print("GET [P3], sig2:" + cmd_76 + ", sig3:" + cmd_80 + ", now:" + TimeToStr(time_100) + "(" + time_100 + ")");
         PlaySound("alert.wav");
      }
      ticket_84 = OrderSend(g_symbol_356, cmd_80, f0_5(g_symbol_356), f0_11(g_symbol_356, cmd_80), Slippage * gd_404, 0.0, 0.0, comment_128, MagicNumber, 0, f0_10(cmd_80));
      g_time_428 = time_100;
      if (ticket_84 < 0) return (0);
      OrderSelect(ticket_84, SELECT_BY_TICKET, MODE_TRADES);
      OrderModify(OrderTicket(), OrderOpenPrice(), f0_14(g_symbol_356, cmd_80), f0_1(g_symbol_356, cmd_80), OrderExpiration(), f0_10(cmd_80));
      if (false) return (0);
   }
   if (cmd_76 != -1 && li_96 < MaxHoldPositionSet && g_time_424 < time_100) {
      comment_128 = time_100 + ",P2," + OComments;
      if (gi_76) {
         Print("GET [P2], sig2:" + cmd_76 + ", sig3:" + cmd_80 + ", now:" + TimeToStr(time_100) + "(" + time_100 + ")");
         PlaySound("alert.wav");
      }
      ticket_84 = OrderSend(g_symbol_348, cmd_76, f0_5(g_symbol_348), f0_11(g_symbol_348, cmd_76), Slippage * gd_396, 0.0, 0.0, comment_128, MagicNumber, 0, f0_10(cmd_76));
      g_time_424 = time_100;
      if (ticket_84 < 0) return (0);
      OrderSelect(ticket_84, SELECT_BY_TICKET, MODE_TRADES);
      OrderModify(OrderTicket(), OrderOpenPrice(), f0_14(g_symbol_348, cmd_76), f0_1(g_symbol_348, cmd_76), OrderExpiration(), f0_10(cmd_76));
      if (false) return (0);
   }
   gi_420 = FALSE;
   if (gi_76 == FALSE) Comment("Running...", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS));
   else Comment(str_concat_176);
   return (0);
}

int f0_2(int ai_0) {
   if (ai_0 == 0) return (1);
   if (ai_0 == 1) return (0);
   if (ai_0 == 2) return (3);
   if (ai_0 == 3) return (2);
   if (ai_0 == 4) return (5);
   if (ai_0 == 5) return (4);
   return (-1);
}

double f0_5(string a_symbol_0) {
   double ld_ret_8;
   if (a_symbol_0 == g_symbol_340) {
      if (NormalizeDouble(g_bid_432, 8) == 0.0 || NormalizeDouble(g_bid_440, 8) == 0.0) {
         g_bid_432 = g_bid_372;
         g_bid_440 = g_bid_380;
      }
      ld_ret_8 = NormalizeDouble(g_bid_440 * LotsScale / g_bid_432 / g_minlot_276, 0) * g_minlot_276;
   } else {
      if (a_symbol_0 == g_symbol_348) {
         ld_ret_8 = NormalizeDouble(g_bid_380 * LotsScale / g_bid_372 / g_minlot_284, 0) * g_minlot_284;
         g_bid_432 = g_bid_372;
      } else {
         if (a_symbol_0 == g_symbol_356) {
            ld_ret_8 = NormalizeDouble(1.0 * LotsScale / g_minlot_292, 0) * g_minlot_292;
            g_bid_440 = g_bid_380;
         }
      }
   }
   return (ld_ret_8);
}

double f0_11(string a_symbol_0, int ai_8) {
   double price_12 = 0.0;
   if (ai_8 == 0) price_12 = MarketInfo(a_symbol_0, MODE_ASK);
   else
      if (ai_8 == 1) price_12 = MarketInfo(a_symbol_0, MODE_BID);
   return (NormalizeDouble(price_12, MarketInfo(a_symbol_0, MODE_DIGITS)));
}

double f0_14(string a_symbol_0, int ai_8) {
   double price_12;
   int li_28;
   if (a_symbol_0 == g_symbol_340) li_28 = gi_244;
   else {
      if (a_symbol_0 == g_symbol_348) li_28 = gi_244;
      else
         if (a_symbol_0 == g_symbol_356) li_28 = gi_244;
   }
   double ld_20 = 0.0;
   if (li_28 > 0) {
      if (ai_8 == 0) {
         price_12 = MarketInfo(a_symbol_0, MODE_ASK);
         ld_20 = price_12 - li_28 * MarketInfo(a_symbol_0, MODE_POINT);
      } else {
         if (ai_8 == 1) {
            price_12 = MarketInfo(a_symbol_0, MODE_BID);
            ld_20 = price_12 + li_28 * MarketInfo(a_symbol_0, MODE_POINT);
         }
      }
   }
   return (NormalizeDouble(ld_20, MarketInfo(a_symbol_0, MODE_DIGITS)));
}

double f0_1(string a_symbol_0, int ai_8) {
   double price_12;
   int li_28;
   if (a_symbol_0 == g_symbol_340) li_28 = gi_248;
   else {
      if (a_symbol_0 == g_symbol_348) li_28 = gi_248;
      else
         if (a_symbol_0 == g_symbol_356) li_28 = gi_248;
   }
   double ld_20 = 0.0;
   if (li_28 > 0) {
      if (ai_8 == 0) {
         price_12 = MarketInfo(a_symbol_0, MODE_ASK);
         ld_20 = price_12 + li_28 * MarketInfo(a_symbol_0, MODE_POINT);
      } else {
         if (ai_8 == 1) {
            price_12 = MarketInfo(a_symbol_0, MODE_BID);
            ld_20 = price_12 - li_28 * MarketInfo(a_symbol_0, MODE_POINT);
         }
      }
   }
   return (NormalizeDouble(ld_20, MarketInfo(a_symbol_0, MODE_DIGITS)));
}

int f0_10(int ai_0) {
   if (ai_0 == 0) return (16776960);
   if (ai_0 == 1) return (4678655);
   return (255);
}

void f0_13(int ai_0, int ai_4, int ai_8) {
   double price_16;
   if (OrdersTotal() > 0) {
      for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
         if (OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES) != FALSE) {
            if (OrderMagicNumber() == MagicNumber) {
               if (OrderTicket() != ai_0 && OrderTicket() != ai_4 && OrderTicket() != ai_8) continue;
               if (OrderType() == OP_BUY) price_16 = MarketInfo(OrderSymbol(), MODE_BID);
               else
                  if (OrderType() == OP_SELL) price_16 = MarketInfo(OrderSymbol(), MODE_ASK);
               OrderClose(OrderTicket(), OrderLots(), price_16, Slippage * gd_388);
            }
         }
      }
   }
}

void f0_7(string as_0, int &a_str2int_8, string &as_12) {
   a_str2int_8 = 0;
   as_12 = "";
   int li_20 = StringFind(as_0, ",");
   a_str2int_8 = StrToInteger(StringSubstr(as_0, 0, li_20));
   as_0 = StringSubstr(as_0, li_20 + 1);
   li_20 = StringFind(as_0, ",");
   as_12 = StringSubstr(as_0, 0, li_20);
   as_0 = StringSubstr(as_0, li_20 + 1);
}

int f0_6() {
   int hour_0 = Hour();
   int day_of_week_4 = DayOfWeek();
   if (MondayMode)
      if (day_of_week_4 == 1 && hour_0 < 12) return (0);
   if (FridayMode)
      if (day_of_week_4 == 5 && hour_0 >= 12) return (0);
   if (TradeStartHour == TradeEndHour || TradeStartHour < 0 || TradeEndHour < 0) return (1);
   if (TradeStartHour < TradeEndHour) {
      if (!(TradeStartHour <= hour_0 && hour_0 < TradeEndHour)) return (0);
      return (1);
   }
   if (TradeStartHour <= hour_0 || hour_0 < TradeEndHour) return (1);
   return (0);
}

void f0_15(int ai_0 = 0) {
   f0_9();
   if (ai_0 > 0) {
      ArrayResize(gia_448, ai_0);
      gi_456 = ai_0;
   }
}

void f0_9() {
   ArrayInitialize(gia_448, 0);
   g_count_452 = 0;
   gi_456 = 200;
}

bool f0_0(int ai_0) {
   return (f0_8(ai_0) != -1);
}

int f0_8(int ai_0) {
   for (int index_4 = 0; index_4 < g_count_452; index_4++)
      if (gia_448[index_4] == ai_0) return (index_4);
   return (-1);
}

void f0_3(int ai_0) {
   int li_4 = g_count_452;
   if (gi_456 - 1 <= li_4) {
      gi_456 *= 2;
      ArrayResize(gia_448, gi_456);
   }
   gia_448[li_4] = ai_0;
   g_count_452++;
}

Recommend