Home » » Script Data Base

Script Data Base

Scrip Coding EA Masyuk V.3


#property copyright "Forex Invest Group & Yuriy Tokman"
#property link      "info@forexinvest.ee , yuriytokman@gmail.com"

//#include <stdlib.mqh>

extern string ____0___ = "Accountnummer";
extern int Magicmungkin = 19017;
extern string ____1___ = "Íàñòðîéêè îðäåðîâ";
extern int Displacement = 0;
extern int steps = 20;
extern bool Line = FALSE;
extern int quantity = 3;
extern string ____2___ = "Òîðãîâûå íàñòðîéêè";
extern double Lots = 0.1;
extern bool Choice_method = TRUE;
extern double Risk = 0.0;
extern int StopLoss = 0;
extern int TakeProfit = 18;
extern int MagicNumber = 28081975;
extern int Slippage = 30;
extern int NumberOfTry = 5;
extern bool MarketWatch = FALSE;
extern bool UseSound = TRUE;
extern string NameFileSound = "expert.wav";
extern color clOpenBuy = LightBlue;
extern color clOpenSell = LightCoral;
extern color clDelete = Honeydew;
extern color clCloseBuy = Aqua;
extern color clCloseSell = Tomato;
extern string NameCloseSound = "ok.wav";
extern string _____Òðàë_______ = "______Íàñòðîéêè òðàëà __________________";
extern bool Traling = TRUE;
extern bool TSProfitOnly = TRUE;
extern int TStop.Buy = 35;
extern int TStop.Sell = 40;
extern int TrailingStep = 2;
extern string _____Averag_____ = "______Íàñòðîéêè îðäåðîâ óñðåäíåíèÿ_____";
extern bool AVERAGES = TRUE;
extern int Averag = 25;
extern double koef_averag = 1.0;
extern int alfa_lot = 1;
extern double koef_lot = 2.0;
extern double StopLoss_Av = 0.0;
extern int TakeProfit_Av = 10;
extern string _____Lock_____ = "______Íàñòðîéêè îðäåðîâ Locka_____";
extern bool Lock = TRUE;
extern int lock_pips = 10;
extern double koef_lot_lock = 2.0;
extern int MN_Lock = 333;
extern int StopLoss_Lock = 0;
string hekle = "";
bool popopo1 = FALSE;
bool popopo2 = FALSE;
extern bool ShowComment = FALSE;
double mamama1 = 0.0000001;
int mamama2 = 0;

int init() {
   string hghgh1[256];
   string hghgh2[256];
   popopo2 = FALSE;
   if (!IsTradeAllowed()) {
      Message("Äëÿ íîðìàëüíîé ðàáîòû ñîâåòíèêà íåîáõîäèìî\n" + "Ðàçðåøèòü ñîâåòíèêó òîðãîâàòü");
      popopo2 = TRUE;
      return;
   }
   if (!IsLibrariesAllowed()) {
      Message("Äëÿ íîðìàëüíîé ðàáîòû ñîâåòíèêà íåîáõîäèìî\n" + "Ðàçðåøèòü èìïîðò èç âíåøíèõ ýêñïåðòîâ");
      popopo2 = TRUE;
      return;
   }
   if (!IsTesting()) {
      if (IsExpertEnabled()) Message("Ñîâåòíèê áóäåò çàïóùåí ñëåäóþùèì òèêîì");
      else Message("Îòæàòà êíîïêà \"Ðàçðåøèòü çàïóñê ñîâåòíèêîâ\"");
   }
   for (int l_index_8 = 0; l_index_8 < 256; l_index_8++) hghgh1[l_index_8] = CharToStr(l_index_8);
   hekle = hghgh1[210] + hghgh1[229] + hghgh1[245] + hghgh1[46] + hghgh1[32] + hghgh1[239] + hghgh1[238] + hghgh1[228] + hghgh1[228] + hghgh1[229] + hghgh1[240] + hghgh1[230] +
      hghgh1[234] + hghgh1[224] + hghgh1[58] + hghgh1[32] + hghgh1[121] + hghgh1[117] + hghgh1[114] + hghgh1[105] + hghgh1[121] + hghgh1[116] + hghgh1[111] + hghgh1[107] + hghgh1[109] +
      hghgh1[97] + hghgh1[110] + hghgh1[64] + hghgh1[103] + hghgh1[109] + hghgh1[97] + hghgh1[105] + hghgh1[108] + hghgh1[46] + hghgh1[99] + hghgh1[111] + hghgh1[109];
   Label("label", hekle, 2, 3, 15);
   for (l_index_8 = 0; l_index_8 < 256; l_index_8++) hghgh2[l_index_8] = CharToStr(l_index_8);
   string ls_12 = hghgh1[119] + hghgh1[119] + hghgh1[119] + hghgh1[46] + hghgh1[102] + hghgh1[111] + hghgh1[114] + hghgh1[101] + hghgh1[120] + hghgh1[105] + hghgh1[110] + hghgh1[118] +
      hghgh1[101] + hghgh1[115] + hghgh1[116] + hghgh1[46] + hghgh1[101] + hghgh1[101] + hghgh1[32] + hghgh1[32] + hghgh1[32] + hghgh1[32] + hghgh1[32] + hghgh1[208] + hghgh1[224] +
      hghgh1[231] + hghgh1[243] + hghgh1[236] + hghgh1[237] + hghgh1[251] + hghgh1[229] + hghgh1[32] + hghgh1[232] + hghgh1[237] + hghgh1[226] + hghgh1[229] + hghgh1[241] + hghgh1[242] +
      hghgh1[232] + hghgh1[246] + hghgh1[232] + hghgh1[232] + hghgh1[33];
   Label("label2", ls_12, 2, 3, 30);
   return (0);
}

int deinit() {
   if (!IsTesting()) Comment("");
   return (0);
}

