//+------------------------------------------------------------------+
//|                                            @Account Balnce.mq4   |
//|                                                                  |
//+------------------------------------------------------------------+
#property indicator_chart_window

extern bool Corner_of_Chart_RIGHT_TOP = true;
extern int Shift_UP_DN =20; 
extern int Adjust_Side_to_side  = 5;
extern int MA_Period = 5;
extern int MA_Method = 0;
extern int Applied_Price = 0;

extern bool Show_Price = true;
extern bool Show_Xtra_Details = true;
extern bool Show_Account_Balance = true;
extern int OrderProfitAlert = 100;

extern color BarLabel_color = DimGray;

color CommentLabel_color;
double PipFactor, Pip;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   CommentLabel_color = BarLabel_color;
   
   PipFactor = 1;
   if (Digits == 3 || Digits == 5)
      PipFactor = 10;
   Pip = PipFactor * Point;
      

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_LABEL); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
   int L_height = 15;
   int Y_base = 0;  

   
//*****************************************************************************************************
// Information
// --- Price
   
   string PRC1, MA, PIP_DIV, PERCENT_DIV, CHANGE;

   double Price1 = iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0);   
   double Ma = iMA(Symbol(),0,MA_Period,0,MA_Method,Applied_Price,0);
   PRC1 = DoubleToStr(Price1, Digits);
   MA = DoubleToStr(Ma, Digits);
   if (Digits > 3) {
      PIP_DIV = DoubleToStr((Price1 - Ma) / Pip, Digits-4);
   }
   else {
      PIP_DIV = DoubleToStr((Price1 - Ma) / Pip, Digits-2);
   }
   PERCENT_DIV = DoubleToStr((Price1 - Ma)/Ma*100, 3) + "%";

   double Change = 100 * (Price1 - iClose(NULL,PERIOD_D1,1)) / iClose(NULL,PERIOD_D1,1);
   CHANGE = DoubleToStr(Change,3);
    
   if (Show_Price  == true) {
      if (Price1 >= Ma) color color_price = Lime;
      else color_price = OrangeRed;      
      ObjectCreate("Signalprice", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Signalprice",""+PRC1+"", 24, "Arial",  color_price);
      ObjectSet("Signalprice", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("Signalprice", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("Signalprice", OBJPROP_YDISTANCE, 0+Shift_UP_DN); 

      ObjectCreate("PriceLabel", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("PriceLabel","PRICE", 10, "Arial",  CommentLabel_color);
      ObjectSet("PriceLabel", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("PriceLabel", OBJPROP_XDISTANCE, 129+Adjust_Side_to_side);
      ObjectSet("PriceLabel", OBJPROP_YDISTANCE, 15+Shift_UP_DN); 

      ObjectCreate("Signalma", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Signalma",""+MA+"", 24, "Arial",  Blue);
      ObjectSet("Signalma", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("Signalma", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("Signalma", OBJPROP_YDISTANCE, 30+Shift_UP_DN); 

      ObjectCreate("MaLabel", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MaLabel","MA("+MA_Period+")", 10, "Arial",  CommentLabel_color);
      ObjectSet("MaLabel", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MaLabel", OBJPROP_XDISTANCE, 129+Adjust_Side_to_side);
      ObjectSet("MaLabel", OBJPROP_YDISTANCE, 45+Shift_UP_DN); 

      ObjectCreate("PipDiv", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("PipDiv","Pip Diviation", 10, "Arial",  CommentLabel_color);
      ObjectSet("PipDiv", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("PipDiv", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("PipDiv", OBJPROP_YDISTANCE, 70+Shift_UP_DN); 

      ObjectCreate("PcnDiv", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("PcnDiv","% Diviation", 10, "Arial",  CommentLabel_color);
      ObjectSet("PcnDiv", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("PcnDiv", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("PcnDiv", OBJPROP_YDISTANCE, 85+Shift_UP_DN); 

      ObjectCreate("PIP_DIV", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("PIP_DIV",""+PIP_DIV+"", 10, "Arial",  CommentLabel_color);
      ObjectSet("PIP_DIV", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("PIP_DIV", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("PIP_DIV", OBJPROP_YDISTANCE, 70+Shift_UP_DN); 

      ObjectCreate("PERCENT_DIV", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("PERCENT_DIV",""+PERCENT_DIV+"", 10, "Arial",  CommentLabel_color);
      ObjectSet("PERCENT_DIV", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("PERCENT_DIV", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("PERCENT_DIV", OBJPROP_YDISTANCE, 85+Shift_UP_DN); 
      
      Y_base = 100;
   }

//*****************************************************************
// --- Detailed infomation
        
   if (Show_Xtra_Details == true) {
      int R1=0,R5=0,R10=0,R20=0,RAvg=0,i=0;
      R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Pip;
      for(i=1;i<=5;i++)
         R5    =    R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Pip;
      for(i=1;i<=10;i++)
         R10   =    R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Pip;
      for(i=1;i<=20;i++)
         R20   =    R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Pip;

      R5 = R5/5;
      R10 = R10/10;
      R20 = R20/20;
      RAvg  =  (R1+R5+R10+R20)/4;    
   
      string HI="",LO="",SPREAD="",PIPS="",DAV="",HILO="",PRC,Pips="",Av="",AV_Yest="";
      color color_pip,color_av;
      double OPEN = iOpen(NULL,1440,0);
      double CLOSE = iClose(NULL,1440,0);
      double SPRD = (Ask - Bid)/Pip;
      double High_Today = iHigh(NULL,1440,0);
      double Low_Today = iLow(NULL,1440,0);
      if (Digits > 3) {
         PIPS     = DoubleToStr((CLOSE-OPEN)/Pip,Digits-4);
         SPREAD   = (DoubleToStr(SPRD,Digits-4));
         DAV      = (DoubleToStr(RAvg,Digits-4));
         AV_Yest  = (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Pip;
         HILO     = DoubleToStr((High_Today-Low_Today)/Pip,Digits-4);
      }
      else {
         PIPS     = DoubleToStr((CLOSE-OPEN)/Pip,Digits-2);
         SPREAD   = (DoubleToStr(SPRD,Digits-2));
         DAV      = (DoubleToStr(RAvg,Digits-2));
         AV_Yest  = (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Pip;
         HILO     = DoubleToStr((High_Today-Low_Today)/Pip,Digits-2);
      }  
      if (CLOSE >= OPEN) {Pips= "-";color_pip = Lime; }
      if (CLOSE < OPEN) {Pips= "-";color_pip = OrangeRed; }
      if (DAV > AV_Yest) {Av= "-";color_av = Lime; }
      if (DAV < AV_Yest) {Av= "-";color_av = OrangeRed; }
     
      ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS7","Spread", 10, "Arial", CommentLabel_color);
      ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN); 

      ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS8",""+SPREAD+"", 10, "Arial Bold", Gold);
      ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN);  

  
      ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS9","Pips to Open", 10, "Arial", CommentLabel_color);
      ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN); 

      ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS10",""+PIPS+"", 10, "Arial Bold", color_pip);
      ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN);  
   
      ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS11","Hi to Low", 10, "Arial", CommentLabel_color);
      ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN); 

      ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS12",""+HILO+"", 10, "Arial Bold", Gold);
      ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN);  

      ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS13","Daily Av", 10, "Arial",CommentLabel_color);
      ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, Y_base+L_height*3+Shift_UP_DN); 

      ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS14",""+DAV+"", 10, "Arial Bold", color_av);
      ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, Y_base+L_height*3+Shift_UP_DN); 

      ObjectCreate("MMLEVELS15", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS15","Change", 10, "Arial",CommentLabel_color);
      ObjectSet("MMLEVELS15", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS15", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("MMLEVELS15", OBJPROP_YDISTANCE, Y_base+L_height*4+Shift_UP_DN); 

      ObjectCreate("MMLEVELS16", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("MMLEVELS16",""+CHANGE+"%", 10, "Arial Bold", color_pip);
      ObjectSet("MMLEVELS16", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("MMLEVELS16", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("MMLEVELS16", OBJPROP_YDISTANCE, Y_base+L_height*4+Shift_UP_DN); 

//*****************************************************************
//Time to bar expiry
      double s1[];
	   double g;
      int d = 0,h = 0, m, s, k;
      m=Time[0]+Period()*60-CurTime();
      g=m/60.0;
      s=m%60;
      m=(m-m%60)/60;
      if (m > 59) {
         h = m / 60;
         m = m % 60;
      }
      if (h > 23) {
         d = h / 24;
         h = h % 24;
      }
   //   Comment("\n" + m + "'" + s + "'' to next bar");
      g=NormalizeDouble(g,1);
      for (k=1;k<=Bars-1;k++) s1[k]=0.0000001;
      for (k=1;k<=2;k++) s1[k]=g;

      if (Period() <=240) {
         ObjectCreate("X602", OBJ_LABEL, 0, 0, 0);
         if (h > 0)
            ObjectSetText("X602",DoubleToStr(h,-3) + ": " + DoubleToStr(m,-3)+ "' " + DoubleToStr(s,-3) + "''", 10, "Arial Bold", Blue);
         if (h <= 0)   
            ObjectSetText("X602",DoubleToStr(m,-3)+ "' " + DoubleToStr(s,-3) + "''", 10, "Arial Bold", Blue);
         ObjectSet("X602", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("X602", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
         ObjectSet("X602", OBJPROP_YDISTANCE, Y_base+L_height*5+Shift_UP_DN);
   
         ObjectCreate("X603", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("X603","Next Bar", 10, "Arial", CommentLabel_color);
         ObjectSet("X603", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("X603", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
         ObjectSet("X603", OBJPROP_YDISTANCE, Y_base+L_height*5+Shift_UP_DN); 
      }
      Y_base += L_height*6;
   }

//*****************************************************************
//---- Account Information
   if (Show_Account_Balance) {
      ObjectCreate("AB", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AB","Acct Balance", 10, "Arial", CommentLabel_color);
      ObjectSet("AB", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AB", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("AB", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN); 

      ObjectCreate("AB_value", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AB_value",DoubleToStr(AccountBalance(),2), 10, "Arial", Gold);
      ObjectSet("AB_value", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AB_value", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("AB_value", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN);  

      ObjectCreate("AE", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AE","Acct Equity", 10, "Arial", CommentLabel_color);
      ObjectSet("AE", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AE", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("AE", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN); 

      ObjectCreate("AE_value", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AE_value",DoubleToStr(AccountEquity(),2), 10, "Arial", Gold);
      ObjectSet("AE_value", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AE_value", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("AE_value", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN);  
   
      ObjectCreate("AP", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AP","Acct Profit", 10, "Arial", CommentLabel_color);
      ObjectSet("AP", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AP", OBJPROP_XDISTANCE, 89+Adjust_Side_to_side);
      ObjectSet("AP", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN); 

      ObjectCreate("AP_Value", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("AP_Value",DoubleToStr(AccountProfit(),2), 10, "Arial", Gold);
      ObjectSet("AP_Value", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("AP_Value", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("AP_Value", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN);  

      Y_base += L_height*3;

   }
//*****************************************************************
//---- Order Profit Information
   if (OrderProfitAlert > 0) {
      int CountAlert = 0;
      int Count618 = 0;
      int Count382 = 0;
      Comment ("Order Profit Target = 100");
      ObjectCreate("OpAlert", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("OpAlert","Order Profit Target", 10, "Arial", CommentLabel_color);
      ObjectSet("OpAlert", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("OpAlert", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
      ObjectSet("OpAlert", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN); 

      ObjectCreate("OpAlert_v", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("OpAlert_v",DoubleToStr(OrderProfitAlert,0), 10, "Arial", CommentLabel_color);
      ObjectSet("OpAlert_v", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
      ObjectSet("OpAlert_v", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
      ObjectSet("OpAlert_v", OBJPROP_YDISTANCE, Y_base+Shift_UP_DN);  

      for (int pos = 0; pos < OrdersTotal(); pos++) {
         if (OrderSelect(pos, SELECT_BY_POS)) {
            Comment(OrderProfit());
            if (OrderProfit() >= 0.382 * OrderProfitAlert * PipFactor) Count382++;
            if (OrderProfit() >= 0.618 * OrderProfitAlert * PipFactor) {Count618++; Count382--;}
            if (OrderProfit() >= OrderProfitAlert * PipFactor) {
               CountAlert++;
               Count618--;
               PlaySound("alert.wav");
               ObjectCreate("ProftAlert", OBJ_LABEL, 0, 0, 0);
               ObjectSetText("ProftAlert",""+OrderSymbol()+" profit: "+DoubleToStr(OrderProfit(),Digits), 36, "Arial",  Gold);
               ObjectSet("ProftAlert", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
               ObjectSet("ProftAlert", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
               ObjectSet("ProftAlert", OBJPROP_YDISTANCE, Y_base+L_height*6+Shift_UP_DN); 
               Sleep(500);
               ObjectDelete("ProftAlert");
               Sleep(118);
            }
         }
      }

      int TotalTarget = CountAlert;
      int Total618 = Count618;
      int Total382 = Count382;
      
      if (TotalTarget > 0) {
         ObjectCreate("RPT", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("RPT","Reached Profit Target", 10, "Arial", CommentLabel_color);
         ObjectSet("RPT", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("RPT", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
         ObjectSet("RPT", OBJPROP_YDISTANCE, Y_base+L_height*3+Shift_UP_DN); 

         ObjectCreate("RPTv", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("RPTv",DoubleToStr(TotalTarget,0), 10, "Arial", Blue);
         ObjectSet("RPTv", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("RPTv", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
         ObjectSet("RPTv", OBJPROP_YDISTANCE, Y_base+L_height*3+Shift_UP_DN);  
      }
      else {ObjectDelete("RPT"); ObjectDelete("RPTv");}
      if (Total618 > 0) {
         ObjectCreate("T618", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("T618","Reached .618 Target", 10, "Arial", CommentLabel_color);
         ObjectSet("T618", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("T618", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
         ObjectSet("T618", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN); 

         ObjectCreate("T618v", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("T618v",DoubleToStr(Total618,0), 10, "Arial", Blue);
         ObjectSet("T618v", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("T618v", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
         ObjectSet("T618v", OBJPROP_YDISTANCE, Y_base+L_height*2+Shift_UP_DN);  
      }
      else {ObjectDelete("T618"); ObjectDelete("T618v");}
      if (Total382 > 0) {   
         ObjectCreate("T382", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("T382","Reached .382 Target", 10, "Arial", CommentLabel_color);
         ObjectSet("T382", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("T382", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
         ObjectSet("T382", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN); 

         ObjectCreate("T382v", OBJ_LABEL, 0, 0, 0);
         ObjectSetText("T382v",DoubleToStr(Total382,0), 10, "Arial", Blue);
         ObjectSet("T382v", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
         ObjectSet("T382v", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
         ObjectSet("T382v", OBJPROP_YDISTANCE, Y_base+L_height+Shift_UP_DN);  
      }
      else {ObjectDelete("T382"); ObjectDelete("T382v");}
      Y_base += L_height*3;

   }
   
   return(0);
}
//+------------------------------------------------------------------+


