#property  copyright "Elevated, Version 3.03 (007), Copyright © 2006, Artem Shvets, http://dollaromania.com"
#property  link "http://dollaromania.com"

string   var_76 = "James Bond";
int      var_84 = 99999;
string   var_88 = "007";
bool     var_96 = true;
int      var_100 = 88888;
string   var_104 = "";
string   var_112 = "";
string   var_120 = "|*Copyright © 2006, http://dollaromania.com*|";
extern   int      BlockId = 1;
extern   int      TakeProfit = 15;
extern   int      Step = 17;
extern   int      MoneyManagment = 29;
extern   double   Lots = 0.1;
extern   double   PricePlus = 0.0014;
extern   string   Manual = "off";
extern   bool     OpenBlock = true;
extern   bool     ModifyBlock = false;
extern   bool     FixLot = false;
extern   bool     MicroLot = false;
extern   bool     MaxiLot = false;
extern   int      Insure = 4;
extern   int      BlockOrders = 4;
extern   int      StopLoss = 0;
double   var_200 = 20;
int      var_208 = 0;
int      var_212 = 0;
int      var_216 = 0;
int      var_220 = 0;
int      var_224 = 0;
int      var_228 = 0;
int      var_232 = 0;
int      var_236 = 0;
int      var_240 = 0;
int      var_244;
int      var_248 = 0;
double   var_252 = 0;
double   var_260 = 0;
double   var_268 = 0;
double   var_276 = 0;
double   var_284 = 0;
double   var_292 = 0;
double   var_300 = 0;
double   var_308 = 0;
double   var_316 = 0;
double   var_324 = 0;
int      var_332 = 0;
string   var_336 = "Elevated 3.0";
int      var_344 = 1;
int      var_348 = 0;
double   var_352 = 0;
string   var_360 = "";
int      var_368 = 0;
int      var_372 = 0;
int      var_376 = 0;
double   var_380 = 10;
double   var_388 = 10;
double   var_396 = 10;
double   var_404 = 9.715;
int      var_412 = 0;
int      var_416 = 12;
int      var_420 = 0;
int      var_424 = 0;
int      i = 0;
int      var_432 = 5;
double   var_436 = 0;
double   var_444 = 0;
double   var_452 = 0;
double   var_460 = 0;
double   var_468 = 0;
double   var_476 = 0;
int      var_484 = 0;
int      var_488 = 0;
bool     var_492 = true;
double   var_496 = 0;
int      var_504 = 0;
double   var_508 = 0;
int      var_516 = 0;
int      var_520 = 0;
double   var_524 = 0;
double   var_532 = 0;
double   var_540 = 0;

//+------------------------------------------------------------------+

int init()
{
return(0);
}

//+------------------------------------------------------------------+

int deinit()
{
return(0);
}

//+------------------------------------------------------------------+

