# How format 1590785.90 for get 1,590,785.90

Hi everybody,

I are format the amount for the balance whit this code:

`double AccountBalance      = DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2);`

Whit this var i get for example "140.56" and its fine, but if the amount is 1590785.90 i get "1590785.90". How i can get "1,590,785.90"?

Thank u very much, i'm starting in mql5 :)

`double AccountBalance      = DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2);`

You are assigning a string value to a double variable

This is a 1000 separator you want to have. I think a direct solution doesn't exist, but you are not the first to ask for this. Search for it in the forum.

servicioburo: i get "1590785.90". How i can get "1,590,785.90"?
NumbersSeparator() function for Print big numbers - MQL4 programming forum

Thank u!, i locate the next function and all works fine.

```template<typename T>
string NumberToString(T number,int digits = 0,string sep=",")
{
CString num_str;
string prepend       = number<0?"-":"";
number               = number<0?-number:number;
int decimal_index    = -1;
if(typename(number)=="double" || typename(number)=="float")
{
num_str.Assign(DoubleToString((double)number,digits));
decimal_index  = num_str.Find(0,".");
}
else
{
num_str.Assign(string(number));
}
int len              = (int)num_str.Len();
decimal_index        = decimal_index > 0 ? decimal_index : len;
int res              = len - (len - decimal_index);
for(int i = res-3;i>0;i-=3)
{
num_str.Insert(i,sep);
}
return prepend+num_str.Str();
}```
Reason: