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

Re: [amibroker] AmiBroker AFL Glossary project --LIFT OFF



PureBytes Links

Trading Reference Links

Hello,

I have uploaded to the AFL Library a program called AF_Glossary_Generator (yes a typo in the name) that takes another file uploaded called AFL_Glossary_1 and generates parameter selectable formatted TXT or RTF files for this project.  It took me a couple of hours to make a database file for all the string manipulation functions, and forever to make the program that spit out formatted documents. Creating the files for both forced me to refine the database specification a bit further.  

Please download them both and try them out.  You have to create a directory called AFL_Glossary in your main AmiBroker folder and put the file named AFL_Glossary_1.txt into it.  Rename the file to strip off the .afl and make sure it ends in .txt.  The output files will be written to the same folder.  On a PC, the .txt and .rtf files read fine in WordPad, but the links don't work in that program.  They do work in Word.  In the Mac, all formats work fine in TextEdit program.

Please download the program and data and give me some feedback.  Sorry there are not a lot of instructions, but you just select parameters, and click on the Convert Database button to get something written out.  You can try out all kinds of different formats.

Next, we need volunteers to write small sections of the database to make headway.  If you make another file called AFL_Glossary_2.txt, etc., it will combine them into one database for outputs.  

Best regards,
Dennis

PS. here is a sample of one possible output:



     AFL -- AmiBroker Formula Language
-- Abbreviation for AmiBroker Formula Language
-- Group Tags: AFL
-- See Also: AmiBroker Formula Language

 

  n = Asc( String, CharacterPosition=0 ) [AB 4.8] -- get ASCII code of character
-- Returns the ASCII code number for a text character
-- Group Tags: AFL,Functions,String manipulation,Type Conversions
-- Search Tags: ASCII,character,convert,code

 

  n = StrToDateTime( DateTimeText ) [AB 4.8] -- convert string to datetime
-- Returns datetime number from a text representation of the Date/Time
-- Group Tags: AFL,Functions,String manipulation,Type Conversions,Date and Time
-- Search Tags: datetime,date,time,convert
-- See Also: DateTimeToStr(),Now(),DateTime(),TimeNum(),Date()

 

The rtf file of the whole sample output is also attached here for those who get individual emails:


{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
{\fonttbl\f0\fswiss\fcharset0 ArialMT;}
{\colortbl;\red255\green255\blue255;}
\margl0\margr0\vieww17680\viewh17140\viewkind0
\pard\tx720\tx900\tx2520\li0\fi-0\ql\qnatural\pardirnatural

\f0\fs20 \cf0
\
\par      \tab {\field{\*\fldinst{HYPERLINK ""}}{\fldrslt \b AFL\b0 }}\  -- AmiBroker Formula Language\par \tab \tab -- Abbreviation for AmiBroker Formula Language\par \tab\tab -- Group Tags:\tab AFL\par \tab\tab -- See Also:\tab AmiBroker Formula Language\par 
 \par   n = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?asc"}}{\fldrslt \b Asc\b0 }}\ ( String, CharacterPosition=0 ) [AB 4.8] -- get ASCII code of character\par \tab \tab -- Returns the ASCII code number for a text character\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions\par \tab\tab -- Search Tags:\tab ASCII,character,convert,code\par \tab\tab -- Links:\tab {\field{\*\fldinst{HYPERLINK "http://en.wikipedia.org/wiki/ASCII"}}{\fldrslt ASCII Defined}}\  {\field{\*\fldinst{HYPERLINK "http://www.asciitable.com"}}{\fldrslt ASCII Table}}\  \par 
 \par   n = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrToDateTime"}}{\fldrslt \b StrToDateTime\b0 }}\ ( DateTimeText ) [AB 4.8] -- convert string to datetime\par \tab \tab -- Returns datetime number from a text representation of the Date/Time\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions,Date and Time\par \tab\tab -- Search Tags:\tab datetime,date,time,convert\par \tab\tab -- See Also:\tab DateTimeToStr(),Now(),DateTime(),TimeNum(),Date()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?DateTimeToStr"}}{\fldrslt \b DateTimeToStr\b0 }}\ ( DateTimeNumber ) [AB 4.8] -- convert datetime to string\par \tab \tab -- Returns a text representation of the datetime number\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions,Date and Time\par \tab\tab -- Search Tags:\tab datetime,date,time,convert\par \tab\tab -- See Also:\tab StrToDateTime(),Now(),DateTime(),TimeNum(),Date()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?NumToStr"}}{\fldrslt \b NumToStr\b0 }}\ ( Array/Number, Format=1.3, Separator=True ) [AB 4.5] -- convert number to string\par \tab \tab -- Returns a text representation of a number or one element of an array\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions,Date and Time\par \tab\tab -- Search Tags:\tab datetime,date,time,convert,format\par \tab\tab -- See Also:\tab StrToDateTime(),Now(),DateTime(),TimeNum(),Date(),StrToNum(),WriteVal()\par 
 \par   n = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrToNum"}}{\fldrslt \b StrToNum\b0 }}\ ( numberStr ) [AB 4.5] -- convert string to number\par \tab \tab -- Returns a number from a text representation of a number\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions\par \tab\tab -- Search Tags:\tab convert,number\par \tab\tab -- See Also:\tab StrToDateTime(),WriteVal()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?WriteVal"}}{\fldrslt \b WriteVal\b0 }}\ ( Array/Number, Format=1.3, Separator=True ) [AB x.x] -- convert array or number to string --Synonym\par \tab \tab -- Synonym for NumToStr()\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions,Date and Time\par \tab\tab -- See Also:\tab NumToStr()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrFormat"}}{\fldrslt \b StrFormat\b0 }}\ ( formatString, OptionalValue, ... ) [AB 4.5] -- write formatted output to string\par \tab \tab -- Returns a formatted string from format and optional values\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions\par \tab\tab -- Search Tags:\tab convert,format\par \tab\tab -- See Also:\tab printf()\par \tab\tab -- Links:\tab {\field{\*\fldinst{HYPERLINK "http://en.wikipedia.org/wiki/Printf"}}{\fldrslt Printf Defined}}\  {\field{\*\fldinst{HYPERLINK "http://www.cplusplus.com/reference/clibrary/cstdio/printf.html"}}{\fldrslt C++ Format String Spec}}\  \par 
 \par      \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrFormat"}}{\fldrslt \b printf\b0 }}\ ( formatString, OptionalValue, ... ) [AB 4.5] -- print formatted output\par \tab \tab -- write formatted output to commentary or interpretation window\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation,Type Conversions\par \tab\tab -- Search Tags:\tab convert,print,format\par \tab\tab -- See Also:\tab StrFormat()\par \tab\tab -- Links:\tab {\field{\*\fldinst{HYPERLINK "http://en.wikipedia.org/wiki/Printf"}}{\fldrslt Printf Defined}}\  {\field{\*\fldinst{HYPERLINK "http://www.cplusplus.com/reference/clibrary/cstdio/printf.html"}}{\fldrslt C++ Format String Spec}}\  \par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrExtract"}}{\fldrslt \b StrExtract\b0 }}\ ( list, item ) [AB 4.4] -- get item from CSV string\par \tab \tab -- Returns one item from a comma separated list\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab find,extract,CSV,comma separated,list,item\par \tab\tab -- See Also:\tab CategoryGetSymbols(),StrMid()\par 
 \par   n = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrFind"}}{\fldrslt \b StrFind\b0 }}\ ( string, substring ) [AB 4.5] -- find substring in a string\par \tab \tab -- Returns character index of substring in a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab find,extract,list,item\par \tab\tab -- See Also:\tab StrExtract(),StrReplace(),StrMid()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrReplace"}}{\fldrslt \b StrReplace\b0 }}\ ( oldSubstring, newSubstring ) [AB 4.9] -- replaces substring in a string\par \tab \tab -- Returns a string with all substrings replaced with a new substring\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab find,replace,edit,change\par \tab\tab -- See Also:\tab StrFind()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrMid"}}{\fldrslt \b StrMid\b0 }}\ ( string, startChar, charCount ) [AB 4.0] -- extracts substring from a string\par \tab \tab -- Returns a substring of a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab extract,middle,substring\par \tab\tab -- See Also:\tab StrFind(),StrExtract(),StrLeft(),StrRight(),StrLen(),StrReplace()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrLeft"}}{\fldrslt \b StrLeft\b0 }}\ ( string, charCount ) [AB 4.0] -- extracts left part of a string\par \tab \tab -- Returns the first portion of a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab extract,left,first,substring\par \tab\tab -- See Also:\tab StrFind(),StrExtract(),StrMid(),StrRight(),StrLen(),StrReplace()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrRight"}}{\fldrslt \b StrRight\b0 }}\ ( string, charCount ) [AB 4.0] -- extracts right part of a string\par \tab \tab -- Returns the last portion of a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab extract,right,last,substring\par \tab\tab -- See Also:\tab StrFind(),StrExtract(),StrMid(),StrLeft(),StrLen(),StrReplace()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrToLower"}}{\fldrslt \b StrToLower\b0 }}\ ( string ) [AB 4.8] -- converts a string to lowercase\par \tab \tab -- Returns the lowercase version of a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab convert,lowercase,uppercase\par \tab\tab -- See Also:\tab StrToUpper(),StrReplace()\par 
 \par   s = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrToUpper"}}{\fldrslt \b StrToUpper\b0 }}\ ( string ) [AB 4.8] -- converts a string to uppercase\par \tab \tab -- Returns the uppercase version of a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab convert,lowercase,uppercase\par \tab\tab -- See Also:\tab StrToLower(),StrReplace()\par 
 \par   n = \tab {\field{\*\fldinst{HYPERLINK "http://www.amibroker.com/f?StrLen"}}{\fldrslt \b StrLen\b0 }}\ ( string ) [AB 3.5] -- get string length\par \tab \tab -- Returns the number of characters in a string\par \tab\tab -- Group Tags:\tab AFL,Functions,String manipulation\par \tab\tab -- Search Tags:\tab extract,right,last,left,first,middle,substring\par \tab\tab -- See Also:\tab StrFind(),StrExtract(),StrMid(),StrLeft(),StrLen(),StrReplace()\par 
 }