int start()
{
HideTestIndicators(true);
var_372 = CurTime();
var_368 = NormalizeDouble(var_372 / 60 / 60 / 24,0);

//if (IsDemo() == true)
//   {
//   Comment("It is DEMO version of Elevated System!");
//   }
//      else
//   {
//   if (var_96 && (AccountNumber() != var_84))
//      {
//      Comment("On account " + AccountNumber() + " the trade is NOT ACCEPT! Please, send your personal code and name on my e-mail - admin@dollaromania.com, sindrom_717@kahovka.net");
//      return;
//      }
//         else
//      {
//      Comment("Account Ok");
//      }
//   }

//if (AccountName() != var_76)
//   {
//   Comment("For user " + AccountName() + " the trade is NOT ACCEPT! Please, send your personal code and name on my e-mail - admin@dollaromania.com, sindrom_717@kahovka.net");
//   return;
//   }
//      else
//   {
//   Comment("The user of system - " + AccountName());
//   }

if (Insure > 0) BlockOrders = Insure;
if (Insure == 0) {}
if (OpenBlock == true) var_360 = "on";
if (OpenBlock == false) var_360 = "off";

if (MicroLot)
   {
   if ((MoneyManagment < 26) && (Lots == 0.01))
      {
      Alert("If Lots=0.01 your MoneyManagment must be 26-80! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
      return(0);
      }
   }
      else
   {
   if (MaxiLot)
      {
      if ((MoneyManagment < 26) && (Lots == 1))
         {
         Alert("If Lots=1 your MoneyManagment must be 26-80! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
         return(0);
         }
      }
         else
      {
      if ((MoneyManagment < 26) && (Lots == 0.1))
         {
         Alert("If Lots=0.1 your MoneyManagment must be 26-80! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
         return(0);
         }
      }
   }

if (MicroLot) var_348 = 2; else
if (MaxiLot) var_348 = 0; else var_348 = 1;

if ((MoneyManagment == 1) || (MoneyManagment == 2) || (MoneyManagment == 3) || (MoneyManagment == 4) || (MoneyManagment == 5)) var_352 = 1.25;
if ((MoneyManagment == 6) || (MoneyManagment == 7) || (MoneyManagment == 8) || (MoneyManagment == 9) || (MoneyManagment == 10)) var_352 = 1.3;
if ((MoneyManagment == 11) || (MoneyManagment == 12) || (MoneyManagment == 13) || (MoneyManagment == 14) || (MoneyManagment == 15)) var_352 = 1.35;
if ((MoneyManagment == 16) || (MoneyManagment == 17) || (MoneyManagment == 18) || (MoneyManagment == 19) || (MoneyManagment == 20)) var_352 = 1.4;
if ((MoneyManagment == 21) || (MoneyManagment == 22) || (MoneyManagment == 23) || (MoneyManagment == 24) || (MoneyManagment == 25)) var_352 = 1.45;
if ((MoneyManagment == 26) || (MoneyManagment == 27) || (MoneyManagment == 28) || (MoneyManagment == 29) || (MoneyManagment == 30)) var_352 = 1.5;
if ((MoneyManagment == 31) || (MoneyManagment == 32) || (MoneyManagment == 33) || (MoneyManagment == 34) || (MoneyManagment == 35)) var_352 = 1.55;
if ((MoneyManagment == 36) || (MoneyManagment == 37) || (MoneyManagment == 38) || (MoneyManagment == 39) || (MoneyManagment == 40)) var_352 = 1.6;
if ((MoneyManagment == 41) || (MoneyManagment == 42) || (MoneyManagment == 43) || (MoneyManagment == 44) || (MoneyManagment == 45)) var_352 = 1.65;
if ((MoneyManagment == 46) || (MoneyManagment == 47) || (MoneyManagment == 48) || (MoneyManagment == 49) || (MoneyManagment == 50)) var_352 = 1.7;
if ((MoneyManagment == 51) || (MoneyManagment == 52) || (MoneyManagment == 53) || (MoneyManagment == 54) || (MoneyManagment == 55)) var_352 = 1.75;
if ((MoneyManagment == 56) || (MoneyManagment == 57) || (MoneyManagment == 58) || (MoneyManagment == 59) || (MoneyManagment == 60)) var_352 = 1.8;
if ((MoneyManagment == 61) || (MoneyManagment == 62) || (MoneyManagment == 63) || (MoneyManagment == 64) || (MoneyManagment == 65)) var_352 = 1.85;
if ((MoneyManagment == 66) || (MoneyManagment == 67) || (MoneyManagment == 68) || (MoneyManagment == 69) || (MoneyManagment == 70)) var_352 = 1.9;
if ((MoneyManagment == 71) || (MoneyManagment == 72) || (MoneyManagment == 73) || (MoneyManagment == 74) || (MoneyManagment == 75)) var_352 = 1.95;
if ((MoneyManagment == 76) || (MoneyManagment == 77) || (MoneyManagment == 78) || (MoneyManagment == 79) || (MoneyManagment == 80)) var_352 = 2;
if ((MoneyManagment == 1) || (MoneyManagment == 6) || (MoneyManagment == 11) || (MoneyManagment == 16) || (MoneyManagment == 21) || (MoneyManagment == 26) || (MoneyManagment == 31) || (MoneyManagment == 36) || (MoneyManagment == 41) || (MoneyManagment == 46) || (MoneyManagment == 51) || (MoneyManagment == 56) || (MoneyManagment == 61) || (MoneyManagment == 66) || (MoneyManagment == 71) || (MoneyManagment == 76)) var_344 = 1;
if ((MoneyManagment == 2) || (MoneyManagment == 7) || (MoneyManagment == 12) || (MoneyManagment == 17) || (MoneyManagment == 22) || (MoneyManagment == 27) || (MoneyManagment == 32) || (MoneyManagment == 37) || (MoneyManagment == 42) || (MoneyManagment == 47) || (MoneyManagment == 52) || (MoneyManagment == 57) || (MoneyManagment == 62) || (MoneyManagment == 67) || (MoneyManagment == 72) || (MoneyManagment == 77)) var_344 = 2;
if ((MoneyManagment == 3) || (MoneyManagment == 8) || (MoneyManagment == 13) || (MoneyManagment == 18) || (MoneyManagment == 23) || (MoneyManagment == 28) || (MoneyManagment == 33) || (MoneyManagment == 38) || (MoneyManagment == 43) || (MoneyManagment == 48) || (MoneyManagment == 53) || (MoneyManagment == 58) || (MoneyManagment == 63) || (MoneyManagment == 68) || (MoneyManagment == 73) || (MoneyManagment == 78)) var_344 = 3;
if ((MoneyManagment == 4) || (MoneyManagment == 9) || (MoneyManagment == 14) || (MoneyManagment == 19) || (MoneyManagment == 24) || (MoneyManagment == 29) || (MoneyManagment == 34) || (MoneyManagment == 39) || (MoneyManagment == 44) || (MoneyManagment == 49) || (MoneyManagment == 54) || (MoneyManagment == 59) || (MoneyManagment == 64) || (MoneyManagment == 69) || (MoneyManagment == 74) || (MoneyManagment == 79)) var_344 = 4;
if ((MoneyManagment == 5) || (MoneyManagment == 10) || (MoneyManagment == 15) || (MoneyManagment == 20) || (MoneyManagment == 25) || (MoneyManagment == 30) || (MoneyManagment == 35) || (MoneyManagment == 40) || (MoneyManagment == 45) || (MoneyManagment == 50) || (MoneyManagment == 55) || (MoneyManagment == 60) || (MoneyManagment == 65) || (MoneyManagment == 70) || (MoneyManagment == 75) || (MoneyManagment == 80)) var_344 = 5;

if (var_420 == 1)
   {
   if (var_412 != 0)
      var_468 = MathCeil(AccountBalance() * var_416 / 10000);
         else
      var_468 = Lots;
   }
      else
   {
   if (var_412 != 0)
      var_468 = MathCeil(AccountBalance() * var_416 / 10000) / 10;
         else
      var_468 = Lots;
   }
if (var_468 > 100.0) var_468 = 100;
var_424 = 0;

for (i = 0; i < OrdersTotal(); i++)
   {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId)) var_424++;
   }

if (var_424 < 1)
   {
   if (IsTesting())
      {
      if ((TimeYear(CurTime()) <= 2005) && (TimeMonth(CurTime()) <= 6))
         {
         Alert("ELEVATED do not testing this period! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
         return(0);
         }
      if (var_368 >= var_100)
         {
         Alert("Please, update Elevated System (mail to me)! Your ID - ",var_88,"! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
         return(0);
         }
      }
         else
      {
      if (var_368 >= var_100)
         {
         Alert("Please, update Elevated System (mail to me)! Your ID - ",var_88,"! Copyright Artem Shvets, http://dollaromania.com, admin@dollaromania.com, sindrom_717@kahovka.net");
         return(0);
         }
      }
   }

if (Symbol() == "EURUSD") var_540 = var_380;
if (Symbol() == "GBPUSD") var_540 = var_388;
if (Symbol() == "USDJPY") var_540 = var_404;
if (Symbol() == "USDCHF") var_540 = var_396;
if (var_540 == 0.0) var_540 = 5;

if (var_504 > var_424)
   {
   for (i = OrdersTotal(); i >= 0; i--)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      var_484 = OrderType();
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
         {
         if (var_484 == 0) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),var_432,DodgerBlue);
         if (var_484 == 1) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),var_432,OrangeRed);
         return(0);
         }
      }
   }

