Navigation:Home > Content >

GEPARD3.1.mq4

Time: 2010-07-08 | Download file:GEPARD3.1.mq4

/*
   Generated by EX4-TO-MQ4 decompiler ONE FILE V4.0.218.3
   EX4 ID : 04E20A41724C2645BAEB3FDF008C44EC
   Website: http://purebeam.biz
   E-mail : [email protected]
*/
#property copyright "Copyright © 2009, Focusing-Large"
#property link      ""

extern string sSymbols1 = "AUDCAD: 1; AUDCHF: 1; AUDJPY: 1; AUDNZD: 1; AUDUSD: 1; CADCHF: 1; CADJPY: 1; CHFJPY: 1; EURAUD: 1; EURCAD: 1; EURCHF: 1; EURGBP: 1; EURJPY: 1; EURNZD: 1; EURUSD: 1;";
extern string sSymbols2 = "GBPAUD: 1; GBPCAD: 1; GBPCHF: 1; GBPJPY: 1; GBPNZD: 1; GBPUSD: 1; NZDCAD: 1; NZDCHF: 1; NZDGBP: 1; NZDJPY: 1; NZDUSD: 1; USDCAD: 1; USDCHF: 1; USDJPY: 1";
int gi_92 = 0;
string gs_96 = "";
string gs_104 = "";
string gs_112 = "";
string gs_120 = "";
string gs_128 = "";
string gs_136 = "";
string gs_144 = "";
extern double dRisk = 1; //0.005;
extern string sRisk = "";
int gi_168 = 0;
extern int dMaxSymbolOrdersCount = 5;
extern string sMaxSymbolOrdersCount = "";
extern double MaxOpenValPosition = 7.0;
int gi_192 = 18;
string gs_196 = "EURGBP: 14; AUDUSD: 14; EURJPY: 20; GBPCHF: 25; GBPJPY: 25; GBPUSD: 25";
int gi_204 = 18;
string gs_208 = "EURGBP: 14; AUDUSD: 14; EURJPY: 20; GBPCHF: 25; GBPJPY: 25; GBPUSD: 25";
extern int dStopLoss = 0;
extern string sStopLoss = "";
int gi_228 = 0;
string gs_232 = "";
int gi_240 = 0;
string gs_244 = "";
int gi_252 = 0;
string gs_256 = "";
int gi_264 = 0;
string gs_268 = "";
int gi_276 = 0;
string gs_280 = "";
int gi_288 = 0;
string gs_292 = "";
int gi_300 = 5;
string gs_304 = "";
int gi_312 = 1;
string gs_316 = "";
int gi_324 = 1;
string gs_328 = "";
extern double dMinDistanceRealOrdersB_PR = 5.0;
extern string sMinDistanceRealOrdersB_PR = "";
extern double dMinDistanceRealOrdersS_PR = 5.0;
extern string sMinDistanceRealOrdersS_PR = "";
int gi_368 = 0;
string gs_372 = "";
int gi_380 = 0;
string gs_384 = "";
int gi_392 = 0;
string gs_396 = "";
int gi_404 = 17;
string gs_408 = "";
int gi_416 = 17;
string gs_420 = "";
int gi_428 = 83;
string gs_432 = "";
int gi_440 = 83;
string gs_444 = "";
extern int CR_UseCorrection = 1;
extern double CR_WaitCorrectionAfterMove_PR = 1.2;
extern double CR_WaitCorrectionAfterFlat_PR = 0.2;
extern double CR_MaxDistanceFromBottom_PR = 0.1;
extern double CR_SizeCorrection_PR = 0.3;
extern double CR_StopLoss_PR = 0.0;
extern int CR_AnalizMove_Period = 5;
extern int CR_AnalizMove_CountBars = 6;
extern int CR_AnalizFlat_Period = 2;
extern int CR_AnalizFlat_CountBars = 2;
int gi_512 = 0;
string gs_516 = "";
int gi_524 = 3;
string gs_528 = "";
int gi_536 = 3;
string gs_540 = "";
int gi_548 = 0;
string gs_552 = "";
int gi_560 = 1;
string gs_564 = "";
int gi_572 = 2;
string gs_576 = "";
int gi_584 = 2;
string gs_588 = "";
int gi_596 = 1;
string gs_600 = "";
int gi_608 = 0;
string gs_612 = "";
double gd_620 = 0.0005;
string gs_628 = "";
int gi_636 = 1;
string gs_640 = "";
int gi_648 = 35;
string gs_652 = "";
extern int dCountHighLowLimits = 2;
extern string sCountHighLowLimits = "";
extern double diHL_LimitDistance1_PR = 1.0;
extern string siHL_LimitDistance1_PR = "";
extern int diHL_Period1 = 5;
extern string siHL_Period1 = "";
extern int diHL_CountBars1 = 6;
extern string siHL_CountBars1 = "";
extern double diHL_LimitDistance2_PR = 5.0;
extern string siHL_LimitDistance2_PR = "";
extern int diHL_Period2 = 7;
extern string siHL_Period2 = "";
extern int diHL_CountBars2 = 2;
extern string siHL_CountBars2 = "";
extern int dUseFlatIndicator = 1;
extern string sUseFlatIndicator = "";
int gi_764 = 10;
string gs_768 = "";
int gi_776 = 50;
string gs_780 = "";
extern int diFL_MinExtremumsCount = 1;
extern string siFL_MinExtremumsCount = "";
extern int diFL_Period = 1;
extern string siFL_Period = "";
extern int diFL_CountBars = 12;
extern string siFL_CountBars = "";
extern int diFL_StopLoss = 0;
extern string siFL_StopLoss = "";
double gd_836 = 1.0;
string gs_844 = "";
extern double dMinLotSize = 5;
extern string sMinLotSize = "";
extern double dMaxLotSize = 100;
extern string sMaxLotSize = "";
extern double dStepLotSize = 0.01;
extern string sStepLotSize = "";
int gi_900 = 1;
string gs_904 = "";
int gi_912 = 0;
int gi_916 = 10;
string gs_920 = "";
int gi_928 = 50;
string gs_932 = "";
int gi_940 = 10;
extern int MaxSpreadForTradeSymbol = 12;
string gs_gepard__948 = "gepard ";
bool gi_unused_956 = FALSE;
int gi_unused_960 = 0;
int gi_964;
string gsa_968[];
double gda_972[];
double gda_976[];
double gda_980[];
double gda_984[];
int gia_988[];
int gia_992[];
int gia_996[];
double gda_1000[];
double gda_1004[];
double gda_1008[];
int gia_1012[];
int gia_1016[];
int gia_1020[];
int gia_1024[];
int gia_1028[];
int gia_1032[];
int gia_1036[];
int gia_1040[];
int gia_1044[];
int gia_1048[];
int gia_1052[];
int gia_1056[];
int gia_1060[];
int gia_1064[];
int gia_1068[];
int gia_1072[];
double gda_1076[];
double gda_1080[];
int gia_1084[];
int gia_1088[];
int gia_1092[];
int gia_1096[];
int gia_1100[];
int gia_1104[];
int gia_1108[];
int gia_1112[];
int gia_1116[];
int gia_1120[];
int gia_1124[];
double gda_1128[];
double gda_1132[];
double gda_1136[];
int gia_1140[];
double gda_1144[];
int gia_1148[];
int gia_1152[];
double gda_1156[];
int gia_1160[];
int gia_1164[];
int gia_1168[];
int gia_1172[];
int gia_1176[];
int gia_1180[];
int gia_1184[];
int gia_1188[];
int gia_1192[];
double gda_1196[];
double gda_1200[];
double gda_1204[];
double gda_1208[];
int gia_1212[];
int gia_1216[];
int gia_1220[];
int gia_1224[];
string g_symbol_1228;
double gd_1236;
double gd_1244;
double g_bid_1252;
double g_ask_1260;
int gi_1268;
int gi_1272;
int gi_1276;
int gi_1280;
int gi_1284;
int gi_1288;
int gi_1292;
int gi_1296;
int gi_1300;
int gi_1304;
int gi_1308;
int gi_1312;
int gi_1316;
int gi_1320;
int gi_1324;
int gi_1328;
int gi_1332;
double gd_1336;
double gd_1344;
int gi_1352;
int gi_1356;
int gi_1360;
int gi_1364;
int gi_1368;
int gi_1372;
int gi_1376;
int gi_1380;
int gi_1384;
int gi_1388;
int gi_1392;
double gd_1396;
int gi_1404;
int gi_1408;
int gi_1412;
double gd_1416;
int gi_1424;
int gi_1428;
double gd_1432;
int gi_1440;
int gi_1444;
int gi_1448;
int gi_1452;
int gi_1456;
int gi_1460;
int gi_1464;
int gi_1468;
int gi_1472;
double gd_1476;
int gi_1484;
double gd_1488;
double gd_1496;
int gi_1504;
int gi_1508;
int gi_1512;
bool gi_1516 = FALSE;
int g_day_1520 = 0;
int gi_1524;
int gi_1528;
double gd_1532;
double gd_1540;
double gd_1548;
double gd_1556;
double gd_1564;
double g_price_1572;
double gd_1580;
double gd_1588;
double gd_1596;
double gd_1604;
int g_ticket_1612;
int gi_1616;
int gi_1620;
bool gi_1624;
bool gi_1628;
string gs_1632;
int gi_1640;
string gsa_1644[];
double gda_1648[];
double gda_1652[];
int gia_1656[6];
double gda_1660[6];
double gda_1664[6];
double gda_1668[6];
bool gi_1672;
double gd_1676;
double gd_1684;
double gda_1692[2];
double gda_1696[2];
double gd_unused_1700;
bool gi_1708;
double g_ilow_1712;
double g_ihigh_1720;
double gd_1728;
int gi_1736 = 0;
int gi_1740 = 1;
int gi_1744 = 2;
int gi_1748 = 3;
int gi_1752 = 4;
int gi_1756 = 5;
int gia_1760[10] = {1, 5, 15, 30, 60, 240, 1440, 10080, 43200, 0};

