Printing double values with thousand separators on chart

 

I want to print the values of account balance, equity etc. on my chart.

How can I print them with thousand separators, for example like 12,920.12 or like 12 920.12 (Metatrader uses this format on its terminal tab) on my chart with the Comment() function or with any other function you will advise?

Thanks.

 
Batuhan:

I want to print the values of account balance, equity etc. on my chart.

How can I print them with thousand separators, for example like 12,920.12 or like 12 920.12 (Metatrader uses this format on its terminal tab) on my chart with the Comment() function or with any other function you will advise?

Thanks.

All good things are already in the Forum:

https://www.mql5.com/en/forum/135250#comment_5916847

NumbersSeparator() function for Print big numbers
NumbersSeparator() function for Print big numbers
  • 2011.08.19
  • www.mql5.com
Hi Coders! I'm looking for a little number to string function. I have a number, for example: 344256454...
 
Anthony Garot:

All good things are already in the Forum:

https://www.mql5.com/en/forum/135250#comment_5916847


Thank you.

 
Batuhan:

I want to print the values of account balance, equity etc. on my chart.

How can I print them with thousand separators, for example like 12,920.12 or like 12 920.12 (Metatrader uses this format on its terminal tab) on my chart with the Comment() function or with any other function you will advise?

Thanks.

object creati kullanın daha kolay.

 
Mehmet Bastem:

object creati kullanın daha kolay.

This is an English language forum.

Please only post in English.

 
Mehmet Bastem:

object creati kullanın daha kolay.


With label objects, at the end, you have to end with a formatted string as well. So, I don't think that there will be any difference.

 

The reference cited in the original answer below was wrong. There is a built in function for this, which is exactly what kaiser suggests below: toLocaleString So you can do:

(1234567.89).toLocaleString('en') // for numeric input parseFloat("1234567.89").toLocaleString('en') // for string input

The function implemented below works, too, but simply isn't necessary.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
mishall221: The reference cited in the original answer below was wrong. There is a built in function for this,back as IE 5.5.)
  1. The reference is not wrong. There are multiple ways of doing things.
  2. There is no build in function for that. You are referencing a library that does not exist in MT4 by default.
Reason: