

#property indicator_chart_window
string account_balance,market;
extern color main_color=Yellow,profit_color=Green,loss_color=Red;
extern int text_size=33;
color t_color;
double t_size=33;
string per;

//--------------------------------------------------------------------
int init()  {return;}
  
int deinit() {
ObjectDelete("Balance");
ObjectDelete("Market");
return(0);}
//--------------------------------------------------------------------

int start()                         
{
if (text_size<10) {text_size=10;}
if (text_size>35) {text_size=35;}

if ((ObjectFind("Balance")!=0)||(t_size!=text_size))
{
ObjectCreate("Balance",OBJ_LABEL,0,0,0);
ObjectSet("Balance",OBJPROP_YDISTANCE,text_size+45);
ObjectSet("Balance",OBJPROP_XDISTANCE,35);
ObjectSetText("Balance","wait...",text_size,"Times New Roman",Yellow);
}

if (ObjectFind("Market")!=0)
{
ObjectCreate("Market",OBJ_LABEL,0,0,0);
ObjectSet("Market",OBJPROP_YDISTANCE,text_size);
ObjectSet("Market",OBJPROP_XDISTANCE,35);
ObjectSetText("Market","wait...",text_size,"Times New Roman",Yellow);
}

switch (Period())
{
case 1: per="M_1";break;
case 5: per="M_5";break;
case 15: per="M_15";break;
case 30: per="M_30";break;
case 60: per="H_1";break;
case 240: per="H_4";break;
case 1440: per="D_1";break;
case 10080: per="W_1";break;
case 43200: per="MN_1";break;
}

market=per+" / "+DoubleToStr(Bid,Digits)+" / "+DoubleToStr(Ask,Digits)+" / "+DoubleToStr((Ask-Bid)/Point,0);  
account_balance=DoubleToStr(AccountBalance(),0)+" / "+DoubleToStr(AccountEquity(),0)+" / "+DoubleToStr(AccountProfit(),0);
t_color=main_color;
if ((AccountProfit()>=0)&&(OrdersTotal()>0)) {t_color=profit_color;}
if (AccountProfit()<0) {t_color=loss_color;}
ObjectSetText("Balance",account_balance,text_size,"Times New Roman",t_color);
ObjectSetText("Market",market,text_size,"Times New Roman",main_color);  

t_size=text_size;

//--------------------------------------------------------------------
return;
}