int init() {
   int li_0;
   int li_4;
   bool li_8;
   string ls_12;
   string ls_20;
   string lsa_28[];
   if (gi_228 == 0) gi_228 = dStopLoss;
   if (gi_240 == 0) gi_240 = dStopLoss;
   if (gs_232 == "") gs_232 = sStopLoss;
   if (gs_244 == "") gs_244 = sStopLoss;
   gi_964 = 0;
   for (int l_index_32 = 1; l_index_32 <= 2; l_index_32++) {
      switch (l_index_32) {
      case 1:
         ls_12 = sSymbols1;
         break;
      case 2:
         ls_12 = sSymbols2;
      }
      li_4 = glSeparateStringInArray(ls_12, lsa_28, ";");
      for (int l_index_40 = 0; l_index_40 < li_4; l_index_40++) {
         li_0 = StringFind(lsa_28[l_index_40], ":");
         if (li_0 != -1) {
            if (glStringTrimAll(StringSubstr(lsa_28[l_index_40], li_0 + 1)) == "1") {
               ls_20 = glStringTrimAll(StringSubstr(lsa_28[l_index_40], 0, li_0));
               gi_964++;
               ArrayResize(gsa_968, gi_964);
               gsa_968[gi_964 - 1] = ls_20;
            }
         }
      }
   }
   ArrayResize(gda_972, gi_964);
   for (l_index_40 = 0; l_index_40 < gi_964; l_index_40++) gda_972[l_index_40] = MarketInfo(gsa_968[l_index_40], MODE_POINT);
   ArrayResize(gda_976, gi_964);
   for (l_index_40 = 0; l_index_40 < gi_964; l_index_40++) gda_976[l_index_40] = MarketInfo(gsa_968[l_index_40], MODE_DIGITS);
   ArrayResize(gda_980, gi_964);
   ArrayResize(gda_984, gi_964);
   gi_1640 = 0;
   ArrayResize(gsa_1644, gi_1640);
   for (l_index_40 = 0; l_index_40 < gi_964; l_index_40++) {
      if (StringLen(gsa_968[l_index_40]) == 6) {
         for (int l_count_44 = 0; l_count_44 < 2; l_count_44++) {
            ls_20 = StringSubstr(gsa_968[l_index_40], 3 * l_count_44 + 0, 3);
            li_8 = FALSE;
            for (l_index_32 = 0; l_index_32 < gi_1640; l_index_32++) {
               if (gsa_1644[l_index_32] == ls_20) {
                  li_8 = TRUE;
                  break;
               }
            }
            if (!li_8) {
               gi_1640++;
               ArrayResize(gsa_1644, gi_1640);
               gsa_1644[gi_1640 - 1] = ls_20;
            }
         }
      }
   }
   ArrayResize(gda_1648, gi_1640);
   ArrayResize(gda_1652, gi_1640);
   GetSymbolsSettingsFromStrings();
   myGetSymbolSettingsDay();
   return (0);
}

int myGetSymbolParameters(int ai_0) {
   gi_1268 = gia_992[ai_0];
   gi_1272 = gia_996[ai_0];
   if (gi_1268 == 0 && gi_1272 == 0) return (0);
   gd_1236 = gda_972[ai_0];
   gd_1244 = gda_976[ai_0];
   if (gd_1236 == 0.0) return (0);
   g_bid_1252 = MarketInfo(g_symbol_1228, MODE_BID);
   g_ask_1260 = MarketInfo(g_symbol_1228, MODE_ASK);
   gi_1276 = gia_1012[ai_0];
   gi_1280 = gia_1016[ai_0];
   gi_1284 = gia_1020[ai_0];
   gi_1288 = gia_1024[ai_0];
   gi_1292 = gia_1028[ai_0];
   gi_1296 = gia_1032[ai_0];
   gi_1300 = gia_1036[ai_0];
   gi_1304 = gia_1040[ai_0];
   gi_1308 = gia_1044[ai_0];
   gi_1312 = gia_1052[ai_0];
   gi_1316 = gia_1056[ai_0];
   gi_1320 = gia_1060[ai_0];
   gi_1324 = gia_1064[ai_0];
   gi_1328 = gia_1068[ai_0];
   gi_1332 = gia_1072[ai_0];
   gd_1336 = gda_1076[ai_0];
   gd_1344 = gda_1080[ai_0];
   gi_1352 = gia_1084[ai_0];
   gi_1356 = gia_1088[ai_0];
   gi_1360 = gia_1092[ai_0];
   gi_1364 = gia_1096[ai_0];
   gi_1368 = gia_1100[ai_0];
   gi_1372 = gia_1104[ai_0];
   gi_1376 = gia_1108[ai_0];
   gi_1380 = gia_1112[ai_0];
   gi_1384 = gia_1116[ai_0];
   gi_1388 = gia_1120[ai_0];
   gi_1392 = gia_1124[ai_0];
   gd_1396 = gda_1128[ai_0];
   gi_1404 = gda_1132[ai_0];
   gi_1408 = gda_1136[ai_0];
   gi_1412 = gia_1140[ai_0];
   gd_1416 = gda_1144[ai_0];
   gi_1424 = gia_1148[ai_0];
   gi_1428 = gia_1152[ai_0];
   gd_1432 = gda_1156[ai_0];
   gi_1440 = gia_1160[ai_0];
   gi_1444 = gia_1164[ai_0];
   gi_1448 = gia_1168[ai_0];
   gi_1452 = gia_1172[ai_0];
   gi_1456 = gia_1176[ai_0];
   gi_1460 = gia_1180[ai_0];
   gi_1464 = gia_1184[ai_0];
   gi_1468 = gia_1188[ai_0];
   gi_1472 = gia_1192[ai_0];
   gd_1476 = gda_1196[ai_0];
   gi_1484 = gia_1212[ai_0];
   gd_1488 = gda_1000[ai_0];
   gd_1496 = gda_1004[ai_0];
   gi_1504 = gia_1216[ai_0];
   gi_1508 = gia_1220[ai_0];
   gi_1512 = gia_1224[ai_0];
   return (1);
}

int deinit() {
   return (0);
}

int start() {
   if (!myCheckAllowWorking()) return (0);
   if (Day() != g_day_1520) myGetSymbolSettingsDay();
   for (int l_index_0 = 0; l_index_0 < gi_964; l_index_0++) {
      g_symbol_1228 = gsa_968[l_index_0];
      if (IsTesting() || IsOptimization() && g_symbol_1228 != Symbol()) continue;
      if (!IsTesting() && MarketInfo(g_symbol_1228, MODE_TRADEALLOWED) == 0.0) continue;
      if (myGetSymbolParameters(l_index_0) == 1) {
         if (myAnalizCurrentStateGeneral() == 1) {
            if (myAnalizCurrentStateSymbol() == 1) {
               if (gi_1672 == FALSE) {
                  if (MaxSpreadForTradeSymbol != 0)
                     if (MarketInfo(g_symbol_1228, MODE_SPREAD) > MaxSpreadForTradeSymbol) continue;
                  myCalculateIndicators();
                  myControlOpenOrdersSymbol();
                  if (gi_168 > 0)
                     if (OrdersTotal() >= gi_168) continue;
                  if (myAnalizCurrentStateGeneral() == 1) {
                     if (myAnalizCurrentStateSymbol() == 1) {
                        gd_1532 = myGetLotSize(l_index_0);
                        if (AccountFreeMargin() < 1000.0 * gd_1532)
                           if (gia_1656[gi_1736] + gia_1656[gi_1740] == 0) continue;
                        myTradeSymbol(l_index_0);
                     }
                  }
               }
            }
         }
      }
   }
   return (0);
}

void myTradeSymbol(int ai_0) {
   for (int l_count_4 = 0; l_count_4 < 2; l_count_4++) {
      if (gi_1504 != 0)
         if (gia_1656[gi_1736] + gia_1656[gi_1740] >= gi_1504) break;
      if (l_count_4 == 0) {
         if (gi_1268 == 0) continue;
         if (gia_988[ai_0] == 1 && gda_980[ai_0] <= 0.0) continue;
         if (Time[0] > D'02.08.2008 11:28' && Time[0] < D'09.10.2008 09:17')
            if (gda_980[ai_0] >= 0.0) continue;
         gi_1616 = gi_1736;
         gs_1632 = "BUY";
         g_price_1572 = g_ask_1260;
      } else {
         if (gi_1272 == 0) continue;
         if (gia_988[ai_0] == 1 && gda_984[ai_0] <= 0.0) continue;
         if (Time[0] > D'02.08.2008 11:28' && Time[0] < D'09.10.2008 09:17')
            if (gda_984[ai_0] >= 0.0) continue;
         gi_1616 = gi_1740;
         gs_1632 = "SELL";
         g_price_1572 = g_bid_1252;
      }
      gd_1580 = 100.0 * MathFloor(g_price_1572 / gd_1236 / 100.0) * gd_1236;
      if (gi_1484 == 1) {
         gi_1628 = FALSE;
         if (!gi_1628 && CR_UseCorrection) myCheckAndPrepareRO_Correction();
         if (!gi_1628 && gi_1448 == 1 && gi_1708) myCheckAndPrepareRO_Flat();
         if (!gi_1628 && gi_1376 == 1 && gi_1392 == 1 && MathAbs(gd_1676) > gd_1396) myCheckAndPrepareRO_Speed();
         if (gi_1628)
            if (!myCheckOrderBeforeAdding(gd_1548, gi_1616, gi_1524, g_price_1572)) gi_1628 = FALSE;
         if (gi_1628)
            if (!myCheckDistanceFromOneWayReal(gd_1548, gi_1616, gs_1632, gd_1588)) gi_1628 = FALSE;
         if (gi_1628)
            if (!myCheckHighLowLimit(gd_1548, gi_1616, gs_1632)) gi_1628 = FALSE;
         if (gi_1628)
            if (!myCheckOpenOrdersBeforeAdding(gd_1548, gi_1524, g_price_1572)) gi_1628 = FALSE;
         if (gi_1628) {
            gd_1540 = gd_1532;
            if (gi_1528 == 57320200) {
               if (gd_1476 > 0.0 && gd_1476 != 1.0) {
                  gd_1540 = glDoubleRound(gd_1532 * gd_1476, gda_1208[ai_0]);
                  if (gd_1540 > gda_1204[ai_0]) gd_1540 = gda_1204[ai_0];
               }
            } else {
               if (gi_1528 == 57320300) {
               }
            }
            g_ticket_1612 = myOrderSend(g_symbol_1228, gi_1524, gd_1540, gd_1548, 0, gd_1556, gd_1564, "", gi_1528, 0, Green);
            if (g_ticket_1612 > 0) {
               if (OrderSelect(g_ticket_1612, SELECT_BY_TICKET, MODE_TRADES)) {
                  if (!(myAnalizCurrentStateSymbol())) break;
                  continue;
               }
            }
         }
      }
      if (gia_1048[ai_0] == 1) myCheckAndOpenDO_FigureLevels();
   }
}

void myCheckAndOpenDO_FigureLevels() {
   for (int l_count_0 = 0; l_count_0 < 2; l_count_0++) {
      gi_1528 = 57320000;
      if (l_count_0 == 0) {
         if (gi_1616 == gi_1736) {
            if (gi_1312 < 0) continue;
            gi_1524 = 4;
            gi_1620 = gi_1752;
            gs_1632 = "BUY STOP";
            if (g_price_1572 < gd_1580 + gi_1312 * gd_1236) gd_1548 = gd_1580 + gi_1312 * gd_1236;
            else gd_1548 = gd_1580 + (gi_1312 + 100) * gd_1236;
         } else {
            if (gi_1320 < 0) continue;
            gi_1524 = 5;
            gi_1620 = gi_1756;
            gs_1632 = "SELL STOP";
            if (g_price_1572 < gd_1580 + gi_1320 * gd_1236) gd_1548 = gd_1580 - (100 - gi_1320) * gd_1236;
            else gd_1548 = gd_1580 + gi_1320 * gd_1236;
         }
      } else {
         if (gi_1616 == gi_1736) {
            if (gi_1316 < 0) continue;
            gi_1524 = 2;
            gi_1620 = gi_1744;
            gs_1632 = "BUY LIMIT";
            if (g_price_1572 < gd_1580 + gi_1316 * gd_1236) gd_1548 = gd_1580 - (100 - gi_1316) * gd_1236;
            else gd_1548 = gd_1580 + gi_1316 * gd_1236;
         } else {
            if (gi_1324 < 0) continue;
            gi_1524 = 3;
            gi_1620 = gi_1748;
            gs_1632 = "SELL LIMIT";
            if (g_price_1572 < gd_1580 + gi_1324 * gd_1236) gd_1548 = gd_1580 + gi_1324 * gd_1236;
            else gd_1548 = gd_1580 + (gi_1324 + 100) * gd_1236;
         }
      }
      if (gi_1616 == gi_1736) {
         gd_1564 = gd_1548 + gi_1276 * gd_1236;
         if (gi_1284 > 0) gd_1556 = gd_1548 - gi_1284 * gd_1236;
         else gd_1556 = 0;
      } else {
         gd_1564 = gd_1548 - gi_1280 * gd_1236;
         if (gi_1288 > 0) gd_1556 = gd_1548 + gi_1288 * gd_1236;
         else gd_1556 = 0;
      }
      gi_1624 = TRUE;
      if (gi_1624)
         if (!myCheckOrderBeforeAdding(gd_1548, gi_1616, gi_1524, g_price_1572)) gi_1624 = FALSE;
      if (gi_1624) {
         if (gi_1508 != 0)
            if (MathAbs(gd_1548 - g_price_1572) < gi_1508 * gd_1236) gi_1624 = FALSE;
         if (gi_1512 != 0)
            if (MathAbs(gd_1548 - g_price_1572) > gi_1512 * gd_1236) gi_1624 = FALSE;
      }
      if (gi_1624)
         if (gia_1656[gi_1616] > 0 && l_count_0 == 1) gi_1624 = FALSE;
      if (gi_1624) {
         if (gia_1656[gi_1620] > 0) {
            if (gi_1620 == gi_1752 || gi_1620 == gi_1748) gd_1596 = gda_1660[gi_1620];
            else gd_1596 = gda_1664[gi_1620];
            if (gi_940 != 0) gd_1604 = gi_940 * gd_1236;
            else gd_1604 = 1;
            if (gi_1620 == gi_1752 || gi_1620 == gi_1748) {
               if (gd_1548 > gd_1596 - gd_1604) gi_1624 = FALSE;
            } else
               if (gd_1548 < gd_1596 + gd_1604) gi_1624 = FALSE;
         }
      }
      if (gi_1624 && gia_1656[gi_1616] > 0) {
         if (myCheckDistanceFromOneWayReal(gd_1548, gi_1616, gs_1632, gd_1588)) {
            if ((gi_1616 == gi_1736 && gi_1352 == 1) || (gi_1616 == gi_1740 && gi_1356 == 1)) {
               gd_1564 = (gd_1548 + gd_1588) / 2.0;
               gi_1528 = 57320100;
            }
         } else gi_1624 = FALSE;
      }
      if (gi_1624 && gi_1360 == 1) {
         if (l_count_0 == 1) {
            if (gi_1616 == gi_1736 && gd_1684 < 0.0) gi_1624 = FALSE;
            if (gi_1616 == gi_1740 && gd_1684 > 0.0) gi_1624 = FALSE;
         }
      }
      if (gi_1624 && gi_1376 == 1) {
         if (l_count_0 == 1) {
            if (gi_1616 == gi_1736 && gd_1676 < 0.0) gi_1624 = FALSE;
            if (gi_1616 == gi_1740 && gd_1676 > 0.0) gi_1624 = FALSE;
         }
      }
      if (gi_1624 && gi_1412 > 0)
         if (!myCheckHighLowLimit(gd_1548, gi_1616, gs_1632)) gi_1624 = FALSE;
      if (gi_1624)
         if (!myCheckOpenOrdersBeforeAdding(gd_1548, gi_1524, g_price_1572)) gi_1624 = FALSE;
      if (gi_1624) {
         gd_1540 = gd_1532;
         g_ticket_1612 = myOrderSend(g_symbol_1228, gi_1524, gd_1540, gd_1548, 0, gd_1556, gd_1564, "", gi_1528, 0, Green);
         if (g_ticket_1612 > 0) {
            if (OrderSelect(g_ticket_1612, SELECT_BY_TICKET, MODE_TRADES))
               if (!(myAnalizCurrentStateSymbol())) break;
         }
      }
   }
}

void myCheckAndPrepareRO_Flat() {
   if (gi_1616 == gi_1736 && g_price_1572 > g_ilow_1712 && g_price_1572 <= g_ilow_1712 + gd_1728 / 4.0) {
      if (iOpen(g_symbol_1228, gia_1760[0], 0) >= iClose(g_symbol_1228, gia_1760[0], 1) && iClose(g_symbol_1228, gia_1760[0], 1) > iClose(g_symbol_1228, gia_1760[0], 2) &&
         iClose(g_symbol_1228, gia_1760[0], 2) > iClose(g_symbol_1228, gia_1760[0], 3)) {
         gi_1628 = TRUE;
         gi_1524 = 0;
         gd_1548 = g_price_1572;
         gd_1564 = gd_1548 + NormalizeDouble(gd_1728 / 2.0, gd_1244);
         if (gi_1276 > 0)
            if (gd_1564 > gd_1548 + gi_1276 * gd_1236) gd_1564 = gd_1548 + gi_1276 * gd_1236;
         if (gi_1472 > 0) gd_1556 = gd_1548 - gi_1472 * gd_1236;
         else {
            if (gi_1284 > 0) gd_1556 = gd_1548 - gi_1284 * gd_1236;
            else gd_1556 = 0;
         }
      }
   }
   if (gi_1616 == gi_1740 && g_price_1572 < g_ihigh_1720 && g_price_1572 >= g_ihigh_1720 - gd_1728 / 4.0) {
      if (iOpen(g_symbol_1228, gia_1760[0], 0) <= iClose(g_symbol_1228, gia_1760[0], 1) && iClose(g_symbol_1228, gia_1760[0], 1) < iClose(g_symbol_1228, gia_1760[0], 2) &&
         iClose(g_symbol_1228, gia_1760[0], 2) < iClose(g_symbol_1228, gia_1760[0], 3)) {
         gi_1628 = TRUE;
         gi_1524 = 1;
         gd_1548 = g_price_1572;
         gd_1564 = gd_1548 - NormalizeDouble(gd_1728 / 2.0, gd_1244);
         if (gi_1280 > 0)
            if (gd_1564 < gd_1548 - gi_1280 * gd_1236) gd_1564 = gd_1548 - gi_1280 * gd_1236;
         if (gi_1472 > 0) gd_1556 = gd_1548 + gi_1472 * gd_1236;
         else {
            if (gi_1288 > 0) gd_1556 = gd_1548 + gi_1288 * gd_1236;
            else gd_1556 = 0;
         }
      }
   }
   if (gi_1628) gi_1528 = 57320200;
}

