Ask the real owner of the source code to give it to you or have him fix it for you.
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way, we will not be an accomplice after the fact to that theft.
If you post decompiled code again, you will likely be banned.
Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because “someone uploaded it, I don't know why I can't use that?”
I needed a simple thousands separator for positive double numbers. I tried a couple of the functions from the answers here, which did not compile (in MT5). So I asked Cloud 3.5 Sonnet to write me one. Here it is. I does compile and works as expected:
string format_double_number(double numb) {
// Convert the number to string and split into integer and decimal partsstring num_str = DoubleToString(numb, 2);
string parts[];
StringSplit(num_str, '.', parts);
// Handle the integer partstring int_part = parts[0];
string formatted = "";
int len = StringLen(int_part);
// Add digits with commasfor(int i = 0; i < len; i++) {
if(i > 0 && (len - i) % 3 == 0) {
formatted += ",";
}
formatted += StringSubstr(int_part, i, 1);
}
// Add decimal part if it existsif(ArraySize(parts) > 1) {
formatted += "." + parts[1];
}
return formatted;
}
Please note that it assumes a lot:
assumes the number is positive
assumes the integer-fraction seperator is "."
assumes you want the thousands seperator chracter to be ","
assumes there will only be 2 decimal places
These assumptions were what I wanted. If yours are different, you'd need to change the code accordingly (or have AI change it for you.)
I needed a simple thousands separator for positive double numbers. I tried a couple of the functions from the answers here, which did not compile (in MT5). So I asked Cloud 3.5 Sonnet to write me one. Here it is. I does compile and works as expected:
Please note that it assumes a lot:
assumes the number is positive
assumes the integer-fraction seperator is "."
assumes you want the thousands seperator chracter to be ","
assumes there will only be 2 decimal places
These assumptions were what I wanted. If yours are different, you'd need to change the code accordingly (or have AI change it for you.)
// Formats double with thousands separator and specified decimals.string FormatDouble(constdouble number, constint digits, conststring separator=",");
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Late to the party... Here is a template function that can handle whatever number you throw at it. [MQL4/5]
Nice! This passed all my unit tests right out of the box, including 2^53.
Nice! This passed all my unit tests right out of the box, including 2^53.
Thanks for the compliment, I appreciate it. :)
Thanks for the compliment, I appreciate it. :)
Late to the party... Here is a template function that can handle whatever number you throw at it. [MQL4/5]
HI
I need help
I need the number that tt_tprofit shows to be separated by three digits
Please help me if possible
Help with stolen code?
Ask the real owner of the source code to give it to you or have him fix it for you.
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way, we will not be an accomplice after the fact to that theft.
See also
Terms of Use of MQL5.community #3.13
How can I recognize a decompiled code ? - General - MQL5 programming forum - Page 2 #17 (2017)
134317 - MQL4 programming forum (2011)
If you post decompiled code again, you will likely be banned.
Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because “someone uploaded it, I don't know why I can't use that?”
I needed a simple thousands separator for positive double numbers. I tried a couple of the functions from the answers here, which did not compile (in MT5). So I asked Cloud 3.5 Sonnet to write me one. Here it is. I does compile and works as expected:
Please note that it assumes a lot:
I needed a simple thousands separator for positive double numbers. I tried a couple of the functions from the answers here, which did not compile (in MT5). So I asked Cloud 3.5 Sonnet to write me one. Here it is. I does compile and works as expected:
Please note that it assumes a lot:
https://www.mql5.com/en/code/20822