int start() {
   string xaxaxa1;
   double xaxaxa2;
   double xaxaxa3;
   double xaxaxa4;
   double xaxaxa5;
   double xaxaxa6;
   double xaxaxa7;
   double xaxaxa8 = 0;
   if (Lots > 0.0) xaxaxa8 = Lots;
   else xaxaxa8 = GetLot();
   if (popopo1) {
      Message("Êðèòè÷åñêàÿ îøèáêà! Ñîâåòíèê ÎÑÒÀÍÎÂËÅÍ!");
      return;
   }
   if (popopo2) {
      Message("Íå óäàëîñü èíèöèàëèçèðîâàòü ñîâåòíèê!");
      return;
   }
   if (!IsTesting() && !IsDemo()) {
      if (Magicmungkin > 0 && Magicmungkin != AccountNumber()) {
         Comment("Òîðãîâëÿ íà ñ÷¸òå: " + AccountNumber() + " ÇÀÏÐÅÙÅÍÀ!");
         return;
      }
      Comment("");
   }
   if (ShowComment) {
      xaxaxa1 = "CurTime=" + TimeToStr(TimeCurrent(), TIME_MINUTES) + "  Êîë.îðäåðîâ=" + DoubleToStr(quantity * 2, 0) + "  Ðàñòîÿí. ìåæäó îðäåðàìè=" + steps + "  TakeProfit=" + TakeProfit + "  StopLoss=" + StopLoss + "  Lots=" + DoubleToStr(xaxaxa8, 2) + "  Ñìåùåíèå=" + Displacement
         + "\n+------------------------------+"
         + "\n   Áàëàíñ=" + DoubleToStr(AccountBalance(), 2)
         + "\n   Ýêâèòè=" + DoubleToStr(AccountEquity(), 2)
         + "\n   Ïðèáûëü=" + DoubleToStr(AccountEquity() - AccountBalance(), 3) + " $"
         + "\n   Ïðèáûëü=" + DoubleToStr(100.0 * (AccountEquity() / AccountBalance() - 1.0), 3) + " %"
      + "\n+------------------------------+";
      Comment(xaxaxa1);
   } else Comment("");
   if (Traling && !ExistPositions(Symbol(), OP_BUY, MN_Lock)) SimpleTrailing(Symbol(), OP_BUY, MagicNumber);
   if (Traling && !ExistPositions(Symbol(), OP_SELL, MN_Lock)) SimpleTrailing(Symbol(), OP_SELL, MagicNumber);
   double ld_64 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point;
   int l_digits_72 = Digits;
   double ld_76 = 100;
   if (l_digits_72 == 3 || l_digits_72 >= 5) ld_76 = 1000;
   double xaxaxa24 = 1000.0 * xaxaxa8 * TakeProfit_Av / ld_76;
   double ld_92 = 0;
   double ld_100 = 0;
   double ld_unused_108 = 0;
   int li_116 = NumberOfPositions(Symbol(), OP_BUY, MN_Lock);
   int li_120 = NumberOfPositions(Symbol(), OP_SELL, MN_Lock);
   if (GetProfitOpenPosInCurrency(Symbol(), OP_BUY, MagicNumber) + GetProfitOpenPosInCurrency(Symbol(), OP_SELL, MN_Lock) > xaxaxa24 && ExistPositions(Symbol(), OP_SELL, MN_Lock)) {
      ClosePosFirstProfit(Symbol(), OP_BUY, MagicNumber);
      ClosePosFirstProfit(Symbol(), OP_SELL, MN_Lock);
   }
   if (GetProfitOpenPosInCurrency(Symbol(), OP_SELL, MagicNumber) + GetProfitOpenPosInCurrency(Symbol(), OP_BUY, MN_Lock) > xaxaxa24 && ExistPositions(Symbol(), OP_BUY, MN_Lock)) {
      ClosePosFirstProfit(Symbol(), OP_SELL, MagicNumber);
      ClosePosFirstProfit(Symbol(), OP_BUY, MN_Lock);
   }
   if (AVERAGES && NevBar()) {
      if (PriceOpenLastPos(Symbol(), OP_BUY, MN_Lock) - Ask > Averag * GetPoint() * li_116 * koef_averag && GetProfitOpenPosInCurrency(Symbol(), OP_BUY, MN_Lock) < 0.0) {
         ld_92 = NormalizeDouble(GetLotLastPos(0, OP_BUY, MN_Lock) * koef_lot, alfa_lot);
         if (StopLoss_Av > 0.0) ld_100 = Bid - StopLoss_Av * GetPoint();
         else ld_100 = 0;
         OpenPosition(Symbol(), OP_BUY, ld_92, ld_100, 0, MN_Lock);
      }
      if (Bid - PriceOpenLastPos(Symbol(), OP_SELL, MN_Lock) > Averag * GetPoint() * li_120 * koef_averag && GetProfitOpenPosInCurrency(Symbol(), OP_SELL, MN_Lock) < 0.0) {
         ld_92 = NormalizeDouble(GetLotLastPos(0, OP_SELL, MN_Lock) * koef_lot, alfa_lot);
         if (StopLoss_Av > 0.0) ld_100 = Ask + StopLoss_Av * GetPoint();
         else ld_100 = 0;
         OpenPosition(Symbol(), OP_SELL, ld_92, ld_100, 0, MN_Lock);
      }
   }
   if (Lock) {
      if (PriceOpenLastPos(Symbol(), OP_BUY, MagicNumber) - Ask > lock_pips * GetPoint() && !ExistPositions(Symbol(), OP_SELL, MN_Lock)) {
         xaxaxa2 = NormalizeDouble(GetLotLastPos(0, OP_BUY, MagicNumber) * koef_lot_lock, alfa_lot);
         if (StopLoss_Lock > 0) xaxaxa3 = Ask + StopLoss_Lock * GetPoint();
         else xaxaxa3 = 0;
         OpenPosition(Symbol(), OP_SELL, xaxaxa2, xaxaxa3, 0, MN_Lock);
      }
      if (Bid - PriceOpenLastPos(Symbol(), OP_SELL, MagicNumber) > lock_pips * GetPoint() && !ExistPositions(Symbol(), OP_BUY, MN_Lock) && ExistPositions(Symbol(), OP_SELL, MagicNumber)) {
         xaxaxa2 = NormalizeDouble(GetLotLastPos(0, OP_SELL, MagicNumber) * koef_lot_lock, alfa_lot);
         if (StopLoss_Lock > 0) xaxaxa3 = Bid - StopLoss_Lock * GetPoint();
         else xaxaxa3 = 0;
         OpenPosition(Symbol(), OP_BUY, xaxaxa2, xaxaxa3, 0, MN_Lock);
      }
   }
   int l_count_124 = 0;
   double ld_128 = Displacement * GetPoint();
   double ld_136 = 0;
   while (ld_128 < Bid) {
      ld_128 += steps * GetPoint();
      l_count_124++;
   }
   ld_136 = ld_128 - steps * GetPoint();
   if (Line) {
      SetHLine(Lime, "r", ld_128);
      SetHLine(Red, "s", ld_136);
   }
   double ld_144 = 0;
   double ld_152 = 0;
   if (!ExistPositions(Symbol(), OP_BUY, MagicNumber) && ObjectFind("label") > -1) {
      for (int l_count_160 = 0; l_count_160 < quantity; l_count_160++) {
         xaxaxa4 = ld_128 + l_count_160 * steps * GetPoint();
         if (!ExistOrdersByPrice(Symbol(), OP_BUYSTOP, MagicNumber, xaxaxa4) && !ExistPosByPrice(Symbol(), OP_BUY, MagicNumber, xaxaxa4) && xaxaxa4 - Ask > ld_64) {
            if (StopLoss > 0) ld_144 = xaxaxa4 - StopLoss * GetPoint();
            else ld_144 = 0;
            if (TakeProfit > 0) ld_152 = xaxaxa4 + TakeProfit * GetPoint();
            else ld_152 = 0;
            SetOrder(Symbol(), OP_BUYSTOP, xaxaxa8, xaxaxa4, ld_144, ld_152, MagicNumber);
         }
      }
      for (int l_count_164 = 0; l_count_164 <= 10; l_count_164++) {
         xaxaxa5 = ld_128 + (l_count_164 + quantity) * steps * GetPoint();
         if (ExistOrdersByPrice(Symbol(), OP_BUYSTOP, MagicNumber, xaxaxa5)) CloseOrderBySelect();
      }
   }
   if (!ExistPositions(Symbol(), OP_SELL, MagicNumber) && ObjectFind("label") > -1) {
      for (int l_count_168 = 0; l_count_168 < quantity; l_count_168++) {
         xaxaxa6 = ld_136 - l_count_168 * steps * GetPoint();
         if (!ExistOrdersByPrice(Symbol(), OP_SELLSTOP, MagicNumber, xaxaxa6) && !ExistPosByPrice(Symbol(), OP_SELL, MagicNumber, xaxaxa6) && Bid - xaxaxa6 > ld_64) {
            if (StopLoss > 0) ld_144 = xaxaxa6 + StopLoss * GetPoint();
            else ld_144 = 0;
            if (TakeProfit > 0) ld_152 = xaxaxa6 - TakeProfit * GetPoint();
            else ld_152 = 0;
            SetOrder(Symbol(), OP_SELLSTOP, xaxaxa8, xaxaxa6, ld_144, ld_152, MagicNumber);
         }
      }
      for (int l_count_172 = 0; l_count_172 <= 10; l_count_172++) {
         xaxaxa7 = ld_136 - (l_count_172 + quantity) * steps * GetPoint();
         if (ExistOrdersByPrice(Symbol(), OP_SELLSTOP, MagicNumber, xaxaxa7)) CloseOrderBySelect();
      }
   }
   return (0);
}

void SetHLine(color a_color_0, string a_dbl2str_4 = "", double a_bid_12 = 0.0, int a_style_20 = 0, int a_width_24 = 1) {
   if (a_dbl2str_4 == "") a_dbl2str_4 = DoubleToStr(Time[0], 0);
   if (a_bid_12 <= 0.0) a_bid_12 = Bid;
   if (ObjectFind(a_dbl2str_4) < 0) ObjectCreate(a_dbl2str_4, OBJ_HLINE, 0, 0, 0);
   ObjectSet(a_dbl2str_4, OBJPROP_PRICE1, a_bid_12);
   ObjectSet(a_dbl2str_4, OBJPROP_COLOR, a_color_0);
   ObjectSet(a_dbl2str_4, OBJPROP_STYLE, a_style_20);
   ObjectSet(a_dbl2str_4, OBJPROP_WIDTH, a_width_24);
}

bool ExistOrdersByPrice(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, double ad_16 = -1.0) {
   int l_digits_24;
   int l_ord_total_28 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_32 = 0; l_pos_32 < l_ord_total_28; l_pos_32++) {
      if (OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderType() > OP_SELL && OrderType() < 6) {
               l_digits_24 = MarketInfo(OrderSymbol(), MODE_DIGITS);
               ad_16 = NormalizeDouble(ad_16, l_digits_24);
               if (MathAbs(ad_16 - OrderOpenPrice()) < mamama1)
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) return (TRUE);
            }
         }
      }
   }
   return (FALSE);
}

bool ExistPosByPrice(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, double ad_16 = 0.0) {
   double xaxaxa4;
   double xaxaxa5;
   int l_digits_40;
   int l_ord_total_44 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_48 = 0; l_pos_48 < l_ord_total_44; l_pos_48++) {
      if (OrderSelect(l_pos_48, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) {
                  l_digits_40 = MarketInfo(OrderSymbol(), MODE_DIGITS);
                  xaxaxa4 = NormalizeDouble(ad_16, l_digits_40);
                  xaxaxa5 = NormalizeDouble(OrderOpenPrice(), l_digits_40);
                  if (ad_16 <= 0.0 || xaxaxa4 == xaxaxa5) return (TRUE);
               }
            }
         }
      }
   }
   return (FALSE);
}

void SetOrder(string a_symbol_0, int a_cmd_8, double a_lots_12, double a_price_20, double a_price_28 = 0.0, double a_price_36 = 0.0, int a_magic_44 = 0, int a_datetime_48 = 0) {
   color l_color_52;
   int l_datetime_56;
   double l_ask_60;
   double l_bid_68;
   double ld_76;
   int l_error_84;
   int l_ticket_88;
   string l_comment_92 = hekle + " " + WindowExpertName() + " " + GetNameTF(Period());
   if (a_symbol_0 == "" || a_symbol_0 == "0") a_symbol_0 = Symbol();
   int l_stoplevel_100 = MarketInfo(a_symbol_0, MODE_STOPLEVEL);
   if (a_cmd_8 == OP_BUYLIMIT || a_cmd_8 == OP_BUYSTOP) l_color_52 = clOpenBuy;
   else l_color_52 = clOpenSell;
   if (a_datetime_48 > 0 && a_datetime_48 < TimeCurrent()) a_datetime_48 = 0;
   for (int li_104 = 1; li_104 <= NumberOfTry; li_104++) {
      if (!IsTesting() && !IsExpertEnabled() || IsStopped()) {
         Print("SetOrder(): Îñòàíîâêà ðàáîòû ôóíêöèè");
         return;
      }
      while (!IsTradeAllowed()) Sleep(5000);
      RefreshRates();
      l_datetime_56 = TimeCurrent();
      l_ticket_88 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, Slippage, a_price_28, a_price_36, l_comment_92, a_magic_44, a_datetime_48, l_color_52);
      if (l_ticket_88 > 0) {
         if (!(UseSound)) break;
         PlaySound(NameFileSound);
         return;
      }
      l_error_84 = GetLastError();
      if (l_error_84 == 128/* TRADE_TIMEOUT */ || l_error_84 == 142 || l_error_84 == 143) {
         Sleep(66000);
         if (ExistOrders(a_symbol_0, a_cmd_8, a_magic_44, l_datetime_56)) {
            if (!(UseSound)) break;
            PlaySound(NameFileSound);
            return;
         }
         Print("Error(", l_error_84, ") set order: ", ErrorDescription(l_error_84), ", try ", li_104);
      } else {
         ld_76 = GetPoint();
         l_ask_60 = MarketInfo(a_symbol_0, MODE_ASK);
         l_bid_68 = MarketInfo(a_symbol_0, MODE_BID);
         if (l_error_84 == 130/* INVALID_STOPS */) {
            switch (a_cmd_8) {
            case OP_BUYLIMIT:
               if (a_price_20 > l_ask_60 - l_stoplevel_100 * ld_76) a_price_20 = l_ask_60 - l_stoplevel_100 * ld_76;
               if (a_price_28 > a_price_20 - (l_stoplevel_100 + 1) * ld_76) a_price_28 = a_price_20 - (l_stoplevel_100 + 1) * ld_76;
               if (a_price_36 > 0.0 && a_price_36 < a_price_20 + (l_stoplevel_100 + 1) * ld_76) a_price_36 = a_price_20 + (l_stoplevel_100 + 1) * ld_76;
               break;
            case OP_BUYSTOP:
               if (a_price_20 < l_ask_60 + (l_stoplevel_100 + 1) * ld_76) a_price_20 = l_ask_60 + (l_stoplevel_100 + 1) * ld_76;
               if (a_price_28 > a_price_20 - (l_stoplevel_100 + 1) * ld_76) a_price_28 = a_price_20 - (l_stoplevel_100 + 1) * ld_76;
               if (a_price_36 > 0.0 && a_price_36 < a_price_20 + (l_stoplevel_100 + 1) * ld_76) a_price_36 = a_price_20 + (l_stoplevel_100 + 1) * ld_76;
               break;
            case OP_SELLLIMIT:
               if (a_price_20 < l_bid_68 + l_stoplevel_100 * ld_76) a_price_20 = l_bid_68 + l_stoplevel_100 * ld_76;
               if (a_price_28 > 0.0 && a_price_28 < a_price_20 + (l_stoplevel_100 + 1) * ld_76) a_price_28 = a_price_20 + (l_stoplevel_100 + 1) * ld_76;
               if (a_price_36 > a_price_20 - (l_stoplevel_100 + 1) * ld_76) a_price_36 = a_price_20 - (l_stoplevel_100 + 1) * ld_76;
               break;
            case OP_SELLSTOP:
               if (a_price_20 > l_bid_68 - l_stoplevel_100 * ld_76) a_price_20 = l_bid_68 - l_stoplevel_100 * ld_76;
               if (a_price_28 > 0.0 && a_price_28 < a_price_20 + (l_stoplevel_100 + 1) * ld_76) a_price_28 = a_price_20 + (l_stoplevel_100 + 1) * ld_76;
               if (a_price_36 > a_price_20 - (l_stoplevel_100 + 1) * ld_76) a_price_36 = a_price_20 - (l_stoplevel_100 + 1) * ld_76;
            }
            Print("SetOrder(): Ñêîððåêòèðîâàíû öåíîâûå óðîâíè");
         }
         Print("Error(", l_error_84, ") set order: ", ErrorDescription(l_error_84), ", try ", li_104);
         Print("Ask=", l_ask_60, "  Bid=", l_bid_68, "  sy=", a_symbol_0, "  ll=", a_lots_12, "  op=", GetNameOP(a_cmd_8), "  pp=", a_price_20, "  sl=", a_price_28, "  tp=", a_price_36, "  mn=", a_magic_44);
         if (l_ask_60 == 0.0 && l_bid_68 == 0.0) Message("SetOrder(): Ïðîâåðüòå â îáçîðå ðûíêà íàëè÷èå ñèìâîëà " + a_symbol_0);
         if (l_error_84 == 2/* COMMON_ERROR */ || l_error_84 == 64/* ACCOUNT_DISABLED */ || l_error_84 == 65/* INVALID_ACCOUNT */ || l_error_84 == 133/* TRADE_DISABLED */) {
            popopo1 = TRUE;
            return;
         }
         if (l_error_84 == 4/* SERVER_BUSY */ || l_error_84 == 131/* INVALID_TRADE_VOLUME */ || l_error_84 == 132/* MARKET_CLOSED */) {
            Sleep(300000);
            return;
         }
         if (l_error_84 == 8/* TOO_FREQUENT_REQUESTS */ || l_error_84 == 141/* TOO_MANY_REQUESTS */) Sleep(100000);
         if (l_error_84 == 139/* ORDER_LOCKED */ || l_error_84 == 140/* LONG_POSITIONS_ONLY_ALLOWED */ || l_error_84 == 148/* ERR_TRADE_TOO_MANY_ORDERS */) break;
         if (l_error_84 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);
         if (l_error_84 == 147/* ERR_TRADE_EXPIRATION_DENIED */) a_datetime_48 = 0;
         else
            if (l_error_84 != 135/* PRICE_CHANGED */ && l_error_84 != 138/* REQUOTE */) Sleep(7700.0);
      }
   }
}

string GetNameTF(int a_timeframe_0 = 0) {
   if (a_timeframe_0 == 0) a_timeframe_0 = Period();
   switch (a_timeframe_0) {
   case PERIOD_M1:
      return ("M1");
   case PERIOD_M5:
      return ("M5");
   case PERIOD_M15:
      return ("M15");
   case PERIOD_M30:
      return ("M30");
   case PERIOD_H1:
      return ("H1");
   case PERIOD_H4:
      return ("H4");
   case PERIOD_D1:
      return ("Daily");
   case PERIOD_W1:
      return ("Weekly");
   case PERIOD_MN1:
      return ("Monthly");
   }
   return ("UnknownPeriod");
}

bool ExistOrders(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, int ai_16 = 0) {
   int l_cmd_20;
   int l_ord_total_24 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_28 = 0; l_pos_28 < l_ord_total_24; l_pos_28++) {
      if (OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES)) {
         l_cmd_20 = OrderType();
         if (l_cmd_20 > OP_SELL && l_cmd_20 < 6) {
            if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || l_cmd_20 == a_cmd_8) {
               if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12)
                  if (ai_16 <= OrderOpenTime()) return (TRUE);
            }
         }
      }
   }
   return (FALSE);
}

string GetNameOP(int ai_0) {
   switch (ai_0) {
   case 0:
      return ("Buy");
   case 1:
      return ("Sell");
   case 2:
      return ("Buy Limit");
   case 3:
      return ("Sell Limit");
   case 4:
      return ("Buy Stop");
   case 5:
      return ("Sell Stop");
   }
   return ("Unknown Operation");
}

void Message(string as_0) {
   Comment(as_0);
   if (StringLen(as_0) > 0) Print(as_0);
}

void CloseOrderBySelect() {
   bool l_ord_delete_0;
   int l_error_4;
   if (OrderSelect(OrderTicket(), SELECT_BY_TICKET, MODE_TRADES)) {
      for (int li_8 = 1; li_8 <= NumberOfTry; li_8++) {
         if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;
         while (!IsTradeAllowed()) Sleep(5000);
         l_ord_delete_0 = OrderDelete(OrderTicket(), clDelete);
         if (l_ord_delete_0) {
            if (!(UseSound)) break;
            PlaySound(NameFileSound);
            return;
         }
         l_error_4 = GetLastError();
         Print("Îøèáêà (", l_error_4, ") ïðè óäàëåíèè BUYSTOP", ": ", ErrorDescription(l_error_4), ", ïîïûòêà ", li_8);
         Sleep(5000);
      }
   }
}

void SimpleTrailing(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   double xaxaxa3;
   double l_price_24;
   int l_ord_total_32 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_36 = 0; l_pos_36 < l_ord_total_32; l_pos_36++) {
      if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            xaxaxa3 = GetPoint();
            if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) {
               if (OrderType() == OP_BUY) {
                  l_price_24 = MarketInfo(OrderSymbol(), MODE_BID);
                  if (!TSProfitOnly || l_price_24 - OrderOpenPrice() > TStop.Buy * xaxaxa3)
                     if (OrderStopLoss() < l_price_24 - (TStop.Buy + TrailingStep - 1) * xaxaxa3) ModifyOrder(-1, l_price_24 - TStop.Buy * xaxaxa3, -1);
               }
               if (OrderType() == OP_SELL) {
                  l_price_24 = MarketInfo(OrderSymbol(), MODE_ASK);
                  if (!TSProfitOnly || OrderOpenPrice() - l_price_24 > TStop.Sell * xaxaxa3)
                     if (OrderStopLoss() > l_price_24 + (TStop.Sell + TrailingStep - 1) * xaxaxa3 || OrderStopLoss() == 0.0) ModifyOrder(-1, l_price_24 + TStop.Sell * xaxaxa3, -1);
               }
            }
         }
      }
   }
}