void myCheckAndPrepareRO_Correction() {
   double l_ilow_0;
   double l_ihigh_8;
   double l_ilow_16 = 0;
   double l_ihigh_24 = 0;
   double l_ilow_32 = 0;
   double l_ihigh_40 = 0;
   for (int li_48 = 0; li_48 < CR_AnalizMove_CountBars; li_48++) {
      l_ilow_0 = iLow(g_symbol_1228, gia_1760[CR_AnalizMove_Period], li_48);
      l_ihigh_8 = iHigh(g_symbol_1228, gia_1760[CR_AnalizMove_Period], li_48);
      if (l_ilow_0 > 0.0)
         if (l_ilow_16 == 0.0 || l_ilow_0 < l_ilow_16) l_ilow_16 = l_ilow_0;
      if (l_ihigh_8 > 0.0)
         if (l_ihigh_24 == 0.0 || l_ihigh_8 > l_ihigh_24) l_ihigh_24 = l_ihigh_8;
   }
   for (li_48 = 0; li_48 < CR_AnalizFlat_CountBars; li_48++) {
      l_ilow_0 = iLow(g_symbol_1228, gia_1760[CR_AnalizFlat_Period], li_48);
      l_ihigh_8 = iHigh(g_symbol_1228, gia_1760[CR_AnalizFlat_Period], li_48);
      if (l_ilow_0 > 0.0)
         if (l_ilow_32 == 0.0 || l_ilow_0 < l_ilow_32) l_ilow_32 = l_ilow_0;
      if (l_ihigh_8 > 0.0)
         if (l_ihigh_40 == 0.0 || l_ihigh_8 > l_ihigh_40) l_ihigh_40 = l_ihigh_8;
   }
   if (l_ilow_16 == 0.0 || l_ihigh_24 == 0.0 || l_ilow_32 == 0.0 || l_ihigh_40 == 0.0) return;
   if (l_ihigh_24 - l_ilow_16 >= g_price_1572 * CR_WaitCorrectionAfterMove_PR / 100.0) {
      if (l_ihigh_40 - l_ilow_32 <= g_price_1572 * CR_WaitCorrectionAfterFlat_PR / 100.0) {
         if (gi_1616 == gi_1736 && g_price_1572 <= l_ilow_16 + g_price_1572 * CR_MaxDistanceFromBottom_PR / 100.0) {
            gi_1628 = TRUE;
            gi_1524 = 0;
            gd_1548 = g_price_1572;
            gd_1564 = gd_1548 + NormalizeDouble(g_price_1572 * CR_SizeCorrection_PR / 100.0, gd_1244);
            if (CR_StopLoss_PR > 0.0) gd_1556 = gd_1548 - NormalizeDouble(g_price_1572 * CR_StopLoss_PR / 100.0, gd_1244);
            else {
               if (gi_1284 > 0) gd_1556 = gd_1548 - gi_1284 * gd_1236;
               else gd_1556 = 0;
            }
         }
         if (gi_1616 == gi_1740 && g_price_1572 >= l_ihigh_24 - g_price_1572 * CR_MaxDistanceFromBottom_PR / 100.0) {
            gi_1628 = TRUE;
            gi_1524 = 1;
            gd_1548 = g_price_1572;
            gd_1564 = gd_1548 - NormalizeDouble(g_price_1572 * CR_SizeCorrection_PR / 100.0, gd_1244);
            if (CR_StopLoss_PR > 0.0) gd_1556 = gd_1548 + NormalizeDouble(g_price_1572 * CR_StopLoss_PR / 100.0, gd_1244);
            else {
               if (gi_1288 > 0) gd_1556 = gd_1548 + gi_1288 * gd_1236;
               else gd_1556 = 0;
            }
         }
         if (gi_1628) gi_1528 = 57320400;
      }
   }
}

void myCheckAndPrepareRO_Speed() {
   if (gi_1616 == gi_1736 && gd_1676 > 0.0) {
      gi_1628 = TRUE;
      gi_1524 = 0;
      gd_1548 = g_price_1572;
      if (gi_1404 == 1) gd_1564 = gd_1548 + MarketInfo(g_symbol_1228, MODE_STOPLEVEL) * gd_1236;
      else gd_1564 = gd_1548 + gi_1276 * gd_1236;
      if (gi_1408 > 0) gd_1556 = gd_1548 - gi_1408 * gd_1236;
      else {
         if (gi_1284 > 0) gd_1556 = gd_1548 - gi_1284 * gd_1236;
         else gd_1556 = 0;
      }
   }
   if (gi_1616 == gi_1740 && gd_1676 < 0.0) {
      gi_1628 = TRUE;
      gi_1524 = 1;
      gd_1548 = g_price_1572;
      if (gi_1404 == 1) gd_1564 = gd_1548 - MarketInfo(g_symbol_1228, MODE_STOPLEVEL) * gd_1236;
      else gd_1564 = gd_1548 - gi_1280 * gd_1236;
      if (gi_1408 > 0) gd_1556 = gd_1548 + gi_1408 * gd_1236;
      else {
         if (gi_1288 > 0) gd_1556 = gd_1548 + gi_1288 * gd_1236;
         else gd_1556 = 0;
      }
   }
   if (gi_1628) gi_1528 = 57320300;
}

bool myCheckOrderBeforeAdding(double ad_0, int ai_8, int ai_12, double ad_unused_16) {
   double ld_24;
   string ls_32;
   if (Time[0] > D'25.07.2008 11:28' && Time[0] < D'10.09.2008 09:17') return (FALSE);
   if (ai_8 == gi_1736) {
      if (gi_1268 == 0) return (FALSE);
      if (ai_12 == 0 && gi_1484 == 0) return (FALSE);
      if (gd_1488 > 0.0 && ad_0 >= gd_1488) return (FALSE);
   }
   if (ai_8 == gi_1740) {
      if (gi_1272 == 0) return (FALSE);
      if (ai_12 == 1 && gi_1484 == 0) return (FALSE);
      if (gd_1496 > 0.0 && ad_0 <= gd_1496) return (FALSE);
   }
   if (MaxOpenValPosition > 0.0) {
      if (StringLen(g_symbol_1228) == 6) {
         for (int l_count_40 = 0; l_count_40 < 2; l_count_40++) {
            ls_32 = StringSubstr(g_symbol_1228, 3 * l_count_40 + 0, 3);
            ld_24 = 0;
            for (int l_index_44 = 0; l_index_44 < gi_1640; l_index_44++) {
               if (gsa_1644[l_index_44] == ls_32) {
                  ld_24 = gda_1648[l_index_44] - gda_1652[l_index_44];
                  if (!(((ai_8 == gi_1736 && l_count_40 == 1) || (ai_8 == gi_1740 && l_count_40 == 0)))) break;
                  ld_24 = -ld_24;
                  break;
               }
            }
            if (ld_24 > gd_1532 * MaxOpenValPosition) return (FALSE);
         }
      }
   }
   return (TRUE);
}

bool myCheckOpenOrdersBeforeAdding(double ad_0, int ai_8, double ad_12) {
   int l_ord_total_20;
   int l_count_24;
   int l_cmd_28;
   int l_ticket_32;
   double ld_36;
   double ld_44;
   if (ai_8 == 0 || ai_8 == 2)
      if (!glDeleteAllDeferOrders(OP_BUYLIMIT, g_symbol_1228)) return (FALSE);
   if (ai_8 == 1 || ai_8 == 3)
      if (!glDeleteAllDeferOrders(OP_SELLLIMIT, g_symbol_1228)) return (FALSE);
   if (gi_1504 != 0) {
      l_count_24 = 0;
      l_ord_total_20 = OrdersTotal();
      for (int l_pos_52 = 0; l_pos_52 < l_ord_total_20; l_pos_52++) {
         if (OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == g_symbol_1228)
               if (myIsOwnOrder()) l_count_24++;
         }
      }
      if (l_count_24 >= gi_1504) {
         ld_44 = 0;
         for (l_pos_52 = 0; l_pos_52 < l_ord_total_20; l_pos_52++) {
            if (OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES)) {
               if (OrderSymbol() == g_symbol_1228) {
                  if (myIsOwnOrder()) {
                     l_cmd_28 = OrderType();
                     if (l_cmd_28 == OP_BUYLIMIT || l_cmd_28 == OP_BUYSTOP) ld_36 = MathAbs(g_ask_1260 - OrderOpenPrice());
                     else {
                        if (!((l_cmd_28 == OP_SELLLIMIT || l_cmd_28 == OP_SELLSTOP))) continue;
                        ld_36 = MathAbs(g_bid_1252 - OrderOpenPrice());
                     }
                     if (ld_36 > ld_44) {
                        ld_44 = ld_36;
                        l_ticket_32 = OrderTicket();
                     }
                  }
               }
            }
         }
         if (ld_44 > MathAbs(ad_0 - ad_12)) {
            if (myOrderDelete(l_ticket_32)) {
               l_count_24--;
               l_ord_total_20 = OrdersTotal();
            }
            return (FALSE);
         }
         return (FALSE);
      }
   }
   return (TRUE);
}

