ci sono parti eliminabili in questo ea?
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#property copyright "Life Changer EA"                          //|XX
#property link      "www.lifechangerea.com"     //|XX
#property version   "1.00"                                       //|XX
#property strict "BCL"                                           //|XX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdlib.mqh>


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||
/*
bool  Filter_Time_For_Trial=true;
string     Trial_Time  ="2000.01.01";
string trial_version="YOUR ARE NOT Allow Backtest at this Periode" ;
string trial_version2="Demo Version Backtest Allow Until : " ;
*/


bool BrokerIsECN = true;
string EA_NAME = "Change The Life With Life Changer EA";
string Lot_Setting    = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
input bool Autolot=false;
extern double Percentuale=2;
double AutoMM =0.2;
int Lot_Digits;
input bool MartingaleTrade_ON=true;
extern int    AroonPeriod      = 70;
extern int    Filter           = 50;
int candle=1; // 0 =entry on current candle,1= close candle
input double FixLot=0.01;
input double Multiplier= 1.05;
string XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
input double  Step= 20;
input double  TakeProfit =35;
double Average_TP =8;
extern int     Stoploss =700;
extern int    MaxTrades_EachSide  = 50;
extern int MagicNumber     = 1234567 ;
string Trailing_Setting="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
input bool Trailing_Stop_ON=true;
input double Trailing_Stop =12;
extern int   TrailingStep   =1;
input   double Order_Distance=10;//Distance between orders (Point)
input string Symbol1 = "GBPUSD";
string Symbol2 = "";
string Symbol3 = "";
string Symbol4 = "";
string Symbol5 = "";
string Symbol6 = "";
string Symbol7 = "";
string Symbol8 = "";
string Symbol9 = "";
string Symbol10 = "";
string Symbol11 = "";
string Symbol12 = "";
string Symbol13 = "";
string Symbol14 = "";
string Symbol15 = "";
string Symbol16 = "";
string Symbol17 = "";
string Symbol18 = "";
string Symbol19 = "";
string Symbol20 = "";
string Symbol21 = "";
string Symbol22 = "";
string Symbol23 = "";
string Symbol24 = "";
string Symbol25 = "";
string Symbol26 = "";
string Symbol27 = "";
string Symbol28 = "";
string Symbol29 = "";
string Symbol30 = "";
input int    MaxPairTrades = 2;
string suffix = "";
int MagicNumber_Buy     ;//= 1234 ;
int MagicNumber_Sell    ; //= 1234;
input bool Hidden_TP=true;
extern double hidden_takeprofit=30;
extern double Average_HTP=8;
input string comment= "Life Changer EA ";
input bool Average_ALL=true ;
bool    Filter_Min_Distance_ON=true;
int     slippage     = 20;
string SET_TRADING_TIME    = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
input bool Filter_TradingTime=true;
input string Time_Start         = "00:00"; //Time Start
input string Time_End          = "23:59"; //Time End
double BEP_YYY,BEP_XXX,TSP;
color clr_price,clr_eq;
double prev_lot,prev_price,prev_tp,prev_sl;
double Lot_Multi;
double mode_his;
int cnt,OC,modif;
double pos_sell,pos_buy;
int text_corner=1;
int text_size=12;
color color_text= Lime;
double  close,Range, Spread,Balance, Equity,Profit,DD,Lev,St_Out;
color l_text,r_text ;
string Running_Price,Range_Price,AB,AE,AP,Persen_DD,SP,Leverage, Auto_Cut,Enter_Lot;
double SLB,SLS,TPB,TPS;

int OpenBuy,OpenSell,Select,Modif ;
double select,ord_close,ord_del;
int ord_send;
double Take_SL,Take_TP,Take_HTP,Take_HSL,TSL,SL,TP,hide_tp,hide_sl;
int tolerance;
bool ACCOUNT_INFO=true;
string Day1="MONDAY";
string Day2="TUESDAY";
string Day3="WEDNESDAY";
string Day4="THURSDAY";
string Day5="FRIDAY";
string Day6="SATURDAY";
string Day7="SUNDAY";
string hari;

double x_price,y_price,xx_price,yy_price;
double SLS_PRICE,SLB_PRICE, TPB_PRICE,TPS_PRICE;
double PS;

int pip;
int xy_orders,x_orders,y_orders;
double xy_p,xy_vol;
double pv,tz,bep_x,bep_y,bep;

double x_vol,y_vol,x_pl,y_pl,bep_buy,bep_sell;
double initial_buy,initial_sell;
double  Martin_Buy,Martin_Sell, Martin_TPB,Martin_TPS, Martin_SLB,Martin_SLS;
double modif_tpb, modif_tps;

double po_sell,po_buy;
double XYZ,XYZ1,XYZ2;
double last_vol;

double total_xp,total_yp,total_xv,total_yv,avg_xx,avg_yy;
double Diff_B,Diff_S, Total_Profit_X,Total_ProfitY;
int Ord_Modif;
double close_allxy;
double  Lot_MultiB,Lot_MultiS;

datetime Loss_XT,Loss_YT,CO_Time;
int CO_Orders;
double his_xy,his_x,his_y;
double bcp,Close_BL, scp,Close_SL;
double TPB_ALL,TPS_ALL;
double y_bep,x_bep,bep_pricex,bep_pricey;
double RANGE;;
double Buy_Price,Sell_Price;
int i;
int OpenOrders1,OpenOrders2;
datetime ytime,xtime ;
string XXX,YYY;
double buffer3,buffer4;
double AroonUp,AroonDn,AroonUp2,AroonDn2;