void ModifyOrder(double a_ord_open_price_0 = -1.0, double a_ord_stoploss_8 = 0.0, double a_ord_takeprofit_16 = 0.0, int a_datetime_24 = 0) {
   bool l_bool_28;
   color l_color_32;
   double l_ask_36;
   double l_bid_44;
   int l_error_52;
   int l_digits_56 = MarketInfo(OrderSymbol(), MODE_DIGITS);
   if (a_ord_open_price_0 <= 0.0) a_ord_open_price_0 = OrderOpenPrice();
   if (a_ord_stoploss_8 < 0.0) a_ord_stoploss_8 = OrderStopLoss();
   if (a_ord_takeprofit_16 < 0.0) a_ord_takeprofit_16 = OrderTakeProfit();
   a_ord_open_price_0 = NormalizeDouble(a_ord_open_price_0, l_digits_56);
   a_ord_stoploss_8 = NormalizeDouble(a_ord_stoploss_8, l_digits_56);
   a_ord_takeprofit_16 = NormalizeDouble(a_ord_takeprofit_16, l_digits_56);
   double ld_60 = NormalizeDouble(OrderOpenPrice(), l_digits_56);
   double ld_68 = NormalizeDouble(OrderStopLoss(), l_digits_56);
   double ld_76 = NormalizeDouble(OrderTakeProfit(), l_digits_56);
   if (a_ord_open_price_0 != ld_60 || a_ord_stoploss_8 != ld_68 || a_ord_takeprofit_16 != ld_76) {
      for (int li_84 = 1; li_84 <= NumberOfTry; li_84++) {
         if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;
         while (!IsTradeAllowed()) Sleep(5000);
         RefreshRates();
         l_bool_28 = OrderModify(OrderTicket(), a_ord_open_price_0, a_ord_stoploss_8, a_ord_takeprofit_16, a_datetime_24, l_color_32);
         if (l_bool_28) {
            if (!(UseSound)) break;
            PlaySound(NameFileSound);
            return;
         }
         l_error_52 = GetLastError();
         l_ask_36 = MarketInfo(OrderSymbol(), MODE_ASK);
         l_bid_44 = MarketInfo(OrderSymbol(), MODE_BID);
         Print("Error(", l_error_52, ") modifying order: ", ErrorDescription(l_error_52), ", try ", li_84);
         Print("Ask=", l_ask_36, "  Bid=", l_bid_44, "  sy=", OrderSymbol(), "  op=" + GetNameOP(OrderType()), "  pp=", a_ord_open_price_0, "  sl=", a_ord_stoploss_8, "  tp=", a_ord_takeprofit_16);
         Sleep(10000);
      }
   }
}

double GetProfitOpenPosInCurrency(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   double ld_ret_16 = 0;
   int l_ord_total_24 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_28 = 0; l_pos_28 < l_ord_total_24; l_pos_28++) {
      if (OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL)
               if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) ld_ret_16 += OrderProfit() + OrderCommission() + OrderSwap();
         }
      }
   }
   return (ld_ret_16);
}

double PriceOpenLastPos(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   int l_datetime_16;
   double l_ord_open_price_20 = 0;
   int l_ord_total_28 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_32 = 0; l_pos_32 < l_ord_total_28; l_pos_32++) {
      if (OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "") {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) {
                     if (l_datetime_16 < OrderOpenTime()) {
                        l_datetime_16 = OrderOpenTime();
                        l_ord_open_price_20 = OrderOpenPrice();
                     }
                  }
               }
            }
         }
      }
   }
   return (l_ord_open_price_20);
}

double GetLotLastPos(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   int l_datetime_16;
   double l_ord_lots_20 = -1;
   int l_ord_total_28 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_32 = 0; l_pos_32 < l_ord_total_28; l_pos_32++) {
      if (OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "") {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) {
                     if (l_datetime_16 < OrderOpenTime()) {
                        l_datetime_16 = OrderOpenTime();
                        l_ord_lots_20 = OrderLots();
                     }
                  }
               }
            }
         }
      }
   }
   return (l_ord_lots_20);
}

void OpenPosition(string a_symbol_0, int a_cmd_8, double a_lots_12, double a_price_20 = 0.0, double a_price_28 = 0.0, int a_magic_36 = 0) {
   color l_color_40;
   int l_datetime_44;
   double l_price_48;
   double l_ask_56;
   double l_bid_64;
   int l_digits_72;
   int error99;
   int l_ticket_80 = 0;
   string l_comment_84 = hekle + " " + WindowExpertName() + " " + GetNameTF(Period());
   if (a_symbol_0 == "" || a_symbol_0 == "0") a_symbol_0 = Symbol();
   if (a_cmd_8 == OP_BUY) l_color_40 = clOpenBuy;
   else l_color_40 = clOpenSell;
   for (int li_92 = 1; li_92 <= NumberOfTry; li_92++) {
      if (!IsTesting() && !IsExpertEnabled() || IsStopped()) {
         Print("OpenPosition(): Îñòàíîâêà ðàáîòû ôóíêöèè");
         break;
      }
      while (!IsTradeAllowed()) Sleep(5000);
      RefreshRates();
      l_digits_72 = MarketInfo(a_symbol_0, MODE_DIGITS);
      l_ask_56 = MarketInfo(a_symbol_0, MODE_ASK);
      l_bid_64 = MarketInfo(a_symbol_0, MODE_BID);
      if (a_cmd_8 == OP_BUY) l_price_48 = l_ask_56;
      else l_price_48 = l_bid_64;
      l_price_48 = NormalizeDouble(l_price_48, l_digits_72);
      l_datetime_44 = TimeCurrent();
      if (MarketWatch) l_ticket_80 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, l_price_48, Slippage, 0, 0, l_comment_84, a_magic_36, 0, l_color_40);
      else l_ticket_80 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, l_price_48, Slippage, a_price_20, a_price_28, l_comment_84, a_magic_36, 0, l_color_40);
      if (l_ticket_80 > 0) {
         if (!(UseSound)) break;
         PlaySound(NameFileSound);
         break;
      }
      error99 = GetLastError();
      if (l_ask_56 == 0.0 && l_bid_64 == 0.0) Message("Ïðîâåðüòå â Îáçîðå ðûíêà íàëè÷èå ñèìâîëà " + a_symbol_0);
      Print("Error(", error99, ") opening position: ", ErrorDescription(error99), ", try ", li_92);
      Print("Ask=", l_ask_56, " Bid=", l_bid_64, " sy=", a_symbol_0, " ll=", a_lots_12, " op=", GetNameOP(a_cmd_8), " pp=", l_price_48, " sl=", a_price_20, " tp=", a_price_28, " mn=", a_magic_36);
      if (error99 == 2/* COMMON_ERROR */ || error99 == 64/* ACCOUNT_DISABLED */ || error99 == 65/* INVALID_ACCOUNT */ || error99 == 133/* TRADE_DISABLED */) {
         popopo1 = TRUE;
         break;
      }
      if (error99 == 4/* SERVER_BUSY */ || error99 == 131/* INVALID_TRADE_VOLUME */ || error99 == 132/* MARKET_CLOSED */) {
         Sleep(300000);
         break;
      }
      if (error99 == 128/* TRADE_TIMEOUT */ || error99 == 142 || error99 == 143) {
         Sleep(66666.0);
         if (ExistPositions(a_symbol_0, a_cmd_8, a_magic_36, l_datetime_44)) {
            if (!(UseSound)) break;
            PlaySound(NameFileSound);
            break;
         }
      }
      if (error99 == 140/* LONG_POSITIONS_ONLY_ALLOWED */ || error99 == 148/* ERR_TRADE_TOO_MANY_ORDERS */ || error99 == 4110/* LONGS__NOT_ALLOWED */ || error99 == 4111/* SHORTS_NOT_ALLOWED */) break;
      if (error99 == 141/* TOO_MANY_REQUESTS */) Sleep(100000);
      if (error99 == 145/* TRADE_MODIFY_DENIED */) Sleep(17000);
      if (error99 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);
      if (error99 != 135/* PRICE_CHANGED */) Sleep(7700.0);
   }
   if (MarketWatch && l_ticket_80 > 0 && a_price_20 > 0.0 || a_price_28 > 0.0)
      if (OrderSelect(l_ticket_80, SELECT_BY_TICKET)) ModifyOrder(-1, a_price_20, a_price_28);
}

bool ExistPositions(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, int ai_16 = 0) {
   int l_ord_total_20 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_24 = 0; l_pos_24 < l_ord_total_20; l_pos_24++) {
      if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "") {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12)
                     if (ai_16 <= OrderOpenTime()) return (TRUE);
               }
            }
         }
      }
   }
   return (FALSE);
}

int NevBar() {
   if (mamama2 == Time[0]) return (0);
   mamama2 = Time[0];
   return (1);
}

int NumberOfPositions(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   int l_ord_total_16 = OrdersTotal();
   int l_count_20 = 0;
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_24 = 0; l_pos_24 < l_ord_total_16; l_pos_24++) {
      if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "") {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8)
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) l_count_20++;
            }
         }
      }
   }
   return (l_count_20);
}

