Is it true that I cannot define e.g. for Comment(..) leading zeros before the decimal point.
As I want to show percent-numbers which range from 1.1% to 999.9% and I want to be able to
see mat the chart (with Comment(..)) 001.1% .. 009.9 % .. 022.2 % .. 123.4 % .. 999.9 %.
I tried StringFormat(%03.5f) => a) 3 numbers before '.', b) the '.' and c) 1 decimal = 5 char.
(I remember this from c somehow) but this isn't working.
Anything else ( but not if (x>100).. else if(>9.9) .. else ... I don't like this operating expense for just a simple print to screen).
Per2=22.2,
Per3=333.3;
Comment(StringFormat("%5.1f%%\n%5.1f%%\n%5.1f%%",Per1,Per2,Per3));
Exactly this I tried in mt4 and it does not work :(
Just look at the number in brackets 70.1% and 108.1% neither leading zeros nor leading blanks. :(
PrintFormat - Common Functions - MQL4 Reference
3 before, 2 after, plus the dot, is a total width of six (6) places.
Print( StringFormat("'%06.2f,%06.2f,%06.2f'", 1.12345, 12.12345, 123.12345) ); // '001.12,012.12,123.12'
}
It does work. Your image shows "%03.1f" and 70.1 which requires a minimum of 4 digits to display (7,0,".",1) and you specified width 3, so no zero.
- docs.mql4.com
Ahh - ok, I see my mistake, the total numbers of char has to be before the decimal point - not after. :(
Thank you
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is it true that I cannot define e.g. for Comment(..) leading zeros before the decimal point.
As I want to show percent-numbers which range from 1.1% to 999.9% and I want to be able to
see mat the chart (with Comment(..)) 001.1% .. 009.9 % .. 022.2 % .. 123.4 % .. 999.9 %.
I tried StringFormat(%03.5f) => a) 3 numbers before '.', b) the '.' and c) 1 decimal = 5 char.
(I remember this from c somehow) but this isn't working.
Anything else ( but not if (x>100).. else if(>9.9) .. else ... I don't like this operating expense for just a simple print to screen).