bool myCheckDistanceFromOneWayReal(double ad_0, int ai_8, string as_unused_12, double &ad_20) {
   double ld_28;
   if (gia_1656[ai_8] == 0) return (TRUE);
   if (ai_8 == gi_1736 && gi_1328 == 0) return (FALSE);
   if (ai_8 == gi_1740 && gi_1332 == 0) return (FALSE);
   if (ai_8 == gi_1736) {
      ad_20 = gda_1660[ai_8];
      ld_28 = gda_1664[ai_8] * gd_1336 / 100.0;
   } else {
      ad_20 = gda_1664[ai_8];
      ld_28 = gda_1664[ai_8] * gd_1344 / 100.0;
   }
   if (ai_8 == gi_1736) {
      if (ad_0 <= ad_20 - ld_28) return (TRUE);
      return (FALSE);
   }
   if (ad_0 < ad_20 + ld_28) return (FALSE);
   return (TRUE);
}

bool myCheckHighLowLimit(double ad_unused_0, int ai_unused_8, string as_unused_12) {
   for (int l_count_20 = 0; l_count_20 < gi_1412; l_count_20++) {
      switch (l_count_20) {
      case 0:
         gd_unused_1700 = gd_1416;
         break;
      case 1:
         gd_unused_1700 = gd_1432;
      }
   }
   return (TRUE);
}

double myGetLotSize(int ai_0) {
   double ld_ret_4;
   if (gda_1008[ai_0] > 0.0) ld_ret_4 = glDoubleRound(AccountFreeMargin() / 1000.0 * gda_1008[ai_0], gda_1208[ai_0]);
   else ld_ret_4 = gda_1200[ai_0];
   if (ld_ret_4 < gda_1200[ai_0]) ld_ret_4 = gda_1200[ai_0];
   if (ld_ret_4 > gda_1204[ai_0]) ld_ret_4 = gda_1204[ai_0];
   return (ld_ret_4);
}

int myAnalizCurrentStateGeneral() {
   int l_cmd_0;
   double ld_unused_4;
   double l_ord_lots_12;
   string ls_20;
   int l_ord_total_28 = OrdersTotal();
   for (int l_pos_32 = 0; l_pos_32 < gi_1640; l_pos_32++) {
      gda_1648[l_pos_32] = 0;
      gda_1652[l_pos_32] = 0;
   }
   for (l_pos_32 = 0; l_pos_32 < l_ord_total_28; l_pos_32++) {
      if (!OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) return (0);
      if (myIsOwnOrder()) {
         l_cmd_0 = OrderType();
         ld_unused_4 = OrderOpenPrice();
         l_ord_lots_12 = OrderLots();
         if (StringLen(OrderSymbol()) == 6) {
            for (int l_count_36 = 0; l_count_36 < 2; l_count_36++) {
               ls_20 = StringSubstr(OrderSymbol(), 3 * l_count_36 + 0, 3);
               for (int l_index_40 = 0; l_index_40 < gi_1640; l_index_40++) {
                  if (gsa_1644[l_index_40] == ls_20) {
                     if ((l_cmd_0 == OP_BUY && l_count_36 == 0) || (l_cmd_0 == OP_SELL && l_count_36 == 1)) {
                        gda_1648[l_index_40] += l_ord_lots_12;
                        break;
                     }
                     if (!(((l_cmd_0 == OP_BUY && l_count_36 == 1) || (l_cmd_0 == OP_SELL && l_count_36 == 0)))) break;
                     gda_1652[l_index_40] += l_ord_lots_12;
                     break;
                  }
               }
            }
         }
      }
   }
   return (1);
}

int myAnalizCurrentStateSymbol() {
   int l_cmd_0;
   int li_4;
   double l_ord_open_price_8;
   double l_ord_lots_16;
   int l_ord_total_24 = OrdersTotal();
   gi_1672 = FALSE;
   for (int l_pos_28 = 0; l_pos_28 < 6; l_pos_28++) {
      gda_1660[l_pos_28] = -1;
      gda_1664[l_pos_28] = -1;
      gda_1668[l_pos_28] = 0;
      gia_1656[l_pos_28] = 0;
   }
   for (l_pos_28 = 0; l_pos_28 < l_ord_total_24; l_pos_28++) {
      if (!OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES)) return (0);
      if (OrderSymbol() == g_symbol_1228) {
         if (myIsOwnOrder()) {
            l_cmd_0 = OrderType();
            l_ord_open_price_8 = OrderOpenPrice();
            l_ord_lots_16 = OrderLots();
            li_4 = myGetNormalOrderType(l_cmd_0);
            if (li_4 == -1) return (0);
            gia_1656[li_4]++;
            if (gda_1660[li_4] == -1.0 || l_ord_open_price_8 < gda_1660[li_4]) gda_1660[li_4] = l_ord_open_price_8;
            if (gda_1664[li_4] == -1.0 || l_ord_open_price_8 > gda_1664[li_4]) gda_1664[li_4] = l_ord_open_price_8;
            gda_1668[li_4] += l_ord_lots_16;
            if (OrderMagicNumber() == 57320900) gi_1672 = TRUE;
         }
      }
   }
   return (1);
}

int myGetSettingsFromString(string &asa_0[], string as_4, string as_12 = ";", string as_20 = "", string as_28 = "") {
   int li_36;
   string ls_40;
   string l_str_concat_48;
   string ls_56;
   int l_count_64 = 0;
   ArrayResize(asa_0, gi_964);
   for (int l_index_68 = 0; l_index_68 < gi_964; l_index_68++) {
      l_str_concat_48 = StringConcatenate(gsa_968[l_index_68], ":");
      li_36 = StringFind(as_4, l_str_concat_48);
      if (li_36 != -1) ls_40 = as_4;
      else {
         li_36 = StringFind(as_28, l_str_concat_48);
         ls_40 = as_28;
      }
      if (li_36 != -1) {
         ls_56 = StringSubstr(ls_40, li_36 + StringLen(l_str_concat_48));
         li_36 = StringFind(ls_56, as_12);
         if (li_36 != -1) ls_56 = StringSubstr(ls_56, 0, li_36);
         asa_0[l_index_68] = glStringTrimAll(ls_56);
         l_count_64++;
      } else asa_0[l_index_68] = as_20;
   }
   return (l_count_64);
}

bool myCheckAllowWorking() {
   if (gi_1516) return (FALSE);
   if (!IsTradeAllowed()) return (FALSE);
   return (TRUE);
}