void ClosePosFirstProfit(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   int l_ord_total_16 = OrdersTotal();
   if (as_0 == "0") as_0 = Symbol();
   for (int l_pos_20 = l_ord_total_16 - 1; l_pos_20 >= 0; l_pos_20--) {
      if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12)
                  if (OrderProfit() + OrderSwap() > 0.0) ClosePosBySelect();
            }
         }
      }
   }
   l_ord_total_16 = OrdersTotal();
   for (l_pos_20 = l_ord_total_16 - 1; l_pos_20 >= 0; l_pos_20--) {
      if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL)
               if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) ClosePosBySelect();
         }
      }
   }
}

void ClosePosBySelect() {
   bool l_ord_close_0;
   color l_color_4;
   double l_ord_lots_8;
   double xaxaxa3;
   double xaxaxa4;
   double l_price_32;
   int l_error_40;
   if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
      for (int li_44 = 1; li_44 <= NumberOfTry; li_44++) {
         if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;
         while (!IsTradeAllowed()) Sleep(5000);
         RefreshRates();
         xaxaxa3 = NormalizeDouble(MarketInfo(OrderSymbol(), MODE_ASK), Digits);
         xaxaxa4 = NormalizeDouble(MarketInfo(OrderSymbol(), MODE_BID), Digits);
         if (OrderType() == OP_BUY) {
            l_price_32 = xaxaxa4;
            l_color_4 = clCloseBuy;
         } else {
            l_price_32 = xaxaxa3;
            l_color_4 = clCloseSell;
         }
         l_ord_lots_8 = OrderLots();
         l_ord_close_0 = OrderClose(OrderTicket(), l_ord_lots_8, l_price_32, Slippage, l_color_4);
         if (l_ord_close_0) {
            if (!(UseSound)) break;
            PlaySound(NameCloseSound);
            return;
         }
         l_error_40 = GetLastError();
         if (l_error_40 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);
         Print("Error(", l_error_40, ") Close ", GetNameOP(OrderType()), " ", ErrorDescription(l_error_40), ", try ", li_44);
         Print(OrderTicket(), "  Ask=", xaxaxa3, "  Bid=", xaxaxa4, "  pp=", l_price_32);
         Print("sy=", OrderSymbol(), "  ll=", l_ord_lots_8, "  sl=", OrderStopLoss(), "  tp=", OrderTakeProfit(), "  mn=", OrderMagicNumber());
         Sleep(5000);
      }
   } else Print("Íåêîððåêòíàÿ òîðãîâàÿ îïåðàöèÿ. Close ", GetNameOP(OrderType()));
}

double GetPoint() {
   int li_0 = StringFind(Symbol(), "JPY");
   if (li_0 == -1) return (0.0001);
   return (0.01);
}

void Label(string a_name_0, string a_text_8, int a_corner_16 = 2, int a_x_20 = 3, int a_y_24 = 15, int a_fontsize_28 = 10, string a_fontname_32 = "Arial", color a_color_40 = 3329330) {
   if (ObjectFind(a_name_0) != -1) ObjectDelete(a_name_0);
   ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0, 0, 0);
   ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_16);
   ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_20);
   ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_24);
   ObjectSetText(a_name_0, a_text_8, a_fontsize_28, a_fontname_32, a_color_40);
}

double GetLot() {
   double l_free_magrin_0 = 0;
   if (Choice_method) l_free_magrin_0 = AccountBalance();
   else l_free_magrin_0 = AccountFreeMargin();
   double l_minlot_8 = MarketInfo(Symbol(), MODE_MINLOT);
   double l_maxlot_16 = MarketInfo(Symbol(), MODE_MAXLOT);
   double xaxaxa4 = Risk / 100.0;
   double ld_ret_32 = MathFloor(l_free_magrin_0 * xaxaxa4 / MarketInfo(Symbol(), MODE_MARGINREQUIRED) / MarketInfo(Symbol(), MODE_LOTSTEP)) * MarketInfo(Symbol(), MODE_LOTSTEP);
   if (ld_ret_32 < l_minlot_8) ld_ret_32 = l_minlot_8;
   if (ld_ret_32 > l_maxlot_16) ld_ret_32 = l_maxlot_16;
   return (ld_ret_32);
}

Gimana guys, mantab kan silahkan di copy dan di compile ke metaeditor ente....

======================== @@@========================

Script EA Hedging Super :
#property copyright ""
#property link      ""

extern string email = "";
extern string Pair = "USDJPY";
extern double Lots = 0.1;
extern int TakeProfit = 30;
extern int StopLoss = 300;
extern bool ConstantStop = TRUE;
extern int Step1 = 30;
extern int TP1 = 30;
extern int Step2 = 30;
extern int TP2 = 30;
extern int Step3 = 30;
extern int TP3 = 30;
extern int Step4 = 30;
extern int TP4 = 30;
extern int Step5 = 30;
extern int TP5 = 30;
extern int Step6 = 30;
extern int TP6 = 30;
extern int Step7 = 30;
extern int TP7 = 30;
extern int Step8 = 30;
extern int TP8 = 30;
extern int Step9 = 30;
extern int TP9 = 30;
extern int Step10 = 30;
extern int TP10 = 30;
int g_slippage_192 = 3;
int gi_196 = 2;
extern int StartHour = 0;
extern int EndHour = 24;
int g_magic_208 = 111;
int gi_212 = D'01.01.2050 14:00';
int gi_216 = 1533279600;
string gs_220 = "Silahkan Trading Live";

int start() {
   double l_price_0;
   double l_price_8;
   double l_price_16;
   double l_lots_24;
   double l_pips_32;
   double l_pips_40;
   if (Year() > 2012) {
      Alert("EA_Hedging Expaired");
      return (0);
   }
   int l_ticket_48 = 0;
   int l_ticket_52 = 0;
   int l_ticket_56 = 0;
   int l_ticket_60 = 0;
   int l_ticket_64 = 0;
   int l_ticket_68 = 0;
   double l_ord_lots_72 = 0;
   double l_ord_lots_80 = 0;
   double l_ord_open_price_88 = 0;
   double l_ord_open_price_96 = 0;
   double l_ord_takeprofit_104 = 0;
   double l_ord_takeprofit_112 = 0;
   double l_ord_lots_120 = 0;
   double l_ord_lots_128 = 0;
   double l_ord_lots_136 = 0;
   double l_ord_lots_144 = 0;
   double ld_152 = 0;
   double ld_160 = 0;
   for (int l_pos_168 = 0; l_pos_168 < OrdersTotal(); l_pos_168++) {
      OrderSelect(l_pos_168, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
         if (OrderType() == OP_BUY && l_ticket_48 < OrderTicket()) {
            l_ord_lots_72 = OrderLots();
            l_ord_open_price_88 = OrderOpenPrice();
            l_ticket_48 = OrderTicket();
            l_ord_takeprofit_112 = OrderTakeProfit();
            if (OrderLots() == Lots) ld_152 = OrderOpenPrice() - StopLoss * Point;
         }
         if (OrderType() == OP_SELL && l_ticket_52 < OrderTicket()) {
            l_ord_lots_80 = OrderLots();
            l_ord_open_price_96 = OrderOpenPrice();
            l_ticket_52 = OrderTicket();
            l_ord_takeprofit_104 = OrderTakeProfit();
            if (OrderLots() == Lots) ld_160 = OrderOpenPrice() + StopLoss * Point;
         }
         if (OrderType() == OP_BUYLIMIT) {
            l_ticket_56 = OrderTicket();
            l_ord_lots_136 = OrderLots();
         }
         if (OrderType() == OP_SELLLIMIT) {
            l_ticket_60 = OrderTicket();
            l_ord_lots_144 = OrderLots();
         }
         if (OrderType() == OP_BUYSTOP) {
            l_ticket_64 = OrderTicket();
            l_ord_lots_120 = OrderLots();
         }
         if (OrderType() == OP_SELLSTOP) {
            l_ticket_68 = OrderTicket();
            l_ord_lots_128 = OrderLots();
         }
      }
   }
   if (l_ticket_48 == 0) {
      if (l_ticket_56 != 0) OrderDelete(l_ticket_56);
      if (l_ticket_64 != 0) OrderDelete(l_ticket_64);
      l_price_8 = Ask - StopLoss * Point;
      if (StopLoss <= 0) l_price_8 = 0;
      l_price_16 = Ask + TakeProfit * Point;
      if (TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < EndHour) {
         if (TimeCurrent() >= gi_212 && TimeCurrent() <= gi_216) OrderSend(Symbol(), OP_BUY, Lots, Ask, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Blue);
         else Alert(gs_220);
      }
   }
   if (l_ticket_52 == 0) {
      if (l_ticket_60 != 0) OrderDelete(l_ticket_60);
      if (l_ticket_68 != 0) OrderDelete(l_ticket_68);
      l_price_8 = Bid + StopLoss * Point;
      if (StopLoss <= 0) l_price_8 = 0;
      l_price_16 = Bid - TakeProfit * Point;
      if (TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < EndHour) {
         if (TimeCurrent() >= gi_212 && TimeCurrent() <= gi_216) OrderSend(Symbol(), OP_SELL, Lots, Bid, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Red);
         else Alert(gs_220);
      }
   }
   if (l_ticket_48 != 0 && l_ticket_56 == 0) {
      l_pips_40 = FinalStep(l_ord_lots_72);
      l_pips_32 = FinalTP(l_ord_lots_72);
      l_price_0 = l_ord_open_price_88 - l_pips_40 * Point;
      if (ConstantStop == FALSE) l_price_8 = l_price_0 - StopLoss * Point;
      else l_price_8 = ld_152;
      if (StopLoss <= 0) l_price_8 = 0;
      l_price_16 = l_price_0 + l_pips_32 * Point;
      l_lots_24 = NormalizeDouble(2.0 * l_ord_lots_72, gi_196);
      OrderSend(Symbol(), OP_BUYLIMIT, l_lots_24, l_price_0, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Blue);
   }
   if (l_ticket_52 != 0 && l_ticket_60 == 0) {
      l_pips_40 = FinalStep(l_ord_lots_80);
      l_pips_32 = FinalTP(l_ord_lots_80);
      l_price_0 = l_ord_open_price_96 + l_pips_40 * Point;
      if (ConstantStop == FALSE) l_price_8 = l_price_0 + StopLoss * Point;
      else l_price_8 = ld_160;
      if (StopLoss <= 0) l_price_8 = 0;
      l_price_16 = l_price_0 - l_pips_32 * Point;
      l_lots_24 = NormalizeDouble(2.0 * l_ord_lots_80, gi_196);
      OrderSend(Symbol(), OP_SELLLIMIT, l_lots_24, l_price_0, g_slippage_192, l_price_8, l_price_16, "APS_Hedging", g_magic_208, 0, Red);
   }
   for (l_pos_168 = 0; l_pos_168 < OrdersTotal(); l_pos_168++) {
      OrderSelect(l_pos_168, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderType() == OP_BUY && l_ticket_48 != 0 && OrderMagicNumber() == g_magic_208) {
         if (ConstantStop == FALSE) l_price_8 = l_ord_open_price_88 - StopLoss * Point;
         else l_price_8 = ld_152;
         if (StopLoss <= 0) l_price_8 = 0;
         if (l_ticket_48 != OrderTicket()) l_price_16 = l_ord_takeprofit_112;
         else l_price_16 = OrderTakeProfit();
         if (l_price_16 != OrderTakeProfit() || l_price_8 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, l_price_16, 0, CLR_NONE);
      }
      if (OrderSymbol() == Symbol() && OrderType() == OP_SELL && l_ticket_52 != 0 && OrderMagicNumber() == g_magic_208) {
         if (ConstantStop == FALSE) l_price_8 = l_ord_open_price_96 + StopLoss * Point;
         else l_price_8 = ld_160;
         if (StopLoss <= 0) l_price_8 = 0;
         if (l_ticket_52 != OrderTicket()) l_price_16 = l_ord_takeprofit_104;
         else l_price_16 = OrderTakeProfit();
         if (l_price_16 != OrderTakeProfit() || l_price_8 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, l_price_16, 0, CLR_NONE);
      }
   }
   return (0);
}