int pairs;
string symb[];
string simbol;

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
int OnInit()
  {
   EventSetMillisecondTimer(1);

   suffix = StringSubstr(Symbol(), 6, StringLen(Symbol()) - 6);
   pairs = 0;
   if(Symbol1 != "")
      append(Symbol1);
   if(Symbol2 != "")
      append(Symbol2);
   if(Symbol3 != "")
      append(Symbol3);
   if(Symbol4 != "")
      append(Symbol4);
   if(Symbol5 != "")
      append(Symbol5);
   if(Symbol6 != "")
      append(Symbol6);
   if(Symbol7 != "")
      append(Symbol7);
   if(Symbol8 != "")
      append(Symbol8);
   if(Symbol9 != "")
      append(Symbol9);
   if(Symbol10 != "")
      append(Symbol10);
   if(Symbol11 != "")
      append(Symbol11);
   if(Symbol12 != "")
      append(Symbol12);
   if(Symbol13 != "")
      append(Symbol13);
   if(Symbol14 != "")
      append(Symbol14);
   if(Symbol15 != "")
      append(Symbol15);
   if(Symbol16 != "")
      append(Symbol16);
   if(Symbol17 != "")
      append(Symbol17);
   if(Symbol18 != "")
      append(Symbol18);
   if(Symbol19 != "")
      append(Symbol19);
   if(Symbol20 != "")
      append(Symbol20);
   if(Symbol21 != "")
      append(Symbol21);
   if(Symbol22 != "")
      append(Symbol22);
   if(Symbol23 != "")
      append(Symbol23);
   if(Symbol24 != "")
      append(Symbol24);
   if(Symbol25 != "")
      append(Symbol25);
   if(Symbol26 != "")
      append(Symbol26);
   if(Symbol27 != "")
      append(Symbol27);
   if(Symbol28 != "")
      append(Symbol28);
   if(Symbol29 != "")
      append(Symbol29);
   if(Symbol30 != "")
      append(Symbol30);

   MagicNumber_Buy=MagicNumber;
   MagicNumber_Sell=MagicNumber;

   return(INIT_SUCCEEDED);
  }

//+
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||



