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

Re: [amibroker] Amiquote convert to Metastock format



PureBytes Links

Trading Reference Links

Yes, there are 3 mighty formatting functions in ABtool (s.b.). With them
every format could be created, regarded one knows the syntax
(look for "printf format specifiers" on the Web)
UM

1)
   STRING xxFormatNum(STRING formatstr, NUMBER numvalue, ...)
     Flexible number formatting using C/C++ like printf formats
     Returns: the formatted result
     Example:
       resStr = xxFormatNum("%5.2f %10.5f", valA, valB);
     Remarks:
       Up to 10 numeric values can be passed
       This is similar to the sprintf() function in C/C++
     See also info under xxTableColumnFormatSet(), file FormatXXX.afl, and xxFormatStr()

2)
   STRING xxFormatStr(STRING formatstr, STRING strvalue)
     Flexible string formatting using C/C++ like printf formats
     Returns: the formatted result
     Example:
       resStr = xxFormatStr("%15s", strA);
     Remarks:
       Here only 1 value can be passed
       This is similar to the sprintf() function in C/C++
     See also info under xxTableColumnFormatSet, file FormatXXX.afl, and xxFormatNum()

3)
    NUMBER xxTableColumnFormatSet(STRING printfFormatStr, NUMBER column, NUMBER tablehandle)
      Overrides the default print format string for the given column to be used by the ascii exporter TableExport()
      The print format string must be a valid "printf" like format string found in the programming languages C and C++.
      Examples:

        - for Float type:
            "%f"     this is the default for Float. It prints always with 6 decimals.
            "%.2f"   prints value left aligned and with 2 decimals
            "%8.2f"  prints value right aligned (and BLANK prefixed) as a total of 8 chars of which
                     the last 3 are the decimal comma plus 2 decimals. Example: "  123.45"
            "%08.2f" same as before but here ZERO prefixing will be done. Example: "00123.45"
            "-8.2f"  Example: "123.45  "
            "%g"     this prints decimals only if there are some. Very big and very small numbers are printed
                     in exponential (scientific) notation. Example "1e20"

        - for String type:
             "%s"    This is the default for strings. It prints all characters of the string
             "%15s"  prints 15 chars and rightaligning the value if it is shorter than 15 chars
             "%-15s" same as above, but leftaligns
              %-15.15s"  the value is cutted to 15 chars if it is longer, or padded up to 15 with blanks. result is left aligned.
                         if value is empty ("") then 15 blanks will be printed

        - for the Integers Int16, Int32, and Byte:
             "%d"    The default for these integers: it prints left aligned and of course without any decimals
             "%4d"   4 digits, right aligned, BLANKS prepended if there are less digits (but if value has more digits than all
digits will be printed)
             "%04d"  same as above but ZEROES will be prepended if the number has less than 4 digits

        With numbers a rounding up/down will be done if there are more decimals (not a simple cutting).
        And: if the format string is too "small" then still all digits will be printed.
             fe. specifiying "%5.2f" for a float value which is 1000000 wll result in "1000000.00"
        Reminder: in the format string "%5.2" the first number (5) specifies the TOTAL number of CHARS of the output,
                  of which the last 2 are decimal digits along with a decimal point before them.
        There are much more combinations and formats possible. Please take a search for "printf format specifiers" on the web.
        (This information was from memory. If you find any discrepancies let me know please.)
        See also file Table_1.afl, xxFormatNum() and xxFormatStr(), and file FormatXXX.afl



----- Original Message -----
From: "Marek Chlopek" <mchlopek@xxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, May 24, 2003 9:39 PM
Subject: Re: [amibroker] Amiquote convert to Metastock format


> On Saturday 24 May 2003 20:27, Tomasz Janeczko wrote:
> > Marek,
> >
> > I am afraid Metastock downloader is not able to convert
> > dates in DD-MMM-YY format where is a short name of the month.
>
> I think using UM's ABtool plugin it is possible to format date before
> exporting to ascii.
>
> KK, please see
> http://groups.yahoo.com/group/amibroker/message/40556
> for the example how to export (some modifications are needed to fit your
> needs).
>
> Regards,
> --
> Marek Chlopek




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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