int myControlOpenOrdersSymbol() {
   int l_ord_total_0;
   int li_4;
   int li_8;
   int l_cmd_12;
   int l_magic_16;
   double l_ord_open_price_20;
   double l_ord_stoploss_28;
   double l_price_36;
   double l_str2dbl_44;
   double l_str2dbl_52;
   double ld_60;
   string ls_68;
   if (gi_912 == 1) {
      l_ord_total_0 = OrdersTotal();
      for (int l_pos_76 = 0; l_pos_76 < l_ord_total_0; l_pos_76++) {
         OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES);
         if (myIsOwnOrder()) {
            if (OrderStopLoss() == 0.0 && OrderTakeProfit() == 0.0) {
               ls_68 = OrderComment();
               li_4 = StringFind(ls_68, "{TP=");
               if (li_4 != -1) {
                  li_8 = StringFind(ls_68, "}", li_4);
                  if (li_8 != -1) {
                     l_str2dbl_44 = StrToDouble(StringSubstr(ls_68, li_4 + 4, li_8 - li_4 - 4));
                     li_4 = StringFind(ls_68, "{SL=");
                     if (li_4 != -1) {
                        li_8 = StringFind(ls_68, "}", li_4);
                        if (li_8 != -1) {
                           l_str2dbl_52 = StrToDouble(StringSubstr(ls_68, li_4 + 4, li_8 - li_4 - 4));
                           OrderModify(OrderTicket(), OrderOpenPrice(), l_str2dbl_52, l_str2dbl_44, 0);
                        }
                     }
                  }
               }
            }
         }
      }
   }
   if (gi_1292 > 0) {
      l_ord_total_0 = OrdersTotal();
      for (l_pos_76 = l_ord_total_0 - 1; l_pos_76 >= 0; l_pos_76--) {
         OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES);
         if (OrderSymbol() == g_symbol_1228) {
            if (myIsOwnOrder()) {
               if (OrderType() == OP_BUY || OrderType() == OP_SELL)
                  if (TimeCurrent() - OrderOpenTime() > 60 * gi_1292) glOrderClose();
            }
         }
      }
   }
   if (gia_1656[gi_1736] != 0 && gia_1656[gi_1744] != 0) glDeleteAllDeferOrders(gi_1744, g_symbol_1228);
   if (gia_1656[gi_1740] != 0 && gia_1656[gi_1748] != 0) glDeleteAllDeferOrders(gi_1748, g_symbol_1228);
   if (gia_1656[gi_1736] != 0 && gia_1656[gi_1752] != 0 && gda_1664[gi_1752] >= gda_1660[gi_1736]) glDeleteAllDeferOrders(gi_1752, g_symbol_1228, gda_1660[gi_1736], 0);
   if (gia_1656[gi_1740] != 0 && gia_1656[gi_1756] != 0 && gda_1660[gi_1756] <= gda_1664[gi_1740]) glDeleteAllDeferOrders(gi_1756, g_symbol_1228, 0, gda_1664[gi_1740]);
   if (gia_1656[gi_1736] != 0 && gia_1656[gi_1740] != 0) {
      if ((gi_1296 != 0 && gi_1296 != gi_1276 || gi_1296 != gi_1280) || (gi_1300 != 0 && gi_1300 != gi_1284 || gi_1300 != gi_1288)) {
         ld_60 = (g_ask_1260 + g_bid_1252) / 2.0;
         l_ord_total_0 = OrdersTotal();
         for (l_pos_76 = 0; l_pos_76 < l_ord_total_0; l_pos_76++) {
            if (!OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES)) return (0);
            if (OrderSymbol() == g_symbol_1228) {
               if (myIsOwnOrder()) {
                  l_cmd_12 = OrderType();
                  l_ord_open_price_20 = OrderOpenPrice();
                  l_price_36 = OrderTakeProfit();
                  l_ord_stoploss_28 = OrderStopLoss();
                  l_magic_16 = OrderMagicNumber();
                  if (l_magic_16 != 57320100) {
                     if (l_cmd_12 == OP_BUY && l_ord_open_price_20 == gda_1660[gi_1736]) {
                        if (l_price_36 < l_ord_open_price_20 + gi_1296 * gd_1236)
                           if (OrderModify(OrderTicket(), l_ord_open_price_20, l_ord_stoploss_28, l_ord_open_price_20 + gi_1296 * gd_1236, 0)) l_price_36 = l_ord_open_price_20 + gi_1296 * gd_1236;
                        if (gi_1300 != 0 && l_ord_open_price_20 > gda_1664[gi_1740] && l_ord_open_price_20 - gda_1664[gi_1740] > 2.2 * gi_1300 * gd_1236 && MathAbs(l_ord_open_price_20 - ld_60) < MathAbs(gda_1664[gi_1740] - ld_60) &&
                           l_ord_stoploss_28 < l_ord_open_price_20 - gi_1300 * gd_1236)
                           if (OrderModify(OrderTicket(), l_ord_open_price_20, l_ord_open_price_20 - gi_1300 * gd_1236, l_price_36, 0)) l_ord_stoploss_28 = l_ord_open_price_20 - gi_1300 * gd_1236;
                     } else {
                        if (l_cmd_12 == OP_SELL && l_ord_open_price_20 == gda_1664[gi_1740]) {
                           if (l_price_36 > l_ord_open_price_20 - gi_1296 * gd_1236)
                              if (OrderModify(OrderTicket(), l_ord_open_price_20, l_ord_stoploss_28, l_ord_open_price_20 - gi_1296 * gd_1236, 0)) l_price_36 = l_ord_open_price_20 - gi_1296 * gd_1236;
                           if (gi_1300 != 0 && l_ord_open_price_20 < gda_1660[gi_1736] && gda_1660[gi_1736] - l_ord_open_price_20 > 2.2 * gi_1300 * gd_1236 && MathAbs(l_ord_open_price_20 - ld_60) < MathAbs(gda_1660[gi_1736] - ld_60) &&
                              l_ord_stoploss_28 > l_ord_open_price_20 + gi_1300 * gd_1236)
                              if (OrderModify(OrderTicket(), l_ord_open_price_20, l_ord_open_price_20 + gi_1300 * gd_1236, l_price_36, 0)) l_ord_stoploss_28 = l_ord_open_price_20 + gi_1300 * gd_1236;
                        }
                     }
                  }
               }
            }
         }
      }
   }
   if (gi_1360 == 1 && gd_1684 != 0.0) {
      if (gd_1684 > 0.0) glDeleteAllDeferOrders(gi_1748, g_symbol_1228);
      if (gd_1684 < 0.0) glDeleteAllDeferOrders(gi_1744, g_symbol_1228);
   }
   if (gi_1376 == 1 && gd_1676 != 0.0) {
      if (gd_1676 > 0.0 && gia_1656[gi_1748] > 0 && gda_1660[gi_1748] < g_bid_1252 + 20.0 * gd_1236) glDeleteAllDeferOrders(gi_1748, g_symbol_1228);
      if (gd_1676 < 0.0 && gia_1656[gi_1744] > 0 && gda_1664[gi_1744] > g_ask_1260 - 20.0 * gd_1236) glDeleteAllDeferOrders(gi_1744, g_symbol_1228);
   }
   if (gi_1412 > 0) {
      for (int l_count_80 = 0; l_count_80 < gi_1412; l_count_80++) {
         switch (l_count_80) {
         case 0:
            gd_unused_1700 = gd_1416;
            break;
         case 1:
            gd_unused_1700 = gd_1432;
         }
      }
   }
   l_ord_total_0 = OrdersTotal();
   if (gi_1304 > 0) {
      for (l_pos_76 = 0; l_pos_76 < l_ord_total_0; l_pos_76++) {
         OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES);
         if (OrderSymbol() == g_symbol_1228) {
            if (myIsOwnOrder()) {
               if (OrderType() == OP_BUY) {
                  if (g_bid_1252 > OrderOpenPrice() + gd_1236 * gi_1304)
                     if (OrderStopLoss() == 0.0 || OrderStopLoss() < g_bid_1252 - gd_1236 * (gi_1304 + gi_1308)) OrderModify(OrderTicket(), OrderOpenPrice(), g_bid_1252 - gd_1236 * gi_1304, OrderTakeProfit(), 0);
               } else {
                  if (OrderType() == OP_SELL) {
                     if (g_ask_1260 < OrderOpenPrice() - gd_1236 * gi_1304)
                        if (OrderStopLoss() == 0.0 || OrderStopLoss() > g_ask_1260 + gd_1236 * (gi_1304 + gi_1308)) OrderModify(OrderTicket(), OrderOpenPrice(), g_ask_1260 + gd_1236 * gi_1304, OrderTakeProfit(), 0);
                  }
               }
            }
         }
      }
   }
   return (0);
}

void myCalculateIndicators() {
   gd_1684 = 0;
   if (gi_1360 == 1) myIndicator_Accelerator();
   gd_1676 = 0;
   if (gi_1376 == 1) myIndicator_Speed();
   if (gi_1412 > 0) myIndicator_HighLowLimit();
   if (gi_1448 == 1) myIndicator_Flat();
}

void myIndicator_Accelerator() {
   double lda_0[10][10];
   int lia_4[10];
   for (int l_index_8 = 0; l_index_8 < gi_1368; l_index_8++) {
      for (int li_12 = 0; li_12 < gi_1364; li_12++) lda_0[l_index_8][li_12] = iAC(g_symbol_1228, gia_1760[gi_1372 + l_index_8], li_12);
      if (lda_0[l_index_8][gi_1364 - 2] > lda_0[l_index_8][gi_1364 - 1]) lia_4[l_index_8] = 1;
      else {
         if (lda_0[l_index_8][gi_1364 - 2] < lda_0[l_index_8][gi_1364 - 1]) lia_4[l_index_8] = -1;
         else {
            lia_4[l_index_8] = 0;
            break;
         }
      }
      for (li_12 = gi_1364 - 3; li_12 >= 0; li_12--) {
         if (lia_4[l_index_8] == 1 && lda_0[l_index_8][li_12] <= lda_0[l_index_8][li_12 + 1]) {
            lia_4[l_index_8] = 0;
            break;
         }
         if (lia_4[l_index_8] == -1 && lda_0[l_index_8][li_12] >= lda_0[l_index_8][li_12 + 1]) {
            lia_4[l_index_8] = 0;
            break;
         }
      }
   }
   gd_1684 = lia_4[0];
   for (l_index_8 = 1; l_index_8 < gi_1368; l_index_8++) {
      if (lia_4[l_index_8] != gd_1684) {
         gd_1684 = 0;
         break;
      }
   }
   if (gd_1684 != 0.0) gd_1684 = lda_0[0][0] - lda_0[0][1];
}

void myIndicator_Speed() {
   double lda_0[10][10];
   int lia_4[10];
   double ld_8;
   double ld_16;
   for (int l_index_24 = 0; l_index_24 < gi_1384; l_index_24++) {
      for (int l_count_28 = 0; l_count_28 < gi_1380; l_count_28++) {
         ld_8 = (iHigh(g_symbol_1228, gia_1760[gi_1388 + l_index_24], l_count_28 + 2) + iLow(g_symbol_1228, gia_1760[gi_1388 + l_index_24], l_count_28 + 2) + 2.0 * iClose(g_symbol_1228, gia_1760[gi_1388 +
            l_index_24], l_count_28 + 2)) / 4.0;
         ld_16 = (iHigh(g_symbol_1228, gia_1760[gi_1388 + l_index_24], l_count_28 + 1) + iLow(g_symbol_1228, gia_1760[gi_1388 + l_index_24], l_count_28 + 1) + 2.0 * iClose(g_symbol_1228, gia_1760[gi_1388 +
            l_index_24], l_count_28 + 1)) / 4.0;
         if (ld_8 > 0.0) lda_0[l_index_24][l_count_28] = (ld_16 - ld_8) / ld_8;
         else lda_0[l_index_24][l_count_28] = 0;
      }
      if (l_index_24 == 0 && gi_1388 == 0) {
         if (g_bid_1252 > iOpen(g_symbol_1228, gia_1760[0], 0)) lia_4[0] = 1;
         else {
            if (g_bid_1252 < iOpen(g_symbol_1228, gia_1760[0], 0)) lia_4[0] = -1;
            else {
               if (lda_0[l_index_24][0] > 0.0) lia_4[l_index_24] = 1;
               else {
                  if (lda_0[l_index_24][0] < 0.0) lia_4[l_index_24] = -1;
                  else {
                     lia_4[l_index_24] = 0;
                     break;
                  }
               }
            }
         }
      } else {
         if (iOpen(g_symbol_1228, gia_1760[gi_1388 + l_index_24], 0) > iClose(g_symbol_1228, gia_1760[gi_1388 + l_index_24], 1)) lia_4[l_index_24] = 1;
         else {
            if (iOpen(g_symbol_1228, gia_1760[gi_1388 + l_index_24], 0) < iClose(g_symbol_1228, gia_1760[gi_1388 + l_index_24], 1)) lia_4[l_index_24] = -1;
            else {
               if (lda_0[l_index_24][0] > 0.0) lia_4[l_index_24] = 1;
               else {
                  if (lda_0[l_index_24][0] < 0.0) lia_4[l_index_24] = -1;
                  else {
                     lia_4[l_index_24] = 0;
                     break;
                  }
               }
            }
         }
      }
      if ((lda_0[l_index_24][gi_1380 - 1]) * lia_4[l_index_24] <= 0.0) {
         lia_4[l_index_24] = 0;
         break;
      }
      for (l_count_28 = gi_1380 - 2; l_count_28 >= 0; l_count_28--) {
         if (lia_4[l_index_24] == 1 && lda_0[l_index_24][l_count_28] <= lda_0[l_index_24][l_count_28 + 1]) {
            lia_4[l_index_24] = 0;
            break;
         }
         if (lia_4[l_index_24] == -1 && lda_0[l_index_24][l_count_28] >= lda_0[l_index_24][l_count_28 + 1]) {
            lia_4[l_index_24] = 0;
            break;
         }
      }
   }
   gd_1676 = lia_4[0];
   for (l_index_24 = 1; l_index_24 < gi_1384; l_index_24++) {
      if (lia_4[l_index_24] != gd_1676) {
         gd_1676 = 0;
         break;
      }
   }
   if (gd_1676 != 0.0) {
      ld_8 = iOpen(g_symbol_1228, gia_1760[0], 0);
      ld_16 = g_bid_1252;
      if (gi_1388 == 0 && ld_8 != ld_16 && ld_8 > 0.0) {
         gd_1676 = (ld_16 - ld_8) / ld_8;
         return;
      }
      gd_1676 = lda_0[0][0];
   }
}

void myIndicator_HighLowLimit() {
   int li_0;
   int li_4;
   double l_ilow_8;
   double l_ihigh_16;
   int li_32;
   for (int l_index_24 = 0; l_index_24 < gi_1412; l_index_24++) {
      gda_1692[l_index_24] = 0;
      gda_1696[l_index_24] = 0;
      switch (l_index_24) {
      case 0:
         li_4 = gi_1424;
         li_0 = gi_1428;
         break;
      case 1:
         li_4 = gi_1440;
         li_0 = gi_1444;
         break;
         while (true) {
            l_ilow_8 = iLow(g_symbol_1228, gia_1760[li_4], li_32);
            l_ihigh_16 = iHigh(g_symbol_1228, gia_1760[li_4], li_32);
            if (l_ilow_8 > 0.0)
               if (gda_1692[l_index_24] == 0.0 || l_ilow_8 < gda_1692[l_index_24]) gda_1692[l_index_24] = l_ilow_8;
            if (l_ihigh_16 > 0.0)
               if (gda_1696[l_index_24] == 0.0 || l_ihigh_16 > gda_1696[l_index_24]) gda_1696[l_index_24] = l_ihigh_16;
            li_32++;
            if (li_32 < li_0) continue;
            break;
         }
      }
   }
}

void myIndicator_Flat() {
   double l_ilow_0;
   double l_ihigh_8;
   int l_count_16;
   int l_count_20;
   int li_24;
   gi_1708 = FALSE;
   g_ilow_1712 = 0;
   g_ihigh_1720 = 0;
   gd_1728 = 0;
   for (int li_28 = 0; li_28 < gi_1468; li_28++) {
      l_ilow_0 = iLow(g_symbol_1228, gia_1760[gi_1464], li_28);
      l_ihigh_8 = iHigh(g_symbol_1228, gia_1760[gi_1464], li_28);
      if (l_ilow_0 > 0.0)
         if (g_ilow_1712 == 0.0 || l_ilow_0 < g_ilow_1712) g_ilow_1712 = l_ilow_0;
      if (l_ihigh_8 > 0.0)
         if (g_ihigh_1720 == 0.0 || l_ihigh_8 > g_ihigh_1720) g_ihigh_1720 = l_ihigh_8;
   }
   gd_1728 = g_ihigh_1720 - g_ilow_1712;
   if (g_ihigh_1720 > 0.0 && g_ilow_1712 > 0.0 && gd_1728 >= gi_1452 * gd_1236 && gd_1728 <= gi_1456 * gd_1236) {
      l_count_16 = 0;
      l_count_20 = 0;
      li_24 = 0;
      for (li_28 = 0; li_28 < gi_1468; li_28++) {
         l_ilow_0 = iLow(g_symbol_1228, gia_1760[gi_1464], li_28);
         l_ihigh_8 = iHigh(g_symbol_1228, gia_1760[gi_1464], li_28);
         if (l_ilow_0 > 0.0 && l_ilow_0 < g_ilow_1712 + gd_1728 / 4.0 && li_24 >= 0) {
            li_24 = -1;
            l_count_16++;
         }
         if (l_ihigh_8 > 0.0 && l_ihigh_8 > g_ihigh_1720 - gd_1728 / 4.0 && li_24 <= 0) {
            li_24 = 1;
            l_count_20++;
         }
      }
      if (l_count_16 >= gi_1460 && l_count_20 >= gi_1460) gi_1708 = TRUE;
   }
}

bool myIsOwnOrder(int a_magic_0 = -1) {
   if (a_magic_0 == -1) a_magic_0 = OrderMagicNumber();
   string l_magic_4 = a_magic_0;
   if (StringFind(l_magic_4, "5732", 0) == 0) return (TRUE);
   return (FALSE);
}

int myGetNormalOrderType(int ai_0) {
   switch (ai_0) {
   case 0:
      return (gi_1736);
   case 1:
      return (gi_1740);
   case 2:
      return (gi_1744);
   case 4:
      return (gi_1752);
   case 3:
      return (gi_1748);
   case 5:
      return (gi_1756);
   }
   return (-1);
}

int myOrderSend(string a_symbol_0, int a_cmd_8, double a_lots_12, double a_price_20, int a_slippage_28, double ad_32, double ad_40, string as_48 = "", int a_magic_56 = 0, int a_datetime_60 = 0, color a_color_64 = -1) {
   double l_price_68;
   double l_price_76;
   string l_str_concat_84 = StringConcatenate(gs_gepard__948, as_48);
   if (gi_912 == 1) {
      l_price_76 = 0;
      l_price_68 = 0;
      l_str_concat_84 = StringConcatenate(l_str_concat_84, " {TP=", ad_40, "} {SL=", ad_32, "}");
   } else {
      l_price_76 = ad_40;
      l_price_68 = ad_32;
   }
   int l_ticket_92 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, a_slippage_28, l_price_68, l_price_76, l_str_concat_84, a_magic_56, a_datetime_60, a_color_64);
   if (l_ticket_92 > 0)
      if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) return (1);
   return (0);
}

bool myOrderDelete(int a_ticket_0) {
   int l_ord_delete_4;
   l_ord_delete_4 = OrderDelete(a_ticket_0);
   return (l_ord_delete_4);
}

void myGetSymbolSettingsDay() {
   for (int l_index_0 = 0; l_index_0 < gi_964; l_index_0++) {
      gda_980[l_index_0] = MarketInfo(gsa_968[l_index_0], MODE_SWAPLONG);
      gda_984[l_index_0] = MarketInfo(gsa_968[l_index_0], MODE_SWAPSHORT);
   }
   g_day_1520 = Day();
}