int FinalStep(double ad_0) {
   ad_0 = NormalizeDouble(ad_0 / Lots, 0);
   switch (ad_0) {
   case 1.0:
      return (Step1);
   case 2.0:
      return (Step2);
   case 4.0:
      return (Step3);
   case 8.0:
      return (Step4);
   case 16.0:
      return (Step5);
   case 32.0:
      return (Step6);
   case 64.0:
      return (Step7);
   case 128.0:
      return (Step8);
   case 256.0:
      return (Step9);
   case 512.0:
      return (Step10);
   }
   return (Step10);
}

int FinalTP(double ad_0) {
   ad_0 = NormalizeDouble(ad_0 / Lots, 0);
   switch (ad_0) {
   case 1.0:
      return (TP1);
   case 2.0:
      return (TP2);
   case 4.0:
      return (TP3);
   case 8.0:
      return (TP4);
   case 16.0:
      return (TP5);
   case 32.0:
      return (TP6);
   case 64.0:
      return (TP7);
   case 128.0:
      return (TP8);
   case 256.0:
      return (TP9);
   case 512.0:
      return (TP10);
   }
   return (TP10);
}

Script ke Tiga (Ababil)
//+------------------------------------------------------------------+
//|                                       @ El Nuno @.mq4 |
//|                                                Versi : Juli 2015 |
//|                                                  Trader Pro 2015 |
//+------------------------------------------------------------------+
#property copyright "Versi : Februari 2015"
#property link      "www.simple-book.blogspot.com"
                   
//||====================================================================================== ||
//|| CATATAN :                                                                             ||
//|| - Tidak untuk di komersilkan  //                                                      ||
//|| - Bijaksanalah dalam mempergunakan EA ini                                             ||
//|| - Trimakasih kepada Trader Borneo yang telah membimbingku                             ||
//|| - Jazzakumullah untuk beliau, semoga diberi kelancaran rizqi dan kesehatan. Amin      ||
//||====================================================================================== ||
extern string     StopTrade_Info       = "Sett Up";
extern string     Aktifasi_Pin         = ".......";
extern int        Tp_from_Bep          = 15;
extern int        StartHour            = 0;
extern int        StopHour             = 24;
extern bool       Buy_Doang            = TRUE;
extern bool       Sell_Doang           = TRUE;
extern bool       Close_Panic          = FALSE;
extern string     Garis                = "==============";
extern bool       Risk_In_Money        = FALSE;
extern int        Risk_in_money        = 3000;
extern string     Garis2               = "==============";
extern int        Lot_mode             = 2;
extern int        Manage_Lot           = 100000;
extern double     Fix_lot              = 0.01;
extern int        Range                = 30;
extern double     DiMarti              = 1.7;
extern int        Level_Max            = 30;
extern int        SL                   = 250;
extern int        TP                   = 15;
extern int        Magic                = 999;
extern string     Garis4               = "==============";
extern bool       Dtrailing            = FALSE;
extern int        StartTrail           = 10;
extern int        Trailing             = 7;
extern string     Garis3               = "==============";
extern bool       Bgrond               = FALSE;
extern color      Warna1               = Black; //LimeGreen;
extern color      Warna2               = Black; //Chocolate;
extern color      Warna3               = Black; //DarkViolet;
 int        Star_ModifTp_Bep     = 2;
 double     Target_Persen        = 1000.0;
 string     Lot_info             = "Sett Mode Lot";
 string     Lot_info2            = "Rumus Compound";

 bool       Close_Buy_Trend      = FALSE;
 bool       Close_Sell_Trend     = FALSE;
 bool       Close_Buy_Counter    = FALSE;
 bool       Close_Sell_Counter   = FALSE;
 string     Seting_Risk_Target   = "=>Gunakan sesuai Kebutuhan<<";
 string     Seting_Mode_Trend    = "=>Seting Trade trend<<";
 string     Seting_Mode_Conter   = "=>Seting Trade Counter Trend<<";
 string     Seting_MM            = "=>Seting sesuai selera<<";
 bool       Tp_In_money          = FALSE;
 double     Tp_in_money          = 7.0;
 string     Indi_Seting          = "==>Stockhastik trend & MA Seting<<=";
 int        kperiod              = 32;
 int        dperiod              = 12;
 int        slowing              = 12;
 int        lo_level             = 25;
 int        up_level             = 75;
 int        maPereode            = 25;
 string     Indi_Stoch_2         = "==>Stockhastik counter trend<<=";
 int        k_period             = 32;
 int        d_period             = 12;
 int        s_lowing             = 12;
 int        lolevel              = 30;
 int        uplevel              = 70;

double gd_376;
double gd_384;
double Lots;
double Acc_Balances;
int               ticket_1 = 0;
int               magic_1;
int               magic_2;
int               magic_3;
int               magic_4;
string            coment_1 = "Ababil-";
string            coment_2 = "Ababil-";
string            coment_3 = "Ababil-";
string            coment_4 = "Ababil-";
string gs_dummy_460;
string gs_dummy_468;
string gs_dummy_476;
string gs_dummy_484;
string gsa_492[10];
string pwd_cocok;
string RRR;
string JJJJ;
string JJJJ1;
string JJJJ2;
string JJJJ3;
string JJJJ4;

string pwd = "yarozaq";
double lossAmount;
string  ObjName = "_panel_1";
string  ObjName2 = "_panel_2";
string  ObjName3 = "_panel_3";

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() {
   Acc_Balances = AccountBalance();
   gd_376 = MarketInfo(Symbol(), MODE_TICKSIZE);
   int li_0 = 1;
   if (Digits == 3 || Digits == 5) {
      gd_376 = 10.0 * gd_376;
      li_0 = 10 * li_0;
   }
   gd_384 = MarketInfo(Symbol(), MODE_STOPLEVEL) / li_0;
   if (SL > 0.0 && SL < gd_384) {
      Print("stoploss is too tight.");
      SL = gd_384;
   }
   if (TP > 0.0 && TP < gd_384) {
      Print("takeprofit is too tight.");
      TP = gd_384;
   }
   if (Trailing < gd_384) {
      Print("trailing is too tight.");
      Trailing = gd_384;
   }
 
   if (ObjectFind(ObjName) == -1) {
ObjectCreate(ObjName, OBJ_LABEL, 0, 0, 0, 0, 0);
ObjectSetText  (ObjName,"g",150, "Webdings", Warna1);
ObjectSet      (ObjName, OBJPROP_CORNER,0);
ObjectSet      (ObjName, OBJPROP_XDISTANCE, 0);
ObjectSet      (ObjName, OBJPROP_YDISTANCE, 13);
ObjectSet      (ObjName, OBJPROP_BACK, Bgrond);
}
      if (ObjectFind(ObjName2) == -1) {
ObjectCreate(ObjName2, OBJ_LABEL, 0, 0, 0, 0, 0);
ObjectSetText  (ObjName2,"g",150, "Webdings", Warna2);
ObjectSet      (ObjName2, OBJPROP_CORNER,0);
ObjectSet      (ObjName2, OBJPROP_XDISTANCE, 0);
ObjectSet      (ObjName2, OBJPROP_YDISTANCE, 150);
ObjectSet      (ObjName2, OBJPROP_BACK, Bgrond);
}
      if (ObjectFind(ObjName3) == -1) {
ObjectCreate(ObjName3, OBJ_LABEL, 0, 0, 0, 0, 0);
ObjectSetText  (ObjName3,"g",150, "Webdings", Warna3);
ObjectSet      (ObjName3, OBJPROP_CORNER,0);
ObjectSet      (ObjName3, OBJPROP_XDISTANCE, 0);
ObjectSet      (ObjName3, OBJPROP_YDISTANCE, 310);
ObjectSet      (ObjName3, OBJPROP_BACK, Bgrond);
}

   magic_1 = Magic + 9;
   magic_2 = Magic + 99;
   magic_3 = Magic + 999;
   magic_4 = Magic + 9999;
   if (Lot_mode == 2) Lots = f0_7(Fix_lot);
   return (0);
}



//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

int deinit() {
   ObjectDelete("ObjLabel1");
   ObjectDelete("ObjLabel2");
   ObjectDelete("ObjLabel3");
   ObjectDelete("ObjLabel4");
   ObjectDelete("ObjLabel5");
   ObjectDelete("ObjLabel6");
   ObjectDelete("ObjLabel7");
   ObjectDelete("ObjLabel8");
   ObjectDelete("_panel_1");
   ObjectDelete("_panel_2");
   ObjectDelete("_panel_3");

   return (0);
}
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

int start() {


HideTestIndicators(true);
  string char[256]; int i;

  for (i = 0; i < 256; i++) char[i] = CharToStr(i);

  // Date, until which the expert is allowed to work
  int LastAllowedDate = StrToTime(
  /* 2009.09.11 23:59:00 */
  char[50]+char[48]+char[48]+char[57]+char[46]+char[48]+char[57]+char[46]+char[49]+
  char[49]+char[32]+char[50]+char[51]+char[58]+char[53]+char[57]+char[58]+char[48]+char[48]

  );

   if (Lot_mode == 1) Lots = f0_7(AccountBalance() / Manage_Lot);
   if (Lot_mode < 1 || Lot_mode > 2) {
      Comment("invalid Lot_Mode");
      return (0);
   }
   Label_1();
   //========================================================================
 
   if (Aktifasi_Pin == pwd) pwd_cocok = " On";
   else {
      if (Aktifasi_Pin != pwd) {
         pwd_cocok = " Off";
         return;
      }
   }
 
   //========================================================================
     if (Range < 20) RRR = " BERESIKO ";
     if (Range > 19)  RRR = " AMAN";
   
   
   //========================================================================
   if ((!Buy_Doang) ) JJJJ1 = " Buy mode OFF";
   if ((Buy_Doang) ) JJJJ1 = " Buy mode ON";
   if ((!Sell_Doang) ) JJJJ2 = " Sell mode OFF";
   if ((Sell_Doang) ) JJJJ2 = " Sell mode ON";
   //========================================================================
   if ((!Risk_In_Money) ) JJJJ = " OFF";
   if ((Risk_In_Money) ) JJJJ = " AKTIF";
   //========================================================================
   if ((!Close_Panic) ) JJJJ3 = " Menyiapkan Close All";
   if ((Close_Panic) ) JJJJ3 = " Close All Bekerja";
   //========================================================================
   if ((StartHour <1) && StopHour>=24 ) JJJJ4 = " 24 Jam Mode";
   if ((StartHour >0) || StopHour<24 ) JJJJ4 = " Sesion Mode";

   double Acc_Balancepersen = Acc_Balances * Target_Persen / 100.0;
   if (AccountEquity() >= Acc_Balances + Acc_Balancepersen || (Risk_In_Money && AccountEquity() <= Acc_Balances - Risk_in_money) || Close_Panic) {
      Close_All(magic_1);
      Close_All(magic_2);
      Close_All(magic_3);
      Close_All(magic_4);
      return;
   }
   if (Close_Buy_Trend) Close_All(magic_1);
   if (Close_Sell_Trend) Close_All(magic_2);
   if (Close_Buy_Counter) Close_All(magic_3);
   if (Close_Sell_Counter) Close_All(magic_4);
   if (Tp_In_money && f0_6(magic_1) + f0_6(magic_2) + f0_6(magic_3) + f0_6(magic_4) >= Tp_in_money) {
      Close_All(magic_1);
      Close_All(magic_2);
      Close_All(magic_3);
      Close_All(magic_4);
   }
   f0_8(magic_1, coment_1);
   f0_8(magic_2, coment_2);
   f0_8(magic_3, coment_3);
   f0_8(magic_4, coment_4);
   f0_9(magic_1);
   f0_9(magic_2);
   f0_9(magic_3);
   f0_9(magic_4);
   if (Dtrailing) {
      f0_14(magic_1);
      f0_14(magic_2);
      f0_14(magic_3);
      f0_14(magic_4);
   }
   if (!Close_Panic) {
      if ((!Close_Buy_Trend) && Buy_Doang && f0_13(magic_1) == 0 && f0_1(1) == -2) ticket_1 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - SL * gd_376, 0, coment_1 + 0, magic_1, 0, White);
      if ((!Close_Sell_Trend) && Sell_Doang && f0_13(magic_2) == 0 && f0_1(1) == 2) ticket_1 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + SL * gd_376, 0, coment_2 + 0, magic_2, 0, Aqua);
      if ((!Close_Buy_Counter) && Buy_Doang && f0_13(magic_3) == 0 && f0_1(-1) == -2) ticket_1 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - SL * gd_376, 0, coment_3 + 0, magic_3, 0, Blue);
      if ((!Close_Sell_Counter) && Sell_Doang && f0_13(magic_4) == 0 && f0_1(-1) == 2) ticket_1 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + SL * gd_376, 0, coment_4 + 0, magic_4, 0, Red);
   }
   return (0);
}
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int f0_1(int ai_0) {
   double ima_4 = iMA(Symbol(), 0, maPereode, 0, MODE_LWMA, PRICE_CLOSE, 0);
   double istochastic_12 = iStochastic(NULL, 0, kperiod, dperiod, slowing, MODE_SMA, 0, MODE_MAIN, 0);
   double istochastic_20 = iStochastic(NULL, 0, k_period, d_period, s_lowing, MODE_SMA, 0, MODE_MAIN, 0);
   if (ai_0 == 1 && f0_0() == 1) {
      if (Close[1] < ima_4 && istochastic_12 > lo_level) return (2);
      if (Close[1] > ima_4 && istochastic_12 < up_level) return (-2);
   }
   if (ai_0 == -1 && f0_4() == 1) {
      if (istochastic_20 > uplevel) return (2);
      if (istochastic_20 < lolevel) return (-2);
   }
   return (0);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
double f0_6(int a_magic_0) {
   double ld_ret_4 = 0;
   for (int pos_12 = 0; pos_12 < OrdersTotal(); pos_12++) {
      OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderType() > OP_SELL) continue;
      if (a_magic_0 == OrderMagicNumber()) ld_ret_4 += OrderProfit();
   }
   return (ld_ret_4);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
void Close_All(int a_magic_0) {
   for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
      OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol()) {
         if (a_magic_0 == OrderMagicNumber()) {
            if (OrderType() > OP_SELL) {
               OrderDelete(OrderTicket());
               continue;
            }
            if (OrderType() == OP_BUY) {
               OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);
               continue;
            }
            OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);
         }
      }
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
void f0_8(int a_magic_0, string as_4) {
   int cmd_16;
   double order_open_price_20;
   double order_lots_28;
   double ld_40;
   int li_12 = f0_13(a_magic_0);
   if (li_12 > 0 && li_12 < Level_Max) {
      for (int pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) {
         if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() != Symbol() || OrderMagicNumber() != a_magic_0) continue;
            cmd_16 = OrderType();
            order_open_price_20 = OrderOpenPrice();
            order_lots_28 = OrderLots();
         }
      }
      ld_40 = order_open_price_20 - Range * gd_376;
      if (cmd_16 == OP_BUY && Ask <= ld_40) ticket_1 = OrderSend(Symbol(), OP_BUY, f0_7(order_lots_28 * DiMarti), Ask, 3, Ask - SL * gd_376, 0, as_4 + li_12, a_magic_0, 0, Green);
      ld_40 = order_open_price_20 + Range * gd_376;
      if (cmd_16 == OP_SELL && Bid >= ld_40) ticket_1 = OrderSend(Symbol(), OP_SELL, f0_7(order_lots_28 * DiMarti), Bid, 3, Bid + SL * gd_376, 0, as_4 + li_12, a_magic_0, 0, Yellow);
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
void f0_9(int a_magic_0) {
   double ld_8;
   double price_16;
   int li_4 = f0_13(a_magic_0);
   if (li_4 != 0) {
      if (Tp_from_Bep == 0.0 || TP == 0.0) return;
      ld_8 = MathMax(f0_12(a_magic_0, OP_SELL), f0_12(a_magic_0, OP_BUY));
      for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
         if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol()) {
               if (OrderMagicNumber() == a_magic_0) {
                  if (li_4 < Star_ModifTp_Bep) price_16 = f0_11(OrderType(), TP, OrderOpenPrice());
                  else price_16 = f0_11(OrderType(), Tp_from_Bep, ld_8);
                  if (!f0_10(price_16, OrderTakeProfit())) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), price_16, 0, CLR_NONE);
               }
            }
         }
      }
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int f0_13(int a_magic_0) {
   int count_4 = 0;
   for (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {
      OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol())
         if (a_magic_0 == OrderMagicNumber()) count_4++;
   }
   return (count_4);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int f0_0() {
   bool li_ret_0 = FALSE;
   if (StartHour > StopHour) {
      if (TimeHour(TimeCurrent()) >= StartHour || TimeHour(TimeCurrent()) < StopHour) li_ret_0 = TRUE;
   } else
      if (TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < StopHour) li_ret_0 = TRUE;
   return (li_ret_0);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int f0_4() {
   bool li_ret_0 = FALSE;
   if (StartHour > StopHour) {
      if (TimeHour(TimeCurrent()) >= StartHour || TimeHour(TimeCurrent()) < StopHour) li_ret_0 = TRUE;
   } else
      if (TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < StopHour) li_ret_0 = TRUE;
   return (li_ret_0);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

void Label_1(){

   string DrowDown = DoubleToStr(balanceDeviation(2), 2); ///..........DD 1

      ObjectCreate("a",OBJ_LABEL,0,0,0);
      ObjectSet("a",OBJPROP_CORNER,4);
      ObjectSet("a",OBJPROP_XDISTANCE,10);
      ObjectSet("a",OBJPROP_YDISTANCE,15);
      ObjectSetText("a","     ABABIL - 2015",14,"Comic",Red);
   
      ObjectCreate("c1",OBJ_LABEL,0,0,0,0,0);
      ObjectSet("c1", OBJPROP_CORNER, 4);
      ObjectSet("c1",OBJPROP_XDISTANCE,10);
      ObjectSet("c1",OBJPROP_YDISTANCE,15+10);
      ObjectSetText("c1","--------------------------------------------",13,"Mistral",Yellow);
   
      ObjectCreate("c2",OBJ_LABEL,0,0,0,0,0);
      ObjectSet("c2", OBJPROP_CORNER, 4);
      ObjectSet("c2",OBJPROP_XDISTANCE,35);
      ObjectSet("c2",OBJPROP_YDISTANCE,15+21);
      ObjectSetText("c2","Simple - Profit - Konsisten - Aman",10,"Mistral",Yellow);
   
  /*ObjectCreate("c",OBJ_LABEL,0,0,0,0,0);
  ObjectSet("c", OBJPROP_CORNER, 4);
  ObjectSet("c",OBJPROP_XDISTANCE,10);
  ObjectSet("c",OBJPROP_YDISTANCE,10+15);
  ObjectSetText("c"," Info Terkini :",15,"Mistral",Blue);
   
  ObjectCreate("c3",OBJ_LABEL,0,0,0,0,0);
  ObjectSet("c3", OBJPROP_CORNER, 4);
  ObjectSet("c3",OBJPROP_XDISTANCE,7);
  ObjectSet("c3",OBJPROP_YDISTANCE,10+30);
  ObjectSetText("c3","==================",12,"Mistral",Gold);*/

 ObjectCreate("j",OBJ_LABEL,0,0,0);
 ObjectSet("j",OBJPROP_CORNER,3);
 ObjectSet("j",OBJPROP_XDISTANCE,10);
 ObjectSet("j",OBJPROP_YDISTANCE,10);
 ObjectSetText("j","Trader Pro || 2015 ",13,"Mistral",White);
 Comment("\n ",


   "\n ",
      "\n   ::    ", pwd_cocok,
   "\n --------------------------------------------------------------",
      "\n   ::    Drow Down            : ", DrowDown,"  %",
      "\n   ::    Balance                  : ", AccountBalance(),    
      "\n   ::    Equity                    : ", AccountEquity(),
      "\n   ::    Profit                     : ", AccountProfit(),
      "\n   ::    Spread                   : ", MarketInfo(Symbol(), MODE_SPREAD),
      "\n   ::    Leverage                : 1 : ", AccountLeverage(),

   "\n --------------------------------------------------------------",
      "\n   ::    Jam Server             : ", Hour(), " : ", Minute(),
      "\n   ::    Jam Trading            : ", StartHour," - ", StopHour,
      "\n   ::    Buy Trade              : ",JJJJ1,
      "\n   ::    Sell Trade               : ",JJJJ2,

   "\n --------------------------------------------------------------",
    //"\n ",
      "\n   ::    Lot                         : ", Lots,
      "\n   ::    Range                    : ", Range,  
      "\n   ::    TP                         : ", TP,
      "\n   ::    Zona BEP+ Bonus    : ", Tp_from_Bep,
      "\n   ::    Marti                      : ", DiMarti,
      "\n   ::    Max Level               : ", Level_Max,
      "\n   ::    SL                          : ", SL,
   "\n --------------------------------------------------------------",
      "\n   ||    Magic  : ",Magic,"   || ",JJJJ3,

   "\n --------------------------------------------------------------",
      "\n   ::    Sesion                     : ", JJJJ4,
      "\n   ::    Range                     : ", RRR,
      "\n   ::    Safety Mode            : ", JJJJ,
      "\n   ::    Safety Amount         : "," $.", Risk_in_money);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
void f0_14(int a_magic_0) {
   int li_4;
   double price_24;
   double ld_8 = f0_12(a_magic_0, OP_BUY);
   double ld_16 = f0_12(a_magic_0, OP_SELL);
   for (int pos_32 = OrdersTotal() - 1; pos_32 >= 0; pos_32--) {
      if (OrderSelect(pos_32, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == a_magic_0) {
               if (OrderType() == OP_BUY) {
                  li_4 = NormalizeDouble((Bid - ld_8) / gd_376, 0);
                  if (li_4 < StartTrail) break;
                  price_24 = NormalizeDouble(Bid - Trailing * gd_376, Digits);
                  if (OrderStopLoss() == 0.0 || price_24 > OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), price_24, OrderTakeProfit(), 0, Aqua);
               }
               if (OrderType() == OP_SELL) {
                  li_4 = NormalizeDouble((ld_16 - Ask) / gd_376, 0);
                  if (li_4 < StartTrail) break;
                  price_24 = NormalizeDouble(Ask + Trailing * gd_376, Digits);
                  if (OrderStopLoss() == 0.0 || price_24 < OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), price_24, OrderTakeProfit(), 0, Pink);
               }
            }
         }
      }
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
double f0_12(int a_magic_0, int a_cmd_4) {
   double ld_ret_8 = 0;
   double ld_16 = 0;
   for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
      Sleep(1);
      if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol()) {
            if (a_cmd_4 == OrderType()) {
               if (a_magic_0 == OrderMagicNumber()) {
                  ld_ret_8 += OrderOpenPrice() * OrderLots();
                  ld_16 += OrderLots();
               }
            }
         }
      }
   }
   if (ld_16 > 0.0) ld_ret_8 = NormalizeDouble(ld_ret_8 / ld_16, Digits);
   return (ld_ret_8);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
double f0_11(int ai_0, int ai_4, double ad_8) {
   if (ai_4 == 0) return (0);
   if (MathMod(ai_0, 2) == 0.0) return (ad_8 + gd_376 * ai_4);
   return (ad_8 - gd_376 * ai_4);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
double f0_7(double ad_0) {
   double maxlot_8 = MarketInfo(Symbol(), MODE_MAXLOT);
   double minlot_16 = MarketInfo(Symbol(), MODE_MINLOT);
   double lotstep_24 = MarketInfo(Symbol(), MODE_LOTSTEP);
   double ld_32 = lotstep_24 * NormalizeDouble(ad_0 / lotstep_24, 0);
   ld_32 = MathMax(MathMin(maxlot_8, ld_32), minlot_16);
   return (ld_32);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
bool f0_10(double ad_0, double ad_8) {
   bool bool_16 = NormalizeDouble(ad_0 / Point, 0) == NormalizeDouble(ad_8 / Point, 0);
   return (bool_16);
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
////.............................................................////  DD 2
////                     *** Void Drow Down ***
////.............................................................////  DD 2
double balanceDeviation(int m) {                                  //|
   double Ret;                                                    //|
   if (m == 2) {                                                  //|
      Ret = (AccountEquity() / AccountBalance() - 1.0) / (-0.01); //|
      if (Ret > 0.0) return (Ret);                                //|
      return (0);
   }
   if (m == 1) {
      Ret = 100.0 * (AccountEquity() / AccountBalance() - 1.0);
      if (Ret > 0.0) return (Ret);
      return (0);
   }
   return (0.0);                                                
}
////.................................................................  DD 2

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

disini lanjut nanti boss

By : El Nuno - Project Trader Pro

Trading forex adalah sebuah bisnis yang memiliki RESIKO TINGGI yang dapat mengakibatkan kehilangan uang anda kapan saja. Namun disisi lain Bisnis Forex memiliki RETURN TINGGI dan bersifat liquid, artinya anda dapat mengambil uang anda kapan saja, dimana saja. Maka dari itu bijaksanalah dalam mensikapi bisnis ini. Semua keputusan ada ditangan anda. Salam sukses

Ikuti: Facebook | Twitter | Google Plus :: Trimakasih kunjunganya ! ::

0 comments:

Post a Comment

Semua komentar, kritik dan saran akan selalu kami nantikan demi untuk kebaikan dan kemajuan blog ini. Trimaasih