[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Printf -> Date possible ?



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "Trinolix Derry" <trinolix@xxx> 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 <gp.investment@xxx>:
> >
> >   Double it in the format string:
> >
> > printf("Percentage Gain = %1.2f%%", gain);
> >
> > This would give output like:
> >
> > Percentage Gain = 23.59%
> >
> > GP
> >
> > --- In amibroker@xxxxxxxxxxxxxxx <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 amibroker@xxxxxxxxxxxxxxx
<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
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/