var_504 = var_424;
if (var_424 >= BlockOrders) var_492 = false; else var_492 = true;
if (var_496 == 0.0)
   {
   for (i = 0; i < OrdersTotal(); i++)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      var_484 = OrderType();
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
         {
         var_496 = OrderOpenPrice();
         if (var_484 == 0) var_488 = 2;
         if (var_484 == 1) var_488 = 1;
         }
      }
   }

if (var_424 < 1)
   {
   if (OpenBlock)
      {
      var_488 = 3;
      if (Manual == "off")
         {
         var_376 = 1;
         if (var_344 == 5)
            {
            if (iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0) > iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) var_488 = 2;
            if (iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0) < iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) var_488 = 1;
            }
         if (var_344 == 4)
            {
            if (iCCI(Symbol(),0,12,PRICE_MEDIAN,0) > iCCI(Symbol(),0,20,PRICE_OPEN,0)) var_488 = 2;
            if (iCCI(Symbol(),0,12,PRICE_MEDIAN,0) < iCCI(Symbol(),0,20,PRICE_OPEN,0)) var_488 = 1;
            }
         if (var_344 == 3)
            {
            if (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) < Low[0]) var_488 = 2;
            if (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) > Low[0]) var_488 = 1;
            }
         if (var_344 == 2)
            {
            if ((iAD(0,0,0) > iAD(0,0,1)) && (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) < Low[0])) var_488 = 2;
            if ((iAD(0,0,0) < iAD(0,0,1)) && (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) > Low[0])) var_488 = 1;
            }
         if (var_344 == 1)
            {
            if ((iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0) > iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) && (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) < Low[0])) var_488 = 2;
            if ((iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0) < iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) && (iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0) > Low[0])) var_488 = 1;
            }
         }
            else
         {
         if (Manual == "sell")
            {
            var_488 = 1;
            var_376 = 2;
            }
         if (Manual == "buy")
            {
            var_488 = 2;
            var_376 = 3;
            }
         }
      }
         else
      {
      return(0);
      }
   }

for (i = OrdersTotal(); i >= 0; i--)
   {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
      {
      if (OrderType() == OP_SELL)
         {
         if (var_200 > 0.0)
            {
            if (OrderOpenPrice() - Ask >= (var_200 + Step) * Point)
               {
               if (OrderStopLoss() > Ask + Point * var_200)
                  {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Ask + Point * var_200,OrderClosePrice() - TakeProfit * Point - var_200 * Point,800,Purple);
                  return(0);
                  }
               }
            }
         }
      if (OrderType() == OP_BUY)
         {
         if (var_200 > 0.0)
            {
            if (Bid - OrderOpenPrice() >= (var_200 + Step) * Point)
               {
               if (OrderStopLoss() < Bid - Point * var_200)
                  {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Bid - Point * var_200,OrderClosePrice() + TakeProfit * Point + var_200 * Point,800,Yellow);
                  return(0);
                  }
               }
            }
         }
      }
   }

var_508 = 0;
var_516 = 0;
var_520 = 0;
var_524 = 0;
var_532 = 0;

for (i = 0; i < OrdersTotal(); i++)
   {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
      {
      var_516 = OrderTicket();
      if (OrderType() == OP_BUY) var_520 = 0;
      if (OrderType() == OP_SELL) var_520 = 1;
      var_524 = OrderClosePrice();
      var_532 = OrderLots();
      if (var_520 == 0)
         {
         if (OrderClosePrice() < OrderOpenPrice()) var_508 -= (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point;
         if (OrderClosePrice() > OrderOpenPrice()) var_508 += (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point;
         }
      if (var_520 == 1)
         {
         if (OrderClosePrice() > OrderOpenPrice()) var_508 -= (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point;
         if (OrderClosePrice() < OrderOpenPrice()) var_508 += (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point;
         }
      }
   }

var_508 = var_508 * var_540;
var_112 = "Profit: " + DoubleToStr(var_508,2);
if (!IsTesting())
   {
   if (var_488 == 3) var_104 = "New block"; else var_104 = "Process...";
   Comment(var_120,"\n","| Manual: ",Manual," | Orders ID: ",BlockId," | Open: ",var_360," |","\n","| Lots: ",Lots," | TakeProfit: ",TakeProfit," | Step: ",Step," |","\n","| MMR: ",MoneyManagment," | ",var_112,"$ |");
   }

if ((var_488 == 1) && var_492)
   {
   if (Insure == var_424 + 1)
      {
      if ((Bid - var_496 >= Step * Point) || (var_424 < 1))
         {
         var_452 = Ask;
         var_496 = 0;
         if (TakeProfit == 0) var_444 = 0; else var_444 = var_452 + TakeProfit * Point;
         if (StopLoss == 0) var_436 = 0; else var_436 = var_452 - StopLoss * Point;
         if (var_424 != 0)
            {
            var_476 = var_468;
            for (i = 1; i <= var_424; i++)
               {
               if (FixLot)
                  {
                  var_476 = Lots;
                  continue;
                  }
               var_476 = NormalizeDouble(var_476 * var_352,var_348);
               }
            }
               else
            {
            var_476 = var_468;
            }
         if (var_476 > 100.0) var_476 = 100;
         OrderSend(Symbol(),OP_BUY,var_476,var_452,var_432,var_436,var_444 + PricePlus,var_336 + " (" + MoneyManagment + Insure + var_376 + ")",BlockId,0,CornflowerBlue);
         return(0);
         }
      }
   if (Insure != var_424 + 1)
      {
      if ((Bid - var_496 >= Step * Point) || (var_424 < 1))
         {
         var_460 = Bid;
         var_496 = 0;
         if (TakeProfit == 0) var_444 = 0; else var_444 = var_460 - TakeProfit * Point;
         if (StopLoss == 0) var_436 = 0; else var_436 = var_460 + StopLoss * Point;
         if (var_424 != 0)
            {
            var_476 = var_468;
            for (i = 1; i <= var_424; i++)
               {
               if (FixLot)
                  {
                  var_476 = Lots;
                  continue;
                  }
               var_476 = NormalizeDouble(var_476 * var_352,var_348);
               }
            }
               else
            {
            var_476 = var_468;
            }
         if (var_476 > 100.0) var_476 = 100;
         OrderSend(Symbol(),OP_SELL,var_476,var_460,var_432,var_436,var_444,var_336 + " (" + MoneyManagment + Insure + var_376 + ")",BlockId,0,OrangeRed);
         return(0);
         }
      }
   }

if ((var_488 == 2) && var_492)
   {
   if (Insure == var_424 + 1)
      {
      if ((var_496 - Ask >= Step * Point) || (var_424 < 1))
         {
         var_460 = Bid;
         var_496 = 0;
         if (TakeProfit == 0) var_444 = 0; else var_444 = var_460 - TakeProfit * Point;
         if (StopLoss == 0) var_436 = 0; else var_436 = var_460 + StopLoss * Point;
         if (var_424 != 0)
            {
            var_476 = var_468;
            for (i = 1; i <= var_424; i++)
               {
               if (FixLot)
                  {
                  var_476 = Lots;
                  continue;
                  }
               var_476 = NormalizeDouble(var_476 * var_352,var_348);
               }
            }
               else
            {
            var_476 = var_468;
            }
         if (var_476 > 100.0) var_476 = 100;
         if (Insure == var_424 + 1) OrderSend(Symbol(),OP_SELL,var_476,var_460,var_432,var_436,var_444 - PricePlus,var_336 + " (" + MoneyManagment + Insure + var_376 + ")",BlockId,0,Pink);
         return(0);
         }
      }
   if (Insure != var_424 + 1)
      {
      if ((var_496 - Ask >= Step * Point) || (var_424 < 1))
         {
         var_452 = Ask;
         var_496 = 0;
         if (TakeProfit == 0) var_444 = 0; else var_444 = var_452 + TakeProfit * Point;
         if (StopLoss == 0) var_436 = 0; else var_436 = var_452 - StopLoss * Point;
         if (var_424 != 0)
            {
            var_476 = var_468;
            for (i = 1; i <= var_424; i++)
               {
               if (FixLot)
                  {
                  var_476 = Lots;
                  continue;
                  }
               var_476 = NormalizeDouble(var_476 * var_352,var_348);
               }
            }
               else
            {
            var_476 = var_468;
            }
         if (var_476 > 100.0) var_476 = 100;
         OrderSend(Symbol(),OP_BUY,var_476,var_452,var_432,var_436,var_444,var_336 + " (" + MoneyManagment + Insure + var_376 + ")",BlockId,0,DodgerBlue);
         return(0);
         }
      }
   }

if (ModifyBlock)
   {
   var_208 = 0;
   for (i = 0; i < OrdersTotal(); i++)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId)) var_208++;
      }
   if (var_208 == 2)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               var_216 = var_332;
               var_260 = OrderTakeProfit();
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_260)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_260,0,GreenYellow);
         }
      }
   if (var_208 == 3)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  var_220 = var_332;
                  var_268 = OrderTakeProfit();
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_268)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_268,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_268,0,GreenYellow);
         }
      }
   if (var_208 == 4)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     var_224 = var_332;
                     var_276 = OrderTakeProfit();
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_276)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_276,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_276,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_276,0,GreenYellow);
         }
      }
   if (var_208 == 5)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        var_228 = var_332;
                        var_284 = OrderTakeProfit();
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_284)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_284,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_284,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_284,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_284,0,GreenYellow);
         }
      }
   if (var_208 == 6)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        if (var_228 > 0)
                           {
                           var_232 = var_332;
                           var_292 = OrderTakeProfit();
                           }
                              else
                           {
                           var_228 = var_332;
                           var_284 = OrderTakeProfit();
                           }
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_292)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_228 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_292,0,GreenYellow);
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_292,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_292,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_292,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_292,0,GreenYellow);
         }
      }
   if (var_208 == 7)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        if (var_228 > 0)
                           {
                           if (var_232 > 0)
                              {
                              var_236 = var_332;
                              var_300 = OrderTakeProfit();
                              }
                                 else
                              {
                              var_232 = var_332;
                              var_292 = OrderTakeProfit();
                              }
                           }
                              else
                           {
                           var_228 = var_332;
                           var_284 = OrderTakeProfit();
                           }
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_300)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_232 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         OrderSelect(var_228 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_300,0,GreenYellow);
         }
      }
   if (var_208 == 8)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        if (var_228 > 0)
                           {
                           if (var_232 > 0)
                              {
                              if (var_236 > 0)
                                 {
                                 var_240 = var_332;
                                 var_308 = OrderTakeProfit();
                                 }
                                    else
                                 {
                                 var_236 = var_332;
                                 var_300 = OrderTakeProfit();
                                 }
                              }
                                 else
                              {
                              var_232 = var_332;
                              var_292 = OrderTakeProfit();
                              }
                           }
                              else
                           {
                           var_228 = var_332;
                           var_284 = OrderTakeProfit();
                           }
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_308)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_236 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_232 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_228 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_308,0,GreenYellow);
         }
      }
   if (var_208 == 9)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        if (var_228 > 0)
                           {
                           if (var_232 > 0)
                              {
                              if (var_236 > 0)
                                 {
                                 if (var_240 > 0)
                                    {
                                    var_244 = var_332;
                                    var_316 = OrderTakeProfit();
                                    }
                                       else
                                    {
                                    var_240 = var_332;
                                    var_308 = OrderTakeProfit();
                                    }
                                 }
                                    else
                                 {
                                 var_236 = var_332;
                                 var_300 = OrderTakeProfit();
                                 }
                              }
                                 else
                              {
                              var_232 = var_332;
                              var_292 = OrderTakeProfit();
                              }
                           }
                              else
                           {
                           var_228 = var_332;
                           var_284 = OrderTakeProfit();
                           }
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_308)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_240 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_236 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_232 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_228 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_316,0,GreenYellow);
         }
      }
   if (var_208 == 10)
      {
      var_332 = 0;
      for (i = 0; i < OrdersTotal(); i++)
         {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == BlockId))
            {
            var_332 = i + 1;
            if (var_212 > 0)
               {
               if (var_216 > 0)
                  {
                  if (var_220 > 0)
                     {
                     if (var_224 > 0)
                        {
                        if (var_228 > 0)
                           {
                           if (var_232 > 0)
                              {
                              if (var_236 > 0)
                                 {
                                 if (var_240 > 0)
                                    {
                                    if (var_244 > 0)
                                       {
                                       var_248 = var_332;
                                       var_324 = OrderTakeProfit();
                                       }
                                          else
                                       {
                                       var_244 = var_332;
                                       var_316 = OrderTakeProfit();
                                       }
                                    }
                                       else
                                    {
                                    var_240 = var_332;
                                    var_308 = OrderTakeProfit();
                                    }
                                 }
                                    else
                                 {
                                 var_236 = var_332;
                                 var_300 = OrderTakeProfit();
                                 }
                              }
                                 else
                              {
                              var_232 = var_332;
                              var_292 = OrderTakeProfit();
                              }
                           }
                              else
                           {
                           var_228 = var_332;
                           var_284 = OrderTakeProfit();
                           }
                        }
                           else
                        {
                        var_224 = var_332;
                        var_276 = OrderTakeProfit();
                        }
                     }
                        else
                     {
                     var_220 = var_332;
                     var_268 = OrderTakeProfit();
                     }
                  }
                     else
                  {
                  var_216 = var_332;
                  var_260 = OrderTakeProfit();
                  }
               }
                  else
               {
               var_212 = var_332;
               var_252 = OrderTakeProfit();
               }
            }
         }
      if (var_252 == var_308)
         {
         return(0);
         }
            else
         {
         OrderSelect(var_244 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_240 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_236 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_232 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_228 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_224 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_220 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_216 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         OrderSelect(var_212 - 1,SELECT_BY_POS);
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),var_324,0,GreenYellow);
         }
      }
   }
}