General Template:

//Begin_entry:  Starts an entry (// forces ignore this entry)
Name_entry:     Entry Text
Name_long:      Expanded Name
Description:    Short description of entry

Return_type:    Return Value type (a, n, s, b, a|n, s|n)
Return_name:    Optional Descriptive Name of Return Value

Arg_type:       +Argument Value type (a, n, s, b, a|n, s|n)
Arg_name:       +*Optional Descriptive Name of Argument Value
Arg_default:    +*Optional Default Argument Value

Link_ABdoc:     Link url to AB manual document
Link_video:     Link url to AB video help
Link_tutorial:  Link url to AB tutorial doc
Link_KBdoc:     Link url to AB knowledge base
Link_UKBdoc:    Link url to Users knowledge base
Link_url:       +Link url to any useful page
Link_name:      +*Optional Name text for any Link above

Version_AB:     Earliest AB version to support feature (x.x)
Tag_group:      +Group term from group hierarchy list
Tag_search:     +Search term

Related_entry:  +Related Glossary entry
End_entry:      Ends this entry

 

On Sep 8, 2008, at 7:46 AM, Dennis Brown wrote:

Tomasz,

Thank you, that is what I was looking for.  It is even easier than I thought.

Best regards,
Dennis

On Sep 8, 2008, at 2:23 AM, Tomasz Janeczko wrote:

AF L version number + 2 equals AB version number, but better
use AmiBroker version in the glossary since it is easier for users to know AB version number.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Sunday, September 07, 2008 8:23 PM
Subject: Re: [amibroker] AmiBroker AFL Glossary project --READY TO PROCEED

Hello,

Is there an easy way to find the AB version number for an AFL version number?

BR,
Dennis


On Sep 6, 2008, at 10:05 PM, Dennis Brown wrote:

Keith,

On Sep 6, 2008, at 8:38 PM, Keith McCombs wrote:

Dennis --
I was able to open the .txt and .rtf files, but not Part 1.1.3 or Part 1.1.5.  My system seems to think that they are .html files, but FireFox presents a blank screen for both.

The .txt and .rtf were the only attachments -- those others were something added by the ISP somewhere along the line in the conversion process.  I have seen it once before with my accountant.  Could be something to do with Mac vs PC formats. 

Have you written the software to convert the templates into a single searchable document yet?