//=============================================================================||
void OnDeinit(const int reason)
  {

   CleanUp();
   EventKillTimer();
//   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   string CheckSymbol[];
   int AddCheckSymbol = 0;
   for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
     {
      select=OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
        {
         if((OrderMagicNumber()  == MagicNumber_Buy || OrderMagicNumber()  == MagicNumber_Sell))
           {
            for(i=0; i<pairs; i++)
              {
               if(OrderSymbol() == symb[i])
                 {
                  bool AddData = true;
                  for(int k=0; k<AddCheckSymbol; k++)
                     if(CheckSymbol[k] == OrderSymbol())
                        AddData = false;
                  if(AddData)
                    {
                     AddCheckSymbol++;
                     ArrayResize(CheckSymbol,AddCheckSymbol);
                     CheckSymbol[AddCheckSymbol-1] = OrderSymbol();
                    }
                 }

              }
           }
        }
     }
   for(i=0; i<pairs; i++)
     {
      simbol = symb[i];
      bool ReadyOpen = false;
      if(AddCheckSymbol < MaxPairTrades)
         ReadyOpen = true;
      else
        {
         for(int cek=0; cek<AddCheckSymbol; cek++)
           {
            if(simbol == CheckSymbol[cek] && cek < MaxPairTrades)
               ReadyOpen = true;
           }
        }

      int DIGITS = (int) MarketInfo(simbol,MODE_DIGITS);
      double point = MarketInfo(simbol,MODE_POINT);


      pv=NormalizeDouble(MarketInfo(simbol,MODE_TICKVALUE),DIGITS);

      //NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXX
      OpenBuy    = 0;
      OpenSell    = 0;
      OpenOrders1    = 0;
      OpenOrders2    = 0;
      x_price=0;
      y_price=0;
      xx_price=0;
      yy_price=0;
      xy_orders=0;
      xy_p=0;
      xy_vol=0;
      XYZ=0;
      XYZ1=0;
      XYZ2=0;
      Profit=0;
      total_xp=0;
      total_yp=0;
      total_xv=0;
      total_yv=0;
      avg_xx=0;
      avg_yy=0;
      xtime=0;
      ytime=0;
      for(cnt=0; cnt<OrdersTotal(); cnt++)
        {
         select=OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
           {
            if(OrderSymbol()==simbol &&(OrderMagicNumber()  == MagicNumber_Buy))
              {
               OpenOrders1++;
              }
            if(OrderSymbol()==simbol  &&(OrderMagicNumber()  == MagicNumber_Sell))
              {
               OpenOrders2++;
              }

            if(OrderSymbol()==simbol && OrderMagicNumber() == MagicNumber_Buy && OrderType()==OP_BUY)
              {
               x_vol=OrderLots();
               OpenBuy++;
               total_xp +=OrderProfit();
               Buy_Price=OrderOpenPrice();
               SLB_PRICE=OrderStopLoss();
               TPB_PRICE=OrderTakeProfit();
               x_price +=OrderOpenPrice();
               xx_price =NormalizeDouble((x_price/OpenBuy),DIGITS);
               total_xv +=OrderLots();
               avg_xx= NormalizeDouble(total_xp/total_xv/pv,DIGITS);
               xtime=OrderOpenTime();
              }

            if(OrderSymbol()==simbol && OrderMagicNumber() == MagicNumber_Sell && OrderType()==OP_SELL)
              {
               OpenSell++;
               y_vol=OrderLots();
               Sell_Price=OrderOpenPrice();
               SLS_PRICE=OrderStopLoss();
               TPS_PRICE=OrderTakeProfit();
               y_price +=OrderOpenPrice();;
               yy_price =NormalizeDouble((y_price/OpenSell),DIGITS);
               total_yv +=OrderLots();
               total_yp +=OrderProfit();
               avg_yy= NormalizeDouble(total_yp/total_yv/pv,DIGITS);
               ytime=OrderOpenTime();
              }
           }
        }
      //=======================================================================================================================||
      if((DIGITS==5||DIGITS==3)
         &&(simbol!= ""+"XAU"+"" || simbol!="XAU"+"" ||simbol!="XAUUSDcheck" ||simbol!="XAUUSD" ||  simbol!="GOLD"))
         pip=10;
      else
         pip=1;

      if(DIGITS==3
         &&(simbol== ""+"XAU"+"" || simbol=="XAU"+"" ||simbol=="XAUUSDcheck" ||simbol=="XAUUSD" ||  simbol=="GOLD"))
         pip=100;
      else
         pip=10;
      //Print(simbol," ",point," ",pip);
      if(point == 0 || pip == 0)
         continue;
      Spread =NormalizeDouble((MarketInfo(simbol,MODE_ASK)-MarketInfo(simbol,MODE_BID))/point/pip,2);


      MinLot=MarketInfo(simbol,MODE_MINLOT);
      MaxLot=MarketInfo(simbol,MODE_MAXLOT);

      if(MinLot==0.01)
         Lot_Digits=2;
      if(MinLot==0.1)
         Lot_Digits=1;
      if(MinLot==1)
         Lot_Digits=0;


      HideTestIndicators(true);

      if(DayOfWeek()==1)
         hari= Day1;
      if(DayOfWeek()==2)
         hari= Day2;
      if(DayOfWeek()==3)
         hari= Day3;
      if(DayOfWeek()==4)
         hari= Day4;
      if(DayOfWeek()==5)
         hari= Day5;
      if(DayOfWeek()==6)
         hari= Day6;
      if(DayOfWeek()==7)
         hari= Day7;

      if(DIGITS==3|| DIGITS==5)
        {
         tolerance= slippage*10;
        }
      else
        {
         tolerance= slippage*1;
        }

      if(candle==0)
         last_vol=1000;
      if(candle==1)
         last_vol=30;

      AroonUp = 100.0*(AroonPeriod-iHighest(simbol,0,MODE_HIGH,AroonPeriod,candle)+candle)/AroonPeriod;
      AroonDn = 100.0*(AroonPeriod- iLowest(simbol,0,MODE_LOW,AroonPeriod,candle)+candle)/AroonPeriod;

      AroonUp2 = 100.0*(AroonPeriod-iHighest(simbol,0,MODE_HIGH,AroonPeriod,candle+1)+candle+1)/AroonPeriod;
      AroonDn2 = 100.0*(AroonPeriod- iLowest(simbol,0,MODE_LOW,AroonPeriod,candle+1)+candle+1)/AroonPeriod;

      buffer3 = AroonUp-AroonDn;
      buffer4 = AroonUp2-AroonDn2;
      if(buffer3> Filter && buffer4< Filter)
         XXX="BUY";
      else
         XXX="NOBUY";
      if(buffer3<-Filter && buffer4>-Filter)
         YYY="SELL";
      else
         YYY="NOSELL";

      if(Stoploss>0&& Stoploss*pip>MarketInfo(simbol,MODE_STOPLEVEL))
        {
         SLB=MarketInfo(simbol,MODE_ASK)-(Stoploss*pip*point);
         SLS=MarketInfo(simbol,MODE_BID)+Stoploss*pip*point;//
        }
      if((Stoploss==0) || (Stoploss*pip<=MarketInfo(simbol,MODE_STOPLEVEL)))
        {
         SLB=0;
         SLS=0;
        }

      if(TakeProfit>0 && TakeProfit*pip>MarketInfo(simbol,MODE_STOPLEVEL))
        {
         TPB=MarketInfo(simbol,MODE_ASK)+(TakeProfit*pip)*point;
         TPS=MarketInfo(simbol,MODE_BID)-(TakeProfit*pip)*point;
        }

      if((TakeProfit==0)|| (TakeProfit*pip<=MarketInfo(simbol,MODE_STOPLEVEL)))
        {
         TPB=0;
         TPS=0;
        }

      if(ReadyOpen && OpenOrders1==0 && dnNearestOrder(simbol,OP_BUY,MagicNumber_Buy)>Order_Distance*pip*point && Filter_TIme()  && XXX=="BUY" && iVolume(simbol,0,0)<last_vol /*&& Filter_Trial() */)
         if(AccountFreeMargin() <MarketInfo(simbol,MODE_MARGINREQUIRED)*AutoLot())
           {
            Print("No Enougt Money to Open NextOrder or Volume size is Over Maximum Lot.");// Please reset this EA by change your Magic Number");
            return;
           }
         else
           {
            if(!BrokerIsECN)
               ord_send=OrderSend(simbol,0,AutoLot(),MarketInfo(simbol,MODE_ASK),slippage*pip,SLB,TPB,comment,MagicNumber_Buy,0,Blue);
            if(BrokerIsECN)
              {
               ord_send = 0;
               ord_send=OrderSend(simbol,0,AutoLot(),MarketInfo(simbol,MODE_ASK),slippage*pip,0,0,comment,MagicNumber_Buy,0,Blue);
               if(ord_send > 0)
                 {
                  bool seleksi = OrderSelect(ord_send,SELECT_BY_TICKET);
                  if(TPB > 0.0 && SLB > 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLB, TPB, OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN SL/TP  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                  if(TPB != 0.0 && SLB == 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), OrderStopLoss(), TPB, OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN TP  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                  if(TPB == 0.0 && SLB != 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLB, OrderTakeProfit(), OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN SL  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                 }
              }
            return;
           }

      if(ReadyOpen && OpenOrders2==0 &&  dnNearestOrder(simbol,OP_SELL,MagicNumber_Sell)>Order_Distance*pip*point && Filter_TIme() &&YYY=="SELL" && iVolume(simbol,0,0)<last_vol /*&& Filter_Trial() */)
         if(AccountFreeMargin() <MarketInfo(simbol,MODE_MARGINREQUIRED)*AutoLot())
           {
            Print("No Enougt Money to Open NextOrder or Volume size is Over Maximum Lot.");// Please reset this EA by change your Magic Number");
            return;
           }
         else
           {
            if(!BrokerIsECN)
               ord_send= OrderSend(simbol,1,AutoLot(),MarketInfo(simbol,MODE_BID),slippage*pip,SLS,TPS,comment,MagicNumber_Sell,0,Red);
            if(BrokerIsECN)
              {
               ord_send = 0;
               ord_send= OrderSend(simbol,1,AutoLot(),MarketInfo(simbol,MODE_BID),slippage*pip,0,0,comment,MagicNumber_Sell,0,Red);
               if(ord_send > 0)
                 {
                  bool seleksi = OrderSelect(ord_send,SELECT_BY_TICKET);
                  if(TPS > 0.0 && SLS > 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLS, TPS, OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN SL/TP  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                  if(TPS != 0.0 && SLS == 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), OrderStopLoss(), TPS, OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN TP  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                  if(TPS == 0.0 && SLS != 0.0)
                    {
                     while(IsTradeContextBusy())
                        Sleep(100);
                     bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLS, OrderTakeProfit(), OrderExpiration(), CLR_NONE);
                     if(!bool_60)
                       {
                        int error_64 = GetLastError();
                        Print(Symbol(), " ||=========================> ECN SL  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                       }
                    }
                 }
              }

            return;
           }

      if(OpenBuy>0)
        {
         Lot_MultiB= NormalizeDouble(x_vol*Multiplier,Lot_Digits);
        }

      Martin_SLB=SLB_PRICE;
      Martin_SLS= SLS_PRICE;

      if(MartingaleTrade_ON)
        {
         if(OpenBuy>0 && OpenBuy<MaxTrades_EachSide &&  X_Distance())
            if(AccountFreeMargin() <MarketInfo(simbol,MODE_MARGINREQUIRED)*Lot_Multi1())
              {
               Print("No Enougt Money to Open NextOrder or Volume size is Over Maximum Lot.");
               return;
              }
            else
              {
               if(!BrokerIsECN)
                  ord_send=OrderSend(simbol,OP_BUY,Lot_Multi1(),MarketInfo(simbol,MODE_ASK),slippage*pip,SLB_PRICE,0,comment,MagicNumber_Buy,0,Aqua);
               if(BrokerIsECN)
                 {
                  ord_send = 0;
                  ord_send=OrderSend(simbol,OP_BUY,Lot_Multi1(),MarketInfo(simbol,MODE_ASK),slippage*pip,0,0,comment,MagicNumber_Buy,0,Aqua);
                  if(ord_send > 0)
                    {
                     bool seleksi = OrderSelect(ord_send,SELECT_BY_TICKET);
                     if(SLB_PRICE != 0.0)
                       {
                        while(IsTradeContextBusy())
                           Sleep(100);
                        bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLB_PRICE, OrderTakeProfit(), OrderExpiration(), CLR_NONE);
                        if(!bool_60)
                          {
                           int error_64 = GetLastError();
                           Print(Symbol(), " ||=========================> ECN SL  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                          }
                       }
                    }
                 }
              }

         if(OpenSell>0  && OpenSell<MaxTrades_EachSide && Y_Distance())
            if(AccountFreeMargin() <MarketInfo(simbol,MODE_MARGINREQUIRED)*Lot_Multi2())
              {
               Print("No Enougt Money to Open NextOrder or Volume size is Over Maximum Lot.");
               return;
              }
            else
              {
               if(!BrokerIsECN)
                  ord_send=OrderSend(simbol,OP_SELL,Lot_Multi2(),MarketInfo(simbol,MODE_BID),slippage*pip,SLS_PRICE,0,comment,MagicNumber_Sell,0,Magenta);
               if(BrokerIsECN)
                 {
                  ord_send = 0;
                  ord_send=OrderSend(simbol,OP_SELL,Lot_Multi2(),MarketInfo(simbol,MODE_BID),slippage*pip,0,0,comment,MagicNumber_Sell,0,Magenta);
                  if(ord_send > 0)
                    {
                     bool seleksi = OrderSelect(ord_send,SELECT_BY_TICKET);
                     if(SLS_PRICE != 0.0)
                       {
                        while(IsTradeContextBusy())
                           Sleep(100);
                        bool bool_60 = OrderModify(ord_send, OrderOpenPrice(), SLS_PRICE, OrderTakeProfit(), OrderExpiration(), CLR_NONE);
                        if(!bool_60)
                          {
                           int error_64 = GetLastError();
                           Print(Symbol(), " ||=========================> ECN SL  order modify failed with error(", error_64, "): ", ErrorDescription(error_64));
                          }
                       }
                    }
                 }
              }

        }

      TSP=(TrailingStep+Trailing_Stop)*pip;
      if(Trailing_Stop_ON)
        {
         for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
           {
            Select=OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
            if(OrderSymbol()==simbol && OrderMagicNumber() == MagicNumber)
              {
               if(OrderType()==OP_BUY && OpenOrders1==1)
                 {
                  if(Trailing_Stop>0 && Trailing_Stop*pip>MarketInfo(simbol,MODE_STOPLEVEL))
                    {
                     if(MarketInfo(simbol,MODE_BID)-OrderOpenPrice()>=point*Trailing_Stop*pip)
                       {
                        if((OrderStopLoss()<= MarketInfo(simbol,MODE_BID)-point*TSP)|| (OrderStopLoss()==0))
                          {
                           Modif=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(simbol,MODE_BID)-(point*Trailing_Stop*pip),OrderTakeProfit(),0,Lime);
                           return;
                          }
                       }
                    }
                 }
               else
                  if(OrderType()==OP_SELL && OpenOrders2==1)
                    {
                     if(Trailing_Stop>0 && Trailing_Stop*pip>MarketInfo(simbol,MODE_STOPLEVEL))
                       {
                        if((OrderOpenPrice()-MarketInfo(simbol,MODE_ASK))>=point*Trailing_Stop*pip)
                          {
                           if((OrderStopLoss()>=MarketInfo(simbol,MODE_ASK)+ point*TSP)  || (OrderStopLoss()==0))
                             {
                              Modif=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(simbol,MODE_ASK)+(point*Trailing_Stop*pip),OrderTakeProfit(),0,Red);
                              return;
                             }
                          }
                       }
                    }
              }
           }
        }

      if(OpenBuy>0)
        {
         BEP_XXX= NormalizeDouble((MarketInfo(simbol,MODE_BID)-avg_xx*point),DIGITS);
         TPB_ALL=NormalizeDouble((BEP_XXX+(Average_TP*pip*point)),DIGITS);
        }

      if(OpenSell>0)
        {
         BEP_YYY= NormalizeDouble((MarketInfo(simbol,MODE_ASK)+avg_yy*point),DIGITS);
         TPS_ALL=NormalizeDouble((BEP_YYY - (Average_TP*pip*point)),DIGITS);
        }


      if(Average_ALL==true && Average_TP>0)
        {
         // cnt=0;
         for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
           {
            select=OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==simbol && OrderMagicNumber()==MagicNumber_Sell)
              {
               if(OrderType()==OP_SELL && OpenSell>1&& TPS_PRICE==0)
                 {
                  modif=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble((BEP_YYY - (Average_TP*pip*point)),DIGITS),0,Yellow);
                 }
              }
           }
        }

      if(Average_ALL==true && Average_TP>0)
        {
         cnt=0;
         for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
           {
            select=OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==simbol && OrderMagicNumber()==MagicNumber_Buy)
              {
               if(OrderType()==OP_BUY && OpenBuy>1  && TPB_PRICE==0)
                 {
                  modif=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble((BEP_XXX+(Average_TP*pip*point)),DIGITS),0,Yellow);
                 }

              }

           }
        }

      //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM


      if(Hidden_TP==true)
        {
         for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
           {
            select= OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

            if(OrderSymbol()==simbol && OrderMagicNumber() == MagicNumber_Sell)
              {
               if((OrderType()==OP_SELL && OpenSell==1&& MarketInfo(simbol,MODE_ASK)<=Sell_Price-hidden_takeprofit*pip*point)
                  || (OrderType()==OP_SELL && OpenSell>1  && MarketInfo(simbol,MODE_ASK)<=BEP_YYY-Average_HTP*pip*point))
                 {
                  ord_close=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red);
                 }
              }
           }
        }

      //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||

      if(Hidden_TP==true)
        {
         for(cnt=OrdersTotal()-1; cnt>=0; cnt--)
           {
            select= OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
            if(OrderSymbol()==simbol && OrderMagicNumber() == MagicNumber_Buy)
              {
               if((OrderType()==OP_BUY   &&OpenBuy==1 && MarketInfo(simbol,MODE_BID)>=Buy_Price+hidden_takeprofit*pip*point)
                  || (OrderType()==OP_BUY   &&OpenBuy>1 && MarketInfo(simbol,MODE_BID)>=BEP_XXX+Average_HTP*pip*point))

                 {
                  ord_close=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);
                 }
              }
           }
        }

      //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||

      //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||
      /*
      if ( Filter_Trial()==false && Filter_Time_For_Trial==true )

           {
         string_window( "EA Trial", 5, 5, 0);
         ObjectSetText( "EA Trial",trial_version , 15, "Impact", Red);
         ObjectSet( "EA Trial", OBJPROP_CORNER,0);

         string_window( "EA Trial2", 5, 25, 0);
         ObjectSetText( "EA Trial2", trial_version2  +Trial_Time , 15, "Impact", Blue);
         ObjectSet( "EA Trial2", OBJPROP_CORNER,0);

           }
          else{ ObjectDelete("EA Trial"); ObjectDelete("EA Trial2"); }

      */

      if(iVolume(simbol,0,0)%2==0)
         clr_price= clrLime;
      else
         clr_price= clrRed;
      if(AccountEquity()> AccountBalance())
         clr_eq= clrBlue;
      else
         clr_eq= clrMagenta;
      Range =NormalizeDouble((iHigh(simbol,1440,0)- iLow(simbol,1440,0))/point/pip,2);
      Spread= (MarketInfo(simbol,MODE_ASK)-MarketInfo(simbol,MODE_BID))/point;
      if(ACCOUNT_INFO /*&& simbol == Symbol()*/)
        {

         string_window("hari", 5, 18, 0);  //
         ObjectSetText("hari",hari +", "+DoubleToStr(Day(),0)+" - "+DoubleToStr(Month(),0) +" - "
                       +DoubleToStr(Year(),0)+" "+IntegerToString(Hour())+":"+IntegerToString(Minute())+":"+IntegerToString(Seconds()),text_size+1, "Impact", Yellow);
         ObjectSet("hari", OBJPROP_CORNER,text_corner);

         string_window("Balance", 5, 15+20, 0);  //
         ObjectSetText("Balance","Balance   : " +DoubleToStr(AccountBalance(),2), text_size, "Cambria", color_text);
         ObjectSet("Balance", OBJPROP_CORNER,text_corner);

         string_window("Equity", 5, 30+20, 0);  //
         ObjectSetText("Equity","Equity     : " + DoubleToStr(AccountEquity(),2), text_size, "Cambria", clr_eq);
         ObjectSet("Equity", OBJPROP_CORNER, text_corner);

         string_window("AF", 5, 65, 0);  //
         ObjectSetText("AF","Free Margin     : " + DoubleToStr(AccountFreeMargin(),2), text_size, "Cambria", clr_eq);
         ObjectSet("AF", OBJPROP_CORNER, text_corner);
         /*
         string_window( "Leverage", 5,60+20, 0);
         ObjectSetText( "Leverage","Leverage   : " + DoubleToStr(AccountLeverage(),0), text_size, "Cambria", color_text);
          ObjectSet( "Leverage", OBJPROP_CORNER, text_corner);
         */
         Spread =NormalizeDouble((MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID))/Point,2);
         string_window("Spread", 5,60+20, 0);
         ObjectSetText("Spread","Spread   : " + DoubleToStr(Spread,1), text_size, "Cambria", color_text);
         ObjectSet("Spread", OBJPROP_CORNER, text_corner);
         Range =NormalizeDouble((iHigh(Symbol(),1440,0)- iLow(Symbol(),1440,0))/point/pip,2);
         string_window("Range", 5, 75+20, 0);  //
         ObjectSetText("Range","Range : " + DoubleToStr(Range,1), text_size, "Cambria", color_text);
         ObjectSet("Range", OBJPROP_CORNER, text_corner);

         string_window("Price", 5, 120, 0);  //
         ObjectSetText("Price","Price : " + DoubleToStr(MarketInfo(Symbol(),MODE_BID),DIGITS), text_size, "Cambria", clr_price);
         ObjectSet("Price", OBJPROP_CORNER, text_corner);


         if(OpenSell>0)
           {
            string_window("sell", 5, 155, 0);  //
            ObjectSetText("sell","Sell Order : " + DoubleToStr(OpenSell,0) +" | Sell Lot : "  + DoubleToStr(total_yv,2)
                          , text_size, "Cambria", color_text);
            ObjectSet("sell", OBJPROP_CORNER, text_corner);

           }
         else
           {
            ObjectDelete("Tps");
            ObjectDelete("SLs");
            ObjectDelete("sell");
           }

         if(OpenBuy>0)
           {
            string_window("buy", 5, 140, 0);  //
            ObjectSetText("buy","Buy Order : " + DoubleToStr(OpenBuy,0)  +" |Buy Lot : " + DoubleToStr(total_xv,2)
                          , text_size, "Cambria", color_text);
            ObjectSet("buy", OBJPROP_CORNER, text_corner);
           }
         else
           {
            ObjectDelete("Tp");
            ObjectDelete("SL");
            ObjectDelete("buy");
           }
         /*
         string_window( "Profit", 5, 170, 0);
         ObjectSetText( "Profit", "Buy Profit : " +DoubleToStr( total_xp,2) + " | Sell Profit : " +DoubleToStr( total_yp,2) , text_size, "Cambria", clr_eq);
         ObjectSet( "Profit", OBJPROP_CORNER, text_corner);

         string_window( "MX", 5, 185, 0);
         ObjectSetText( "MX", "Min Lot : " +DoubleToStr( MinLot,Lot_Digits) + " | Max Lot : " +DoubleToStr( MaxLot,0) , text_size, "Cambria", clr_eq);
         ObjectSet( "MX", OBJPROP_CORNER, text_corner);
         */
         string_window("EA_NAME", 5, 5, 0);
         ObjectSetText("EA_NAME",EA_NAME, text_size+3, "Impact", clr_eq);
         ObjectSet("EA_NAME", OBJPROP_CORNER, 3);
        }
     }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
   return;
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
void CleanUp()
  {
   ObjectDelete("EA_NAME");
   ObjectDelete("expiredlabel");
   ObjectDelete("expiredlabel");
   ObjectDelete("Contact_Me");
   ObjectDelete("Key_Word2");
   ObjectDelete("Key_Word1");

   ObjectDelete("Spread");
   ObjectDelete("Leverage");
   ObjectDelete("Equity");
   ObjectDelete("Balance");
   ObjectDelete("Price");
   ObjectDelete("Profit");
   ObjectDelete("EA Trial");
   ObjectDelete("Trade_Mode");
   ObjectDelete("Lot");
   ObjectDelete("EnterLot");
   ObjectDelete("Spread");
   ObjectDelete("EA Expired");
   ObjectDelete("Range");
   ObjectDelete("hari");
   ObjectDelete("sell");
   ObjectDelete("Tps");
   ObjectDelete("SLs");
   ObjectDelete("SL");
   ObjectDelete("Tp");
   ObjectDelete("buy");
   ObjectDelete("BEP_XXX");
   ObjectDelete("BEP_XXX2");
   ObjectDelete("Check_Info");
   ObjectDelete("AF");
   ObjectDelete("MX");
   ObjectDelete("Diff_B");
   ObjectDelete("Total_Profit_X");
   ObjectDelete("Diff_S");
   ObjectDelete("Total_Profit_Y");
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
int string_window(string n, int xoff, int yoff, int WindowToUse)
  {
   ObjectCreate(n, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSet(n, OBJPROP_CORNER, 1);
   ObjectSet(n, OBJPROP_XDISTANCE, xoff);
   ObjectSet(n, OBJPROP_YDISTANCE, yoff);
   ObjectSet(n, OBJPROP_BACK, true);
   return (0);
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
double Lots,MinLot,MaxLot;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double AutoLot()
  {
   Lots=FixLot;
   if(Lots<MinLot)
      Lots=MinLot;
   if(Lots>MaxLot)
      Lots=MaxLot;


   if(Autolot==true)
     {



      Lots= CalculateLots(simbol);

      if(Lots<MinLot)
         Lots=MinLot;
      if(Lots>MaxLot)
         Lots=MaxLot;
     }
   return(Lots);
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
double Lot_Multi1()
  {

   Lot_MultiB= NormalizeDouble(AutoLot(),Lot_Digits);//NormalizeDouble((AccountBalance()/100000)*AutoMM,Lot_Digits);
   if(Lot_MultiB<MinLot)
      Lot_MultiB=MinLot;
   if(Lot_MultiB>MaxLot)
      Lot_MultiB=MaxLot;
   if(Multiplier<1.5)
     {
      if(OpenBuy==1)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier,Lot_Digits);
        }

      if(OpenBuy==2)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenBuy==3)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==4)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==5)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==6)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }


      if(OpenBuy==7)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenBuy==8)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==9)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==10)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==11)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==12)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==13)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenBuy==14)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==15)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==16)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenBuy==17)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenBuy==18)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenBuy==19)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenBuy==20)
        {
         Lot_MultiB= NormalizeDouble(Lot_MultiB*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenBuy>20)
        {
         Lot_MultiB= NormalizeDouble(x_vol*Multiplier,Lot_Digits);
        }

      if(Lot_MultiB >MaxLot)
         Lot_MultiB=MaxLot;
      if(Lot_MultiB <MinLot)
         Lot_MultiB=MinLot;
     }

   if(Multiplier>=1.5)
     {

      if(OpenBuy>0)
        {
         Lot_MultiB= NormalizeDouble(x_vol*Multiplier,Lot_Digits);
        }

      if(Lot_MultiB >MaxLot)
         Lot_MultiB=MaxLot;
      if(Lot_MultiB <MinLot)
         Lot_MultiB=MinLot;
     }

   return (Lot_MultiB);
  }

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
double Lot_Multi2()
  {

   Lot_MultiS= NormalizeDouble(AutoLot(),Lot_Digits);//NormalizeDouble((AccountBalance()/100000)*AutoMM,Lot_Digits);
   if(Lot_MultiS<MinLot)
      Lot_MultiS=MinLot;
   if(Lot_MultiS>MaxLot)
      Lot_MultiS=MaxLot;

   if(Multiplier<1.5)
     {
      if(OpenSell==1)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier,Lot_Digits);
        }

      if(OpenSell==2)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenSell==3)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==4)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==5)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==6)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }


      if(OpenSell==7)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenSell==8)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==9)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==10)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==11)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==12)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==13)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenSell==14)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==15)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell==16)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenSell==17)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }
      if(OpenSell==18)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier,Lot_Digits);
        }


      if(OpenSell==19)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier,Lot_Digits);
        }

      if(OpenSell==20)
        {
         Lot_MultiS= NormalizeDouble(Lot_MultiS*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier*Multiplier*Multiplier*Multiplier*Multiplier
                                     *Multiplier*Multiplier,Lot_Digits);
        }

      if(OpenSell>20)
        {
         Lot_MultiS= NormalizeDouble(y_vol*Multiplier,Lot_Digits);
        }

      if(Lot_MultiS >MaxLot)
         Lot_MultiS=MaxLot;
      if(Lot_MultiS <MinLot)
         Lot_MultiS=MinLot;
     }
   if(Multiplier>=1.5)
     {
      if(OpenSell>0)
        {
         Lot_MultiS= NormalizeDouble(y_vol*Multiplier,Lot_Digits);
        }

      if(Lot_MultiS >MaxLot)
         Lot_MultiS=MaxLot;
      if(Lot_MultiS <MinLot)
         Lot_MultiS=MinLot;
     }


   return (Lot_MultiS);
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
bool Filter_TIme()
  {
   if(Filter_TradingTime)
     {

      if(TimeCurrent()>=StrToTime(Time_Start) && TimeCurrent()<StrToTime(Time_End))

        {return true; }

      else
        {
         return false;

        }

     }

   return true;

  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
bool X_Distance()
  {
   if(Filter_Min_Distance_ON)
     {

      double point = MarketInfo(simbol,MODE_POINT);

      if(MarketInfo(simbol,MODE_ASK) <=Buy_Price-Step*pip *point)    // && Time[0]-xtime>0 && iVolume(simbol,0,0)<10)

         return true;
      else
         return false;
     }

   return true;
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool Y_Distance()
  {

   if(Filter_Min_Distance_ON)
     {
      double point = MarketInfo(simbol,MODE_POINT);

      if(MarketInfo(simbol,MODE_BID) >=Sell_Price+Step*pip *point)   // && Time[0]-ytime>0 && iVolume(simbol,0,0)<10)
         return true;
      else
         return false;
     }
   return true;
  }
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
/*
bool Filter_Trial()
{
   if(Filter_Time_For_Trial )
   {
      if (TimeCurrent()<=StrToTime(Trial_Time)) return true;
      else return false;
   }
   return true;
}
*/
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void append(string symbol)
  {
   pairs++;
   ArrayResize(symb, pairs);
   symb[pairs-1] = symbol+suffix;
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double CalculateLots(string symbol)
  {
   double MaxLots = MarketInfo(symbol, MODE_MAXLOT);
   double MinLots = MarketInfo(symbol, MODE_MINLOT);
//double Leverages = AccountLeverage();
   double lots;
//if(Leverages < 500) {
//   lots = AccountBalance() / 500; // Microlots as whole number
//} else {
   lots = AccountBalance() * Percentuale / 1000; /// 20; // Microlots as whole number
//}
   lots=MathFloor(lots); // round down to nearest whole number
   lots*=0.01; // convert microlots to digits
   if(lots > MaxLots)
      lots = MaxLots;
   if(lots > MaxLots)
      lots = MaxLots;
   int lotdigits = DefineLotDigits(symbol);
   lots = NormalizeDouble(lots,lotdigits);
   return(lots);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int DefineLotDigits(string symbol)
  {
   double LotStep = MarketInfo(symbol, MODE_LOTSTEP);
   int LotDigits;
   if(LotStep >= 1)
      LotDigits = 0;
   else
      if(LotStep >= 0.1)
         LotDigits = 1;
      else
         if(LotStep >= 0.01)
            LotDigits = 2;
         else
            LotDigits = 3;
   return(LotDigits);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double dnNearestOrder(string symbol,int ordertype,int Magic)
  {
   double result=0,subresult=0,subresult1=100,subresult2=100,price=0,
          nearestup=0,nearestdown=0;
   int ordertotal=OrdersHistoryTotal();

   for(int count=ordertotal-1; count>=0; count--)
     {
      if(!OrderSelect(count,SELECT_BY_POS,MODE_HISTORY) || OrderMagicNumber() != Magic || OrderSymbol() != symbol)
         continue;
      double openprice=OrderOpenPrice();
      double p_open=NormalizeDouble(openprice,(int)MarketInfo(symbol,MODE_DIGITS));
      double ask=NormalizeDouble(MarketInfo(symbol,MODE_ASK),(int)MarketInfo(symbol,MODE_DIGITS));
      double bid=NormalizeDouble(MarketInfo(symbol,MODE_BID),(int)MarketInfo(symbol,MODE_DIGITS));
      if(ordertype==OP_BUY)
         price=ask;
      if(ordertype==OP_SELL)
         price=bid;
      if(price>p_open)
        {
         if(nearestdown<=0)
            nearestdown=p_open;
         if(nearestdown>0 && p_open>nearestdown)
            nearestdown=p_open;
         subresult1=price-nearestdown;
        }
      if(price<=p_open)
        {
         if(nearestup<=0)
            nearestup=p_open;
         if(nearestup>0 && p_open<nearestup)
            nearestup=p_open;
         subresult2=nearestup-price;
        }
     }
   subresult=MathMin(subresult1,subresult2);
   result=NormalizeDouble(subresult,(int)MarketInfo(symbol,MODE_DIGITS));
   return(result);
  }
//+------------------------------------------------------------------+