Do you mean the number of decimal places or the total number of digits? For a complete description of printf and the format string for the C language, take a look here (amongst other places):
http://en.wikipedia.org/wiki/Printf Note though that AFL has limitations on what types of numbers it can display. As far as formatting floats goes, you can use a specification like "%x.yf" where 'x' is the total number of displayed digits (including the decimal point) and 'y' is the number of decimal places. If you precede 'x' with zero (ie. %0x.yf) leading spaces will be replaced with leading zeros. Also note that if you specify less total digits than the number needs to display the full value, it will still display the full number. So if the value is 12345 and you specify %1.0f, it will still display 12345. If you don't specify 'x', eg. %.2f, it will use the minimum number of characters necessary to display the number with two decimal places, which is essentially the same as %1.2f as there will always be at least one digit before the decimal point, even if it's zero. GP --- In [email protected], "Trinolix Derry" <[EMAIL PROTECTED]> wrote: > > Hi, > > thanks a lot ! > Maybe one last question. Is there a way to reduce the displayed digits for > any values. > Something like writeval(anything, 1.2) > Unfortunately it doesn't work inside the loop. > > Regards > > > > 2007/6/25, gp_sydney <[EMAIL PROTECTED]>: > > > > Double it in the format string: > > > > printf("Percentage Gain = %1.2f%%", gain); > > > > This would give output like: > > > > Percentage Gain = 23.59% > > > > GP > > > > --- In [email protected] <amibroker%40yahoogroups.com>, "Trinolix > > Derry" <trinolix@> wrote: > > > > > > Is there maybe any way to display the % letter ? > > > > > > > > > Regards > > > Thomas > > > > > > > > > > > > 2007/6/25, Trinolix Derry <trinolix@>: > > > > > > > > Hi, > > > > > > > > thanks a lot ! > > > > I see now that i missed the DateTimeToStr function. > > > > > > > > Regards > > > > > > > > > > > > > > > > 2007/6/25, gp_sydney <gp.investment@>: > > > > > > > > > > Try something like this: > > > > > > > > > > dt = DateTime(); > > > > > for (i = 0; i < BarCount; i++) > > > > > printf(DateTimeToStr(dt[i])); > > > > > > > > > > GP > > > > > > > > > > --- In [email protected] <amibroker%40yahoogroups.com><amibroker%40yahoog > > roups.com>, > > > > > "Trinolix Derry" <trinolix@> wrote: > > > > > > > > > > > > Hello, > > > > > > > > > > > > i would like to print the date through the printf function > > inside my > > > > > loop, > > > > > > but wasn't successfully so far. > > > > > > Can someone please tell me a solution ? > > > > > > > > > > > > Regards > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > Regards >