I have not star ted that yet, since I needed a template and part of a database to work with first.  I also need the form of a finished document to write out.  I was planning on your basic format to start with -- though I have additional information in the template now that should be optionally written out for test purposes.
However, I am happy to share the work --if someone would like to try their hand at writing an AFL conversion formula to read in the database text file and write out another formatted text file.  My AFL will end up looking like a very simple minded plodding formula --mirrors my mind... LOL

Since AFL can only write out a text file, I was thinking that RTF or HTML would have to be written into the text to get even simple things like bold text.  I think HTML might be a simpler format to use for this, but RTF is compatible with just about every word processor.  Perhaps we just stick with plain text for now.  

If I were to use RTF, I would take some pla in text conversion, edit in the format in my editor and save it out as RTF.  Then I would read it in as plain text so I would have all the formatting text.  Then I would just use the tags and commands from that to assemble formatted documents from my AFL.  See how my simple mind works ;-)

BTW, I notice that links that you entered do not appear as 'clickable' in OpenOffice.org 2.4.1.  I don't know about Word (I recently removed it from my computer, after too        many years of complete disgust).  However, they are 'clickable' in Thunderbird email and in Adobe Reader, a fter conversion to .pdf.  I have been fooled in the past by typing a link name correctly and then converting it to a 'clickable' link using a OO.o or Word, and making a typing error at that time.  Therefore, I STRONGLY recommend that links remain plain text in the template for easy editing, and t oo reduce wasted effort.

ABSOLUTELY!  I went to some pains to make sure the links were just text in the files.  Many programs and emails have an option to turn text that looks like a url into a clickable link.  I goofed and did not turn that option OFF in my email program when I sent the template, so it made them clickable.  Don't try to copy and edit those urls from the post, type them in from scratch or use the attached files.  The clickable text displayed for a url is not the actual url used, even if it loo ks like a url.  For instance, if you edit the clickable url text to say HappyDays it will still take you to the same url.  That is why I have a Link_name:  item that would be the text that would be clickable, but the Link_url: item is the actual url.