void GetSymbolsSettingsFromStrings() {
   string lsa_0[];
   ArrayResize(gia_988, gi_964);
   myGetSettingsFromString(lsa_0, gs_96);
   for (int l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_988[l_index_4] = gi_92;
      else gia_988[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_992, gi_964);
   myGetSettingsFromString(lsa_0, gs_104);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_992[l_index_4] = 1;
      else gia_992[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_996, gi_964);
   myGetSettingsFromString(lsa_0, gs_112);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_996[l_index_4] = 1;
      else gia_996[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1028, gi_964);
   myGetSettingsFromString(lsa_0, gs_256);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1028[l_index_4] = gi_252;
      else gia_1028[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1012, gi_964);
   myGetSettingsFromString(lsa_0, gs_196);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1012[l_index_4] = gi_192;
      else gia_1012[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1012[l_index_4] != 0) gia_1012[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1012[l_index_4]);
   }
   ArrayResize(gia_1016, gi_964);
   myGetSettingsFromString(lsa_0, gs_208);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1016[l_index_4] = gi_204;
      else gia_1016[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1016[l_index_4] != 0) gia_1016[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1016[l_index_4]);
   }
   ArrayResize(gia_1020, gi_964);
   myGetSettingsFromString(lsa_0, gs_232);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1020[l_index_4] = gi_228;
      else gia_1020[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1020[l_index_4] != 0) gia_1020[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1020[l_index_4]);
   }
   ArrayResize(gia_1024, gi_964);
   myGetSettingsFromString(lsa_0, gs_244);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1024[l_index_4] = gi_240;
      else gia_1024[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1024[l_index_4] != 0) gia_1024[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1024[l_index_4]);
   }
   ArrayResize(gia_1032, gi_964);
   myGetSettingsFromString(lsa_0, gs_268);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1032[l_index_4] = gi_264;
      else gia_1032[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1032[l_index_4] != 0) gia_1032[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1032[l_index_4]);
   }
   ArrayResize(gia_1036, gi_964);
   myGetSettingsFromString(lsa_0, gs_280);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1036[l_index_4] = gi_276;
      else gia_1036[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1036[l_index_4] != 0) gia_1036[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1036[l_index_4]);
   }
   ArrayResize(gia_1040, gi_964);
   myGetSettingsFromString(lsa_0, gs_292);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1040[l_index_4] = gi_288;
      else gia_1040[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1040[l_index_4] != 0) gia_1040[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1040[l_index_4]);
   }
   ArrayResize(gia_1044, gi_964);
   myGetSettingsFromString(lsa_0, gs_304);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1044[l_index_4] = gi_300;
      else gia_1044[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1044[l_index_4] < 0) gia_1044[l_index_4] = 0;
   }
   ArrayResize(gia_1048, gi_964);
   myGetSettingsFromString(lsa_0, gs_396);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1048[l_index_4] = gi_392;
      else gia_1048[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1052, gi_964);
   myGetSettingsFromString(lsa_0, gs_408);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1052[l_index_4] = gi_404;
      else gia_1052[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1052[l_index_4] > 100) gia_1052[l_index_4] = -1;
   }
   ArrayResize(gia_1056, gi_964);
   myGetSettingsFromString(lsa_0, gs_420);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1056[l_index_4] = gi_416;
      else gia_1056[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1056[l_index_4] > 100) gia_1056[l_index_4] = -1;
   }
   ArrayResize(gia_1060, gi_964);
   myGetSettingsFromString(lsa_0, gs_432);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1060[l_index_4] = gi_428;
      else gia_1060[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1060[l_index_4] > 100) gia_1060[l_index_4] = -1;
   }
   ArrayResize(gia_1064, gi_964);
   myGetSettingsFromString(lsa_0, gs_444);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1064[l_index_4] = gi_440;
      else gia_1064[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1064[l_index_4] > 100) gia_1064[l_index_4] = -1;
   }
   ArrayResize(gia_1068, gi_964);
   myGetSettingsFromString(lsa_0, gs_316);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1068[l_index_4] = gi_312;
      else gia_1068[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1072, gi_964);
   myGetSettingsFromString(lsa_0, gs_328);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1072[l_index_4] = gi_324;
      else gia_1072[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1076, gi_964);
   myGetSettingsFromString(lsa_0, sMinDistanceRealOrdersB_PR);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1076[l_index_4] = dMinDistanceRealOrdersB_PR;
      else gda_1076[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1080, gi_964);
   myGetSettingsFromString(lsa_0, sMinDistanceRealOrdersS_PR);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1080[l_index_4] = dMinDistanceRealOrdersS_PR;
      else gda_1080[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1084, gi_964);
   myGetSettingsFromString(lsa_0, gs_372);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1084[l_index_4] = gi_368;
      else gia_1084[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1088, gi_964);
   myGetSettingsFromString(lsa_0, gs_384);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1088[l_index_4] = gi_380;
      else gia_1088[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1092, gi_964);
   myGetSettingsFromString(lsa_0, gs_516);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1092[l_index_4] = gi_512;
      else gia_1092[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1096, gi_964);
   myGetSettingsFromString(lsa_0, gs_528);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1096[l_index_4] = gi_524;
      else gia_1096[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1096[l_index_4] < 2) gia_1096[l_index_4] = 2;
      if (gia_1096[l_index_4] > 10) gia_1096[l_index_4] = 10;
   }
   ArrayResize(gia_1100, gi_964);
   myGetSettingsFromString(lsa_0, gs_540);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1100[l_index_4] = gi_536;
      else gia_1100[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1100[l_index_4] < 1) gia_1100[l_index_4] = 1;
      if (gia_1100[l_index_4] > 5) gia_1100[l_index_4] = 5;
   }
   ArrayResize(gia_1104, gi_964);
   myGetSettingsFromString(lsa_0, gs_552);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1104[l_index_4] = gi_548;
      else gia_1104[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1108, gi_964);
   myGetSettingsFromString(lsa_0, gs_564);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1108[l_index_4] = gi_560;
      else gia_1108[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1112, gi_964);
   myGetSettingsFromString(lsa_0, gs_576);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1112[l_index_4] = gi_572;
      else gia_1112[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1112[l_index_4] < 2) gia_1112[l_index_4] = 2;
      if (gia_1112[l_index_4] > 10) gia_1112[l_index_4] = 10;
   }
   ArrayResize(gia_1116, gi_964);
   myGetSettingsFromString(lsa_0, gs_588);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1116[l_index_4] = gi_584;
      else gia_1116[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1116[l_index_4] < 1) gia_1116[l_index_4] = 1;
      if (gia_1116[l_index_4] > 5) gia_1116[l_index_4] = 5;
   }
   ArrayResize(gia_1120, gi_964);
   myGetSettingsFromString(lsa_0, gs_600);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1120[l_index_4] = gi_596;
      else gia_1120[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1124, gi_964);
   myGetSettingsFromString(lsa_0, gs_612);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1124[l_index_4] = gi_608;
      else gia_1124[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1128, gi_964);
   myGetSettingsFromString(lsa_0, gs_628);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1128[l_index_4] = gd_620;
      else gda_1128[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1132, gi_964);
   myGetSettingsFromString(lsa_0, gs_640);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1132[l_index_4] = gi_636;
      else gda_1132[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1136, gi_964);
   myGetSettingsFromString(lsa_0, gs_652);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1136[l_index_4] = gi_648;
      else gda_1136[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gda_1136[l_index_4] != 0.0) gda_1136[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gda_1136[l_index_4]);
   }
   ArrayResize(gia_1140, gi_964);
   myGetSettingsFromString(lsa_0, sCountHighLowLimits);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1140[l_index_4] = dCountHighLowLimits;
      else gia_1140[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1140[l_index_4] > 2) gia_1140[l_index_4] = 2;
   }
   ArrayResize(gda_1144, gi_964);
   myGetSettingsFromString(lsa_0, siHL_LimitDistance1_PR);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1144[l_index_4] = diHL_LimitDistance1_PR;
      else gda_1144[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1148, gi_964);
   myGetSettingsFromString(lsa_0, siHL_Period1);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1148[l_index_4] = diHL_Period1;
      else gia_1148[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1152, gi_964);
   myGetSettingsFromString(lsa_0, siHL_CountBars1);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1152[l_index_4] = diHL_CountBars1;
      else gia_1152[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1156, gi_964);
   myGetSettingsFromString(lsa_0, siHL_LimitDistance2_PR);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1156[l_index_4] = diHL_LimitDistance2_PR;
      else gda_1156[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1160, gi_964);
   myGetSettingsFromString(lsa_0, siHL_Period2);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1160[l_index_4] = diHL_Period2;
      else gia_1160[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1164, gi_964);
   myGetSettingsFromString(lsa_0, siHL_CountBars2);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1164[l_index_4] = diHL_CountBars2;
      else gia_1164[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1168, gi_964);
   myGetSettingsFromString(lsa_0, sUseFlatIndicator);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1168[l_index_4] = dUseFlatIndicator;
      else gia_1168[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1172, gi_964);
   myGetSettingsFromString(lsa_0, gs_768);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1172[l_index_4] = gi_764;
      else gia_1172[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1176, gi_964);
   myGetSettingsFromString(lsa_0, gs_780);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1176[l_index_4] = gi_776;
      else gia_1176[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1180, gi_964);
   myGetSettingsFromString(lsa_0, siFL_MinExtremumsCount);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1180[l_index_4] = diFL_MinExtremumsCount;
      else gia_1180[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1184, gi_964);
   myGetSettingsFromString(lsa_0, siFL_Period);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1184[l_index_4] = diFL_Period;
      else gia_1184[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1188, gi_964);
   myGetSettingsFromString(lsa_0, siFL_CountBars);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1188[l_index_4] = diFL_CountBars;
      else gia_1188[l_index_4] = StrToInteger(lsa_0[l_index_4]);
   }
   ArrayResize(gia_1192, gi_964);
   myGetSettingsFromString(lsa_0, siFL_StopLoss);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gia_1192[l_index_4] = diFL_StopLoss;
      else gia_1192[l_index_4] = StrToInteger(lsa_0[l_index_4]);
      if (gia_1192[l_index_4] != 0) gia_1192[l_index_4] = MathMax(MarketInfo(gsa_968[l_index_4], MODE_STOPLEVEL), gia_1192[l_index_4]);
   }
   ArrayResize(gda_1196, gi_964);
   myGetSettingsFromString(lsa_0, gs_844);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1196[l_index_4] = gd_836;
      else gda_1196[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1008, gi_964);
   myGetSettingsFromString(lsa_0, sRisk);
   for (l_index_4 = 0; l_index_4 < gi_964; l_index_4++) {
      if (lsa_0[l_index_4] == "") gda_1008[l_index_4] = dRisk;
      else gda_1008[l_index_4] = StrToDouble(lsa_0[l_index_4]);
   }
   ArrayResize(gda_1200, gi_964);
   myGetSettingsFromString(lsa_0, sMi        

Recommend