However, If someone does not get this right, it would not really be that big a deal, because any text editor can save th e file as text only, and all that hidden link stuff goes away and just the text remains (that's how I fix mine).

BR,
Dennis



-- Keith

Dennis Brown wrote:
Hello,

I am starting a new thread with this message because it is a starting point to proceed with filling in the Glossary database and contains the template to do so.  I have included the template in the text of this message, and also attached a .txt and a .rtf version of the file.  I can also email or upload them if these is not sufficient for some who wish to contribute.

I have racked my brains for a few days trying out different variations of the previous suggestions (including my own) and thinking about how the Glossary data could be used, and also about how to parse and translate it into other formats.  I also filled out a couple of entries several different ways to see how it was to work with.  

I discovered it is easier to work with a fixed width font, and I have backed away from the pseudo XML syntax as that was more confusing to the human eye than a simple Keyword:  type of entry.  There is no difference in ease of parsing.  I did retain a couple of ideas from the XML that would help make it more robust to parse.  

Translating formats = fill a bucket with one entry of defaults, then parse in the data items of one entry, then empty the bucket in whatever format to "print" or populate a database.

I thought about having a rigid functional hierarchy to place entries, but rejected that because it is so much more useful to be ab le to assign an entry to multiple functional groups.  If I want to find all the string functions, or I want to get all the Date/Time functions I would have overlap and I want to see that in a listing.  In reality, the groups are just more search tags, but they could be treated a little differently under certain circumstances.  By defining the functional groups, we get a consistent way to find or organize some types of output.  We have to define more functional groups than we now have, but that can come over time.

READY TO PROCEED!

I am ready to proceed with creating glossary entries at this point.  I might personally be able to do one a day on average.  At that rate it would take many years to compile a complete glossary for AB.  This is one of the reasons that it will take many hands to make this happen.  It is a bit tedious to find things like links to other sources of inf ormation.  On the other hand, information can always be added later to any entry to flesh it out, as long as the basic stuff is there.  It just gets more useful over time.

After filling out just a couple of these, I have a great appreciation for the initial work Keith did that really got the ball rolling.  Thanks again Keith.

I will continue filling out the entries for the string manipulation entries.

Please volunteer to make a text file for one of the other functional groups.  

Here are some small ones to try out that are not too demanding:

Form the AFL Function Reference - Categorized list of functions

< span class="Apple-style-span" style="font-family: Verdana; font-weight: bold;">Referencing other symbol data
Time Frame functions
File Input/Output functions
Statistical functions 
Moving averages, summation
Lowest/Highest
Compo sites
Basic price pattern detection

Just  pick one and reply to this post, or send an email to me to stake your claim.

Thanks in advance to all who off er to help with this project.

Best regards,
Dennis


Template sample for Glossary Database entry --20080906

Font used: Courier Regular 12 point fixed width UniCode UTF-8

Notes about template:
Text is ignored if it is not between Begin_entry: and End_entry: keywords.
  This allows Keyword: in comment lines outside the structure or the 
  whole entry to be ignored as shown below.
Text is ignored if the line does not start with a data item Keyword:
  This allows comment lines inside a structure.
  However, I would recommend starting a comment with "//" to be more clear .
The order of some items is important.
  A "*" below indicates an item that must follow the previous item.
Some items can be repeated as many times as needed.
   ;A "+" below indicates these items.
A group listing is used to determine to which groups this entry belongs.
  The Tag_group: would have an entry for every level above this entry.
  An entry can also be a member of more than one group,
  for instance, a string function might also be a date or time function.
  The Tag_group: data are also treated as search tags.
A synonym could have an entry that simply references another entry.

General Template:

//Begin_entry:  Starts an entry (// forces ignore this entry)
Name_entry:     Entry Text
Name_long:      Expanded Name
Description:    Short description of entry

Return_type:    Return Value type (a, n, t, an, nt)
Return_name:    Optional Descriptive Name of Return Value

Arg_type:       +Argument Value type (a, n, t, an, nt)
Arg_name:       +*Optional Descriptive Name o f Argument Value
Arg_default:    +*Optional Default Argument Value

Link_ABdoc:     Link url to AB manual document
Link_vi deo:     Link url to AB video help
Link_tutorial:  Link url to AB tutorial doc
Link_KBdoc:     Link url to AB knowledge base
Link_UKBdoc:    Link url to Users knowledge base
Link_url:       +Link url to any useful page
Link_name:      +*Optional Name text for any Link above

Version_AB:     Earliest AB version to support feature (x.x)
Tag_group:      +Group term from group hierarchy list
Tag_search:     +Search term

Related_entry:  +Related Glossary entry
End_entry:      Ends this entry

// The simplest synonym entry would look like this:

Begin_entry:
Name_entry:     AFL
Name_long:      AmiBroker Formula Language
Description:    ; Abbreviation for AmiBroker Formula Language
Tag_group:      AFL
Related_entry:  AmiBroker Formula Language
End_entry:

// String manipulation functions:

Begin_entry:
Name_entry:     Asc()
Name_long:      get ASCII code of character
Description:    Returns the ASCII code number for a text character
Return_type:    n
Return_name:    ASCII code
Arg_type:       t
Arg_name:       String
Arg_type:       n
Arg_name:       CharacterPosition
Arg_default:    0
Link_ABdoc:     http://www.amibroker.com/f?asc
Link_ name:      ASCII Definition and table
Version_AB:     x.x
Tag_group:      AFL
Tag_group:      Functions
Tag_group:      String manipulation
Tag_group:      Type Conversions
Tag_search:     ASCII
Tag_search:     character
Tag_search:     convert
Tag_search:     code
Related_entry:  
End_entry:


Begin_entry:
Name_entry:     DateTimeToStr()
Name_long:      convert datetime to string
Description:    Returns a text representation of the datetime number
Return_type:    t
Return_name:    DateTime Text
Arg_type:       n
Arg_name:       DateTime Number
Version_AB:     x.x
Tag_group:      AFL
Tag_group:  &n bsp;   Functions
Tag_group:      String manipulation
Tag_group:      Type Conversions
Tag_group:      Date and Time
Tag_search:     datetime
Tag_search:     date
Tag_search:     time
Tag_search:     convert
Related_entry:  StrToDateTime()
Related_entry:  Now()
Related_entry:  Dat eTime()
Related_entry:  TimeNum()
Related_entry:  Date()
End_entry: