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

[amibroker] an HTML ABTOOL help doc...



PureBytes Links

Trading Reference Links

Walt (aka Hairy_mug)

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sOykFB/k9VGAA/ySSFAA/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/ 


Title: ABtool is a 3rd party add-on plugin or extension DLL for some stock
market 








ABtool
is a 3rd party add-on plugin or extension DLL for some stock market 

Technical
Analysis and Charting packages. Currently only "AmiBroker" from 

amibroker.com
is supported.

 

 

ABtool
is an independent work, and also independent from amibroker.com. 

The
library is on the way to become a general public library. In the future 

it will
support also some other T/A packages. Therefore, some functions can

be
duplicates of similar functions already in the native scripting language of 

the
particular T/A package (but they can be distinguished by their different
names). 

Currently,
ABtool is a non-commercial product and development. 

 

 

IS
ABTOOL SOMETHING FOR YOU:

ABtool
is intended for experienced programmers and system/application developers. 

Support
is available only for experienced users who know what a commandline/dos box

is,
what an include file is, what a loop is, and how to extend the PATH, to mention
only some. 

If you
are a beginner to AFL or to trading or to computers, then don't use this, since


this is
an advanced extension library for AmiBroker (and other destinations in
development).

For
example to use the mighty table features it is necessary that you should have
some 

experience
with table and/or database operations in a programming language.

 

 

Suggestions
for additions into the library are welcome. 

 

ABtool
home page: http://groups.yahoo.com/group/abtool/

 

 

 

You
should set "ApplyTo current stock" and "n last quotes n=1"

before
starting such a script via "Explore", "Scan",
"Optimize", "Backtest". 

For
some example sources see file area of the abtool yahoo group.

 

<span
>   

ATTENTION!


Starting
with v0.9.3.6 all ABtool functions have been prefixed

with an
"xx" to conform to the AB plugin conventions.

You
have to use an "xx" prefix in all ABtool function calls

in your
scripts.

 

 

WARNING!

This
library is mighty and powerful, but using it wrongly can cause errors.

The
program is still in early development stadium, so expect bugs. Not all possible


error
cases, invalid arguments etc. are detected yet by appropriate plausibility
checks.

Use it
at your own risk. The author cannot be made responsible for anything.

Please
make a backup of your ABtool directory, AmiBroker directory and your 

database
directory before installing ABtool.

The
software is developed and tested only under a Window 2000 system. 

Tests
on the other MS systems will follow sometime later.

Send
comments, bug reports, wishes etc. to the author: uenal.mutlu@xxxxxxxxxxx

<span
> TOC \o "1-3" \h \z <span
><span
class=MsoHyperlink>Highlights<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664886 \h <span
><span
>8<span
>

<span
class=MsoHyperlink>INSTALLATION:<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664887 \h <span
><span
>8<span
>

<span
class=MsoHyperlink>TRADEMARKS / COPYRIGHTS:<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664888 \h <span
><span
>8<span
>

<span
class=MsoHyperlink>INIT. <span
> PAGEREF
_Toc44664889 \h <span
>9<span
>

<span
class=MsoHyperlink>NUMBER xxABtoolInit();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664890 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>Ticker / Watch lists<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664891 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>STRING xxTickerFirst(NUMBER watchlistnum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664892 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>STRING xxTickerNext(NUMBER watchlistnum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664893 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>STRING xxTickerPrev(NUMBER watchlistnum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664894 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>STRING xxTickerLast(NUMBER watchlistnum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664895 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>NUMBER xxTickerCount(NUMBER watchlistnum = -1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664896 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>NUMBER xxTickerRefresh();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664897 \h <span
><span
>9<span
>

<span
class=MsoHyperlink>File Operations<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664898 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileOpen(STRING filename, STRING mode);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664899 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileWriteStr(STRING str, NUMBER filehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664900 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileWriteNum(NUMBER number, NUMBER filehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664901 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>STRING xxFileReadLine(NUMBER filehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664902 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileClose(NUMBER filehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664903 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>BOOL xxFileIsExist(STRING filename); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664904 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileDelete(STRING fname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664905 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>NUMBER xxFileCopy(STRING sorcefilename, STRING destinationfilename);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664906 \h <span
><span
>10<span
>

<span
class=MsoHyperlink>Number & String Functions<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664907 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxGPercent(NUMBER fromval, NUMBER toval);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664908 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>ARRAY xxGPercentA(ARRAY fromval, ARRAY toval);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664909 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxMin(NUMBER a, NUMBER b);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664910 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxMax(NUMBER a, NUMBER b);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664911 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxMod(NUMBER a, NUMBER b);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664912 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxDiv(NUMBER a, NUMBER b);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664913 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxStrLen(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664914 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>Returns the length of the string excluding the string terminator
(ASCII code 0); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664915 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxToNumber(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664916 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>STRING xxToString(NUMBER num);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664917 \h <span
><span
>11<span
>

<span
class=MsoHyperlink>NUMBER xxToInt(NUMBER num);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664918 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>NUMBER xxRelPos(NUMBER bottom, NUMBER top, NUMBER value);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664919 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>ARRAY xxRelPosA(ARRAY bottom, ARRAY top, ARRAY value)";<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664920 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>Table Functions<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664921 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>NUMBER xxTableCreate();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664922 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>NUMBER xxTableColumnAdd(STRING colname, NUMBER coltype, NUMBER
tablehandle, NUMBER strSize=16, groupId=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664923 \h <span
><span
>12<span
>

<span
class=MsoHyperlink>NUMBER xxTableCol(NUMBER groupId, NUMBER relativeColumn);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664924 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>xxTableDataAddNum(val, row, xxTableCol(groupId,relCol,th), th);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664925 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableGroupMembersCount(NUMBER group, NUMBER th);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664926 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableGroupsCount(NUMBER th);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664927 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableDataAddStr(STRING val, NUMBER row, NUMBER col,
NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664928 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableDataAddNum(NUMBER val, NUMBER row, NUMBER col,
NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664929 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableDataAddFloat(NUMBER val, NUMBER row, NUMBER col,
NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664930 \h <span
><span
>13<span
>

<span
class=MsoHyperlink>NUMBER xxTableDataAddInt32(NUMBER val, NUMBER row, NUMBER col,
NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664931 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>VARIANT xxTableDataGet(NUMBER row, NUMBER col, NUMBER
tablehandle); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664932 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER xxTableExportBinary(STRING filename, NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664933 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER xxTableImportBinary(STRING filename, NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664934 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER xxTableSave(STRING filename, NUMBER tableHandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664935 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER xxTableLoad(STRING filename, NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664936 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER xxTableExport(STRING filename, STRING seperator, NUMBER
tablehandle, BOOL fHdrline=1, NUMBER firstN=-1, BOOL fAppend=false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664937 \h <span
><span
>14<span
>

<span
class=MsoHyperlink>NUMBER TableImport(STRING filename, STRING
seperator=",", STRING reserved="", NUMBER tablehandle,
NUMBER fHdrline=1, firstN=-1, NUMBER reserved=0); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664938 \h <span
><span
>15<span
>

<span
class=MsoHyperlink>NUMBER xxTableDataClear(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664939 \h <span
><span
>15<span
>

<span
class=MsoHyperlink>NUMBER xxTableDelete(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664940 \h <span
><span
>15<span
>

<span
class=MsoHyperlink>NUMBER xxTableGetRowCount(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664941 \h <span
><span
>15<span
>

<span
class=MsoHyperlink>NUMBER xxTableGetColCount(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664942 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableSort(NUMBER tablehandle, NUMBER col, NUMBER
fAscendingOrder = true, NUMBER fIgnoreStrCase = true);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664943 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableSortDefAdd(NUMBER handle, NUMBER column, NUMBER
fAscendingOrder = true, NUMBER fIgnoreStrCase = true);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664944 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableSortDefDelAll(NUMBER handle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664945 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableSortEx(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664946 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableColumnFormatSet(STRING printfFormatStr, NUMBER
column, NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664947 \h <span
><span
>16<span
>

<span
class=MsoHyperlink>NUMBER xxTableGetRowLen(NUMBER tablehandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664948 \h <span
><span
>17<span
>

<span
class=MsoHyperlink>TableColumnAdd(STRING colname, NUMBER coltype, NUMBER tablehandle,
NUMBER strSize = 16);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664949 \h <span
><span
>18<span
>

<span
class=MsoHyperlink>Log Files<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664950 \h <span
><span
>18<span
>

<span
class=MsoHyperlink>NUMBER xxLog(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664951 \h <span
><span
>18<span
>

<span
class=MsoHyperlink>NUMBER xxLogfileSet(STRING logfname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664952 \h <span
><span
>18<span
>

<span
class=MsoHyperlink>NUMBER xxLogfileDel();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664953 \h <span
><span
>18<span
>

<span
class=MsoHyperlink>NUMBER xxSysLog(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664954 \h <span
><span
>19<span
>

<span
class=MsoHyperlink>NUMBER xxExec(STRING program);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664955 \h <span
><span
>19<span
>

<span
class=MsoHyperlink>STRING xxEnvGet(STRING envVar);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664956 \h <span
><span
>19<span
>

<span
class=MsoHyperlink>NUMBER xxEnvSet(STRING envVarAndValue);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664957 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>NUMBER xxEnvDel(STRING envVar);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664958 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>STRING xxEnvGetValOnly(STRING envname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664959 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>NUMBER xxEnvSetValOnly(STRING envVarName, STRING value);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664960 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>STRING xxDirCurGet();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664961 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>NUMBER xxMkDir(STRING dir);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664962 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>STRING xxFormatNum(STRING formatstr, NUMBER numvalue, ...);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664963 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>STRING xxFormatStr(STRING formatstr, STRING strvalue);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664964 \h <span
><span
>20<span
>

<span
class=MsoHyperlink>NUMBER xxDateToNumber(NUMBER func1,
NUMBER func2, NUMBER y, NUMBER m, NUMBER d); <span
> PAGEREF
_Toc44664965 \h <span
>21<span
>

<span
class=MsoHyperlink>NUMBER xxDateFromNumber(NUMBER func1, NUMBER func2, NUMBER
daynumber); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664966 \h <span
><span
>22<span
>

<span
class=MsoHyperlink>NUMBER xxGetErrno();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664967 \h <span
><span
>22<span
>

<span
class=MsoHyperlink>STRING xxStrUpr(STRING string);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664968 \h <span
><span
>23<span
>

<span
class=MsoHyperlink>STRING xxStrLwr(STRING string);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664969 \h <span
><span
>23<span
>

<span
class=MsoHyperlink>NUMBER xxStrRepl(STRING str, STRING substr, STRING newsubstr,
reserved=0, fAll=true);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664970 \h <span
><span
>23<span
>

<span
class=MsoHyperlink>VARIANT xxABI(STRING s1, STRING s2, NUMBER f1, NUMBER f2 = 0,
NUMBER f3 = 0, NUMBER val = 0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664971 \h <span
><span
>23<span
>

<span
class=MsoHyperlink>Persistent variables:<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664972 \h <span
><span
>23<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentStrAdd(STRING uniquevarname, STRING
strvariableToSave);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664973 \h <span
><span
>24<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentNumAdd(STRING uniquevarname, NUMBER
numvariableToSave);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664974 \h <span
><span
>24<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentArrAdd(ARRAY array, STRING name, NUMBER type,
NUMBER nelems); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664975 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentStrSet(STRING varname, STRING
strvariableToSave, BOOL fAutoAdd=true);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664976 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>NUMBET xxPersistentNumSet(STRING varname, NUMBER
numvariableToSave, BOOL fAutoAdd=true);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664977 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentArrSet(ARRAY array, STRING name, BOOL fAutoAdd,
NUMBER type, NUMBER nelems);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664978 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>BOOLEAN xxPersistentIsExist(STRING varname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664979 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>VARIANT xxPersistentGet(STRING varname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664980 \h <span
><span
>25<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentDel(STRING varname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664981 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentDelAll();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664982 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>STRING xxPersistentGetFirstName();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664983 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>STRING xxPersistentGetNextName(STRING thisname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664984 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentGetType(STRING varname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664985 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentGetLen(STRING varname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664986 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>BOOLEAN xxPersistentIsChanged();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664987 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxPersistentForceSave();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664988 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxIsStrEmpty(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664989 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxIsNumEmpty(NUMBER num);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664990 \h <span
><span
>26<span
>

<span
class=MsoHyperlink>NUMBER xxIsEmptyVal(NUMBER num);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664991 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxGetNelems(ARRAY arr);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664992 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxBitShiftLeft(NUMBER num, NUMER nBits);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664993 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxWLclear(NUMBER wl);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664994 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxWLclearByBits(NUMBER bits_32_to_63, NUMBER bizs_0_to_31);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664995 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxWLrandomFill(NUMBER destWL, NUMBER srcWL, NUMBER maxN);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664996 \h <span
><span
>27<span
>

<span
class=MsoHyperlink>NUMBER xxWLaddTicker(STRING ticker, NUMBER wl);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664997 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>NUMBER xxWLdelTicker(STRING ticker, NUMBER wl);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664998 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>NUMBER xxWLexport(STRING filename, NUMBER wl, NUMBER fAppend=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44664999 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>NUMBER xxWLimport(STRING filename, NUMBER wl, NUMBER reserved=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665000 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>Equivalent TickerXXX() functions.<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665001 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLtickerFirst(NUMBER wl);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665002 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLtickerNext<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665003 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLtickerPrev<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665004 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLtickerLast<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665005 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLtickerCount(wl=-1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665006 \h <span
><span
>28<span
>

<span
class=MsoHyperlink>STRING xxWLrefresh();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665007 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>STRING xxABtoolVersionStr();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665008 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>STRING xxABtoolVersionStr2();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665009 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxABtoolVersionNum();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665010 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxABtoolVersion(NUMBER func); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665011 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxABtoolMinRequiredVersion(NUMBER iMinRequiredVersion);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665012 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxAmiBrokerVersionNum();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665013 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxViewRefresh();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665014 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxRand(NUMBER range);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665015 \h <span
><span
>29<span
>

<span
class=MsoHyperlink>NUMBER xxRandGetSeed();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665016 \h <span
><span
>30<span
>

<span
class=MsoHyperlink>NUMBER xxRandSetSeed(NUMBER seed);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665017 \h <span
><span
>30<span
>

<span
class=MsoHyperlink>STRING xxGetTmpFileName(STRING directory="", STRING
filemask, BOOL AfReturnFullPath=false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665018 \h <span
><span
>30<span
>

<span
class=MsoHyperlink>NUMBER xxType(STRING typename);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665019 \h <span
><span
>31<span
>

<span
class=MsoHyperlink>STRING xxTypeToStr(NUMBER typecode); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665020 \h <span
><span
>32<span
>

<span
class=MsoHyperlink>xxClass stuff (experimental)<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665021 \h <span
><span
>32<span
>

<span
class=MsoHyperlink>HANDLE xxClassCreate(STRING name, HANDLE hParent=-1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665022 \h <span
><span
>32<span
>

<span
class=MsoHyperlink>HANDLE xxClassFirst();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665023 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>HANDLE xxClassNext(HANDLE h);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665024 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>BOOL xxClassSave(STRING filename);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665025 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>BOOL xxClassLoad(STRING filename);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665026 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>NUMBER xxSizeOfType(NUMBER typecode);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665027 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>STRING xxStudyGetNext(STRING currentStudyId, NUMBER chartId=1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665028 \h <span
><span
>33<span
>

<span
class=MsoHyperlink>FTP Functions. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665029 \h <span
><span
>34<span
>

<span
class=MsoHyperlink>NUMBER xxHttpFileGet(STRING
localfilename, STRING URLstring, NUMBER retryMax=3);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665030 \h <span
><span
>34<span
>

<span
class=MsoHyperlink>NUMBER xxFtpFileGet(STRING localfilename, STRING remoteserver,
STRING remotedirectory, STRING remotefilename,<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665031 \h <span
><span
>34<span
>

<span
class=MsoHyperlink>NUMBER xxFtpFilePut(STRING localfilename, STRING remoteserver,
STRING remotedirectory, STRING remotefilename, STRING
loginname="anonymous",
loginpassword="sampleuser@xxxxxxxxx", fBinary=1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665032 \h <span
><span
>34<span
>

<span
class=MsoHyperlink>Windows registry & Environment  functions:<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665033 \h <span
><span
>35<span
>

<span
class=MsoHyperlink>NUMBER xxRegistryPutStr(STRING YourCompanyName, STRING RegKey,
STRING RegItem, STRING RegItemVal);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665034 \h <span
><span
>35<span
>

<span
class=MsoHyperlink>NUMBER xxRegistryPutInteger(STRING YourCompanyName, STRING RegKey,
STRING RegItem, NUMBER RegItemVal);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665035 \h <span
><span
>36<span
>

<span
class=MsoHyperlink>NUMBER xxRegistryPutFloat(STRING YourCompanyName, STRING RegKey,
STRING RegItem, NUMBER RegItemVal);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665036 \h <span
><span
>36<span
>

<span
class=MsoHyperlink>NUMBER xxRegistryPutNumArray(ARRAY array, STRING YourCompanyName,
STRING RegKey, STRING RegItem, TypeOfDataInArray, NUMBER Nelems);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665037 \h <span
><span
>36<span
>

<span
class=MsoHyperlink>VARIANT xxRegistryGet(STRING YourCompanyName, STRING RegKey,
STRING RegItem); <span
> PAGEREF
_Toc44665038 \h <span
>36<span
>

<span
class=MsoHyperlink>Progress Functions<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665039 \h <span
><span
>36<span
>

<span
class=MsoHyperlink>NUMBER xxProgressStart();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665040 \h <span
><span
>36<span
>

<span
class=MsoHyperlink>NUMBER xxProgressText(STRING text);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665041 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>NUMBER xxProgressSetRange(NUMBER n); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665042 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>NUMBER xxProgressSetPos(NUMBER i);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665043 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>NUMBER xxProgressAdvance();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665044 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>NUMBER xxProgressEnd();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665045 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>BOOL xxProgressIsActive();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665046 \h <span
><span
>37<span
>

<span
class=MsoHyperlink>Dialogs / Message Boxes<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665047 \h <span
><span
>38<span
>

<span
class=MsoHyperlink>NUMBER xxMsgBox(STRING title, STRING caption, NUMBER flags);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665048 \h <span
><span
>38<span
>

<span
class=MsoHyperlink>STRING xxInputDlg(STRING strTitle, STRING strInitialValue);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665049 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>HANDLE xxDialogCreate(STRING caption);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665050 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>NUMBER xxDialogItemAdd(STRING caption, NUMBER itemType, NUMBER x,
NUMBER y, NUMBER xlen, NUMBER ylen, HANDLE hDlg); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665051 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>NUMBER xxDialogRun(HANDLE hDlg);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665052 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>NUMBER xxDialogItemSetStrVal(STRING value, NUMBER ordIndex, HANDLE
hDlg); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665053 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>NUMBER xxDialogItemSetNumVal(NUMBER value, NUMBER ordIndex, HANDLE
hDlg); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665054 \h <span
><span
>39<span
>

<span
class=MsoHyperlink>VARIANT xxDialogItemGetVal(NUMBER ordIndex, HANDLE hDlg);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665055 \h <span
><span
>40<span
>

<span
class=MsoHyperlink>NUMBER xxDialogDelete(HANDLE hDlg);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665056 \h <span
><span
>40<span
>

<span
class=MsoHyperlink>NUMBER xxWinOpen(NUMBER iWin=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665057 \h <span
><span
>40<span
>

<span
class=MsoHyperlink>NUMBER xxWinText(STRING str, iWin=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665058 \h <span
><span
>40<span
>

<span
class=MsoHyperlink>NUMBER xxWinClose(NUMBER iWin=0);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665059 \h <span
><span
>40<span
>

<span
class=MsoHyperlink>Arrays<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665060 \h <span
><span
>41<span
>

<span
class=MsoHyperlink>ARRAY xxTypedArrayCreate(NUMBER nelems, NUMBER type);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665061 \h <span
><span
>41<span
>

<span
class=MsoHyperlink>NUMBER xxTypedArrayGet(ARRAY typedarray, NUMBER n, NUMBER type);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665062 \h <span
><span
>41<span
>

<span
class=MsoHyperlink>NUMBER xxTypedArraySet(ARRAY typedarray, NUMBER n, NUMBER newVal,
NUMBER type); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665063 \h <span
><span
>41<span
>

<span
class=MsoHyperlink>NUMBER xxTypedArrayInc(ARRAY typedarray, NUMBER n, NUMBER type,
NUMBER step=1); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665064 \h <span
><span
>41<span
>

<span
class=MsoHyperlink>NUMBER xxTypedArrayDec(ARRAY typedarray, NUMBER n, NUMBER type,
NUMBER step=-1); <span
> PAGEREF
_Toc44665065 \h <span
>42<span
>

<span
class=MsoHyperlink>HANDLE xxArrayCreate(NUMBER type, NUMBER strLen = 0, NUMBER
sizeOfFirstDimension, ...);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665066 \h <span
><span
>42<span
>

<span
class=MsoHyperlink>NUMBER xxArrayStrValSet(STRING strVal, NUMBER handle,
indexOfFirstDimension, ...);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665067 \h <span
><span
>42<span
>

<span
class=MsoHyperlink>NUMBER xxArrayNumValSet(NUMBER numval, NUMBER handle,
indexOfFirstDimension, ...);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665068 \h <span
><span
>42<span
>

<span
class=MsoHyperlink>VARIANT xxArrayValGet(NUMBER arrayhandle, NUMBER
indexOfFirstDimension, ...);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665069 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>NUMBER xxArrayDelete(NUMBER arrayhandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665070 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>NUMBER xxArraySave(STRING filename, NUMBER arrayhandle);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665071 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>HANDLE xxArrayLoad(STRING filename, NUMBER arrayhandle=-1);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665072 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>AB Arrays<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665073 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>NUMBER xxABArrayFirst(ARRAY arr, BOOL fIndex=true, BOOL fBool=false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665074 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>NUMBER xxABArrayNext(ARRAY arr, NUMBER ixCurrent, BOOL
fIndex=true, BOOL fBool=false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665075 \h <span
><span
>43<span
>

<span
class=MsoHyperlink>NUMBER xxABArrayPrev(ARRAY arr, NUMBER ixCurrent, BOOL
fIndex=true, BOOL fBool=false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665076 \h <span
><span
>44<span
>

<span
class=MsoHyperlink>NUMBER xxABArrayLast(ARRAY arr, BOOL fIndex=true, BOOL
fBool=false); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665077 \h <span
><span
>44<span
>

<span
class=MsoHyperlink>ARRAY xxGetEmptyABArray();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665078 \h <span
><span
>44<span
>

<span
class=MsoHyperlink>NUMBER xxABarrayNelems();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665079 \h <span
><span
>44<span
>

<span
class=MsoHyperlink>Misc. <span
> PAGEREF
_Toc44665080 \h <span
>44<span
>

<span
class=MsoHyperlink>VARIANT xxStockPropertyGet(STRING ticker, STRING property, NUMBER
arg = 0); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665081 \h <span
><span
>45<span
>

<span
class=MsoHyperlink>NUMBER xxVarGetLastType();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665082 \h <span
><span
>45<span
>

<span
class=MsoHyperlink>NUMBER xxDeleteStockFromDB(STRING ticker);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665083 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>NUMBER xxRangeBarFirst();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665084 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>NUMBER xxRangeBarLast();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665085 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>NUMBER xxRangeBarOfStartDate(BOOL fExactDate = false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665086 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>NUMBER xxRangeBarOfEndDate(BOOL fExactDate = false);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665087 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>STRING xxTypeToStr(NUMBER typecode); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665088 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>NUMBER xxAAcurrentlyScannedStockNum();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665089 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>STRING xxCRC32str(STRING str);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665090 \h <span
><span
>46<span
>

<span
class=MsoHyperlink>STRING xxCRC32num(NUMBER num);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665091 \h <span
><span
>47<span
>

<span
class=MsoHyperlink>STRING xxQuoteCRC32(STRING ticker, STRING fieldid, NUMBER sYear,
NUMBER sMonth, NUMBER sDay, NUMBER eYear, NUMBER eMonth, NUMBER eDay);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665092 \h <span
><span
>47<span
>

<span
class=MsoHyperlink>NUMBER xxDelay(NUMBER milliseconds); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665093 \h <span
><span
>47<span
>

<span
class=MsoHyperlink>NUMBER xxPause(NUMBER milliseconds); <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665094 \h <span
><span
>47<span
>

<span
class=MsoHyperlink>NUMBER xxMemDbg(BOOL fEnable, BOOL fAppend, BOOL fReport, BOOL
fFullLogging, BOOL fRestart);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665095 \h <span
><span
>47<span
>

<span
class=MsoHyperlink>NUMBER xxGetSystemMetrics(NUMBER Category, NUMBER Item);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665096 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>Scripting<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665097 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>NUMBER xxScriptEncrypt()<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665098 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>NUMBER xxScriptDecrypt();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665099 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>NUMBER xxScriptRun();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665100 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>EasyDLL<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665101 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>HANDLE xxDLLload(STRING dllname);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665102 \h <span
><span
>48<span
>

<span
class=MsoHyperlink>Date / Time<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665103 \h <span
><span
>49<span
>

<span
class=MsoHyperlink>STRING xxABDatenumToDatestr(NUMBER ABdatenum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665104 \h <span
><span
>49<span
>

<span
class=MsoHyperlink>NUMBER xxDatestrToABdatenum(STRING datestr);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665105 \h <span
><span
>49<span
>

<span
class=MsoHyperlink>STRING xxABtimenumToTimestr(NUMBER ABtimenum);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665106 \h <span
><span
>49<span
>

<span
class=MsoHyperlink>NUMBER xxTimestrToABtimenum(STRING timestr);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665107 \h <span
><span
>49<span
>

<span
class=MsoHyperlink>Constants<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665108 \h <span
><span
>50<span
>

<span
class=MsoHyperlink>NUMBER xxDefineConstants();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665109 \h <span
><span
>50<span
>

<span
class=MsoHyperlink>New Features<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665110 \h <span
><span
>52<span
>

<span
class=MsoHyperlink>xxAutoSync(BOOL);         
This will allow one or more user variables be updated automatically<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665111 \h <span
><span
>52<span
>

<span
class=MsoHyperlink>xxAutoSyncStatus(NUMBER); 
Returns whether the AutoSync feature is enabled or not, and other infos<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665112 \h <span
><span
>52<span
>

<span
class=MsoHyperlink>xxTickerDocOpen(ticker);  
Opens a new ticker document. This should be called from external apps
only. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665113 \h <span
><span
>52<span
>

<span
class=MsoHyperlink>xxRunScript.exe<span
>. <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665114 \h <span
><span
>52<span
>

<span
class=MsoHyperlink>NUMBER xxRunScript(strScriptFile, strResultFile, strDatabaseDir,
strStartDate, strEndDate, iAAmodule, iApplyTo, iRangeMode, iRangeN, iWatchlist,
fRestoreScript); <span
> PAGEREF
_Toc44665115 \h <span
>52<span
>

<span
class=MsoHyperlink>ABtool/Functions.afl<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665116 \h <span
><span
>53<span
>

<span
class=MsoHyperlink>xxForeign(ticker, field);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665117 \h <span
><span
>53<span
>

<span
class=MsoHyperlink>DumpPersistentStatus();<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665118 \h <span
><span
>53<span
>

<span
class=MsoHyperlink>DeleteStocksWithoutQuotes(watchlistnbr);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665119 \h <span
><span
>53<span
>

<span
class=MsoHyperlink>DeleteStocksFromDB(iWL);<span
> <!---hide:screen;text-decoration:none;
text-underline:none'><span
> PAGEREF _Toc44665120 \h <span
><span
>53<span
>

<!---fareast-font-family:
"MS Mincho"'><span
> 

Highlights<span
> 

HIGHLIGHTS
OF THIS VERSION (see also History and ToDoList):

-------------------------------------------------------------------------------------------------

030623Mo
1.0.0

<span
>  - Beta period ended. Version 1.0.0 released

<span
>  - Max dynamic dialogs simultanously usable
increased from 2 to 5. If more

<span
>    required than the dialog(s) should be put
into some user defined AFL functions

<span
>    and redefined/reused there. BTW, don't
forget to delete the dialog if it is no 

<span
>    longer needed.

<span
>  - New:
xxABtoolMinRequiredVersion(iMinRequiredVersion);

<span
>    If your script requires a specific minimum
version of ABtool then put

<span
>    this at the beginning of your main script.

<span
>  - New: xxStrUpr(s), xxStrLwr(s)<span
>   for converting strings to upper or lower
case.

<span
>  - Update: ABtool/Functions.afl

 

-------------------------------------------------------------------------------------------------

 

 

INSTALLATION:<span
>

<span
>  Quit AmiBroker, put the ABtool.dll file into
the Plugins folder in the AmiBroker home directory,


<span
>  and xxRunScript.exe into the ABtool
subdirectory under the AmiBroker base directory, and restart

<span
>  AmiBroker.

 

 

TRADEMARKS
/ COPYRIGHTS:

<span
>  AmiBroker and AmiQuote are trademarks of
AmiBroker.com (www.amibroker.com);

<span
>  Excel and Windows are (c) and trademarks of
Microsoft Corp.

<span
>  Portions copyright (c) Marcel Scherpenisse,
2002

<span
>  ABtool, xxTool, xxTrader, xxRankedSys,
xxToolApp, xxToolsEx are copyright/trademarks of Uenal Mutlu, 2003

<span
>  No version of this software made be
available for download on web sites or other channels. Unauthorized

<span
>  Bundling with other packages is forbidden.
Please consult the author for site licenses.

 

<span
>  ABtool (c) 2003 Uenal Mutlu
(uenal.mutlu@xxxxxxxxxxx);

 

 

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

INIT<span
>   


NUMBER
xxABtoolInit();

<span
>      Reinitializes the DLL, frees allocated
resources. 

<span
>      For example after script errors any
allocated resources can not be freed 

<span
>      by the user (fe. TableDelete()), because
the script was terminated due to errors... 


<span
>      You can place this at the very beginning
of your script.



 



Ticker
/ Watch lists

<span
>     The very first call of any of the
TickerXXX functions takes a little

<span
>     bit longer to execute due to scanning the
database and building an

<span
>     internal table (snapshot). All subsequent
calls are much faster. 

<span
>     After doing any changes to any of the
watchlists call TickerRefresh().

<span
> 

<span
>     STRING xxTickerFirst(NUMBER
watchlistnum);             

<span
>       Gets first ticker in the watchlist.

<span
>       (To operate on all stocks in the
database first put them all into a WL);

<span
>       Return value: first ticker, or empty
string ("") if watchlist is empty

 

<span
>     STRING
xxTickerNext(NUMBER watchlistnum);

<span
>       Return value: next ticker, or empty
string ("") if end of list was reached

 

<span
>     STRING
xxTickerPrev(NUMBER watchlistnum);

<span
>       Return value: prev ticker, or empty
string ("") if the start of list was reached

 

<span
>     STRING
xxTickerLast(NUMBER watchlistnum);

<span
>       Return value: ticker, or empty string
("") if watchlist is empty

 

<span
>     NUMBER
xxTickerCount(NUMBER watchlistnum = -1);<span
>

<span
>       Gets number of ticker in the watchlist 

<span
>       Passing -1 gives the number of all
tickers in the database

<span
>       Return value: number of tickers, or
< 0 if error

 

<span
>     NUMBER
xxTickerRefresh()<span
>;

<span
>       Call this after any changes you made to
any of the watchlists.

<span
>       Return value: >= 0 for success, <
0 if error

 

-----------------------------------------------------------------------------

File
Operations 

<span
>    NUMBER
xxFileOpen(STRING filename, STRING mode);

<span
>       mode: "r" for opening an
existing file for read only

<span
>             "w" for write (will
create if not existing, or overwrite an existing);

<span
>             "a" for append (will
create if not existing, or overwrite an existing);

<span
>       It returns a FileHandle, which is
required for the other FileXXX functions.

<span
>       Return value: a filehandle >= 0. In
case of error it will return a value < 0.

 

<span
>     NUMBER
xxFileWriteStr(STRING str, NUMBER filehandle);<span
>

<span
>       Appends the given string to the file

<span
>       Return value: >= 0 for success, <
0 if error

 

<span
>     NUMBER
xxFileWriteNum(NUMBER number, NUMBER filehandle)<span
>;<span
>

<span
>       Appends the given number to the file
(in text format);

<span
>       Return value: >= 0 for success, <
0 if error

 

<span
>     STRING
xxFileReadLine(NUMBER filehandle);

<span
>       newline char will be removed internally

<span
>       Return value: >= 0 for success, <
0 if error

 

<span
>     NUMBER
xxFileClose(NUMBER filehandle)<span
>;

<span
>       Closes a file.

<span
>       Passing -1 closes all open files

<span
>       Return value: >= 0 for success, <
0 if error

 

<span
>     BOOL
xxFileIsExist(STRING filename);

<span
>       Returns true/false (1/0) whether the
given file exists

 

<span
>     NUMBER
xxFileDelete(STRING fname);

<span
>       Deletes the given file

 

<span
>     NUMBER
xxFileCopy(STRING sorcefilename, STRING destinationfilename);

<span
>       Copies source file to destination. Can
also be used for binary files.

 

<span
>       Example:

<span
>       xxFileCopy("E:\\Program
Files\\AmiBroker\\ABTool\\Report.csv", "E:\\Program
Files\\AmiBroker\\ABTool\\Report_copy.csv");

 

 

-----------------------------------------------------------------------------

Number
& String Functions<span
>  

<span
>   NUMBER
xxGPercent(NUMBER fromval, NUMBER toval);

<span
>       "Geometric percent". This is
a percent calculator. It works even with

<span
>       negative values, even if they are mixed
positive and negative.

<span
>       See xxGPercent_Info.txt on sample outputs

 

<span
>     ARRAY
xxGPercentA(ARRAY fromval, ARRAY toval);

<span
>       Array version of GPercent();

 

-----------------------------------------------------------------------------

<span
>  NUMBER xxMin(NUMBER
a, NUMBER b);

<span
>    Returns the smaller of a and b

 

<span
>  NUMBER xxMax(NUMBER
a, NUMBER b);

<span
>    Returns the greater of a and b

 

<span
>  NUMBER xxMod(NUMBER
a, NUMBER b);

<span
>    Returns the integer modulo (ie. the
remainder) after doing int(a) / int(b);

 

<span
>  NUMBER xxDiv(NUMBER
a, NUMBER b);

<span
>    Returns the integer part of the division
int(a) / int(b);

<span
>    If b is zero then "Division by
Zero" error will happen.

 

-----------------------------------------------------------------------------

<span
>  NUMBER
xxStrLen(STRING str);

<span
>    Returns the length
of the string excluding the string terminator (ASCII code 0);<span
>    

NUMBER
xxToNumber(STRING str);

<span
>      Converts string containing digits to a
number

 

<span
>    STRING
xxToString(NUMBER num);

<span
>      Converts number to a string

 

<span
>    NUMBER
xxToInt(NUMBER num);

<span
>      Strips the fractional part of the given
floating point value.

<span
>     NUMBER
xxRelPos(NUMBER bottom, NUMBER top, NUMBER value)<span
>;

<span
>       Calculates relative position of the
value relative to the bounds

 

<span
>       Note: in versions before 0.9.19 this
func operated on the last elements of given array arguments.

<span
>             To make it consistent, it now
accepts only single numbers. For arrays one has to use xxRelPosA().

<span
>             It is now similar to xxGPercent()
and xxGPercentA() argument types.

 

<span
>     ARRAY
xxRelPosA(ARRAY bottom, ARRAY top, ARRAY value)";

<span
>       Array version of RelPos();

 

-----------------------------------------------------------------------------

<span
>   

Table
Functions<span
>   

<span
> NUMBER xxTableCreate()<span
>;

<span
>      Returns a table handle >= 0, else
error

<span
>      This handle is required for all further
operations on this table

<span
>      See TableXXX.afl for demo application. 

<span
>  

<span
>    NUMBER
xxTableColumnAdd(STRING colname, NUMBER coltype, NUMBER tablehandle, NUMBER
strSize=16, groupId=0)<span
>;

<span
>      Appends a column definition to the table
definition

<span
>      strSize is used only if ColType is
string (3).

<span
>      ColType:

<span
>         Please see the list of data types
under xxType();

<span
>         For Strings (pass the size in the
last optional param; default is 16 bytes) 

<span
>         The default numeric type is Float

<span
>         Within AB/AFL all numerics are of
type Float, but within ABtool they can be

<span
>         any from the list. For example Int16
is 2 bytes long within ABtool, but if the

<span
>         value is passed to/from AB this will
be converted to a float and carried in a float field. 

<span
>      GroupId:

<span
>         Columns can be grouped. The default
is that all columns belong to group 0.

<span
>         Using GroupId makes programming
easier if "elements" consist of multiple columns.

<span
>         GroupId can be 0..65535 and should
corrosspondent to the "element" nbr but this is not a must.

<span
>         Use
"xxTableCol(groupId,relativeColumn)" to get the absolute column
number necessary 

<span
>         for the other table funcs.

<span
>      Attention: after adding data to any cell
the table definition no more can be

<span
>      changed. Ie. calling this function to
define additional columns will then fail.

<span
>      So, first define the table completely,
and put the data afterwards, but not in a mixed fashion.

 

<span
>    NUMBER
xxTableCol(NUMBER groupId, NUMBER relativeColumn);

<span
>      Converts the given group and the
relative column within the group to an absolute column number

<span
>      necessary for the other table functions.

<span
>      Example:

<span
>        xxTableDataAddNum(val,
row, xxTableCol(groupId,relCol,th), th);<span
>

<span
>          "relCol" is the 0 based
ordinal number within that group. 

<span
>          See the GroupId param of
xxTableColumnAdd();

<span
>      For a example application see Richs2.afl

 

<span
>    NUMBER
xxTableGroupMembersCount(NUMBER group, NUMBER th)<span
>;<span
>

<span
>      Returns the defined number of items
within the given group, or -1 if th or group is invalid

<span
>    

<span
>    NUMBER
xxTableGroupsCount(NUMBER th)<span
>;

<span
>      Returns the defined number of groups
>= 0, or -1 if th is invalid

 

<span
>    NUMBER xxTableDataAddStr(STRING
val, NUMBER row, NUMBER col, NUMBER tablehandle)<span
>;<span
>

<span
>      The cell at position row,col will be
filled with the passed string value

 

<span
>    NUMBER
xxTableDataAddNum(NUMBER val, NUMBER row, NUMBER col, NUMBER tablehandle)<span
>;<span
>

<span
>      The cell at position row,col will be
filled with the passed numeric value

<span
>      This function replaces the old
xxTableDataAddFloat() and xxTableDataAddInt32() functions.

 

<span
>    // OLD: 

<span
>    NUMBER
xxTableDataAddFloat(NUMBER val, NUMBER row, NUMBER col, NUMBER tablehandle)<span
>;<span
>

<span
>      The cell at position row,col will be
filled with the passed floating point value

<span
>      THIS FUNC IS OBSOLOTE! Use the new
xxTableDataAddNum() for all numeric types

<span
> 

<span
>    // OLD: 

<span
>    NUMBER
xxTableDataAddInt32(NUMBER val, NUMBER row, NUMBER col, NUMBER tablehandle)<span
>;<span
>

<span
>      The cell at position row,col will be
filled with the int32 representation

<span
>      of the passed floating point value (AFL
does not have int32, but float can be used);

<span
>      THIS FUNC IS OBSOLOTE! Use the new
xxTableDataAddNum() for all numeric types

 

<span
>    VARIANT
xxTableDataGet(NUMBER row, NUMBER col, NUMBER tablehandle);

<span
>      Returns cell value

<span
>      You can use VarGetLastType() to analyze
the type of the returned data.

<span
>      See also xxType();

 

<span
>    NUMBER xxTableExportBinary(STRING
filename, NUMBER tablehandle);

<span
>      Exports a table incl. all its properties
to a file in binary format. This saves space 

<span
>      on disk, and also fast loading is
possible via TableImportBinary();

 

<span
>    NUMBER
xxTableImportBinary(STRING filename, NUMBER tablehandle);

<span
>      Imports a previously via
TableExportBinary() exported table into the memory area of this tabletandle.

<span
>      The current table becomes that from the
file. Including all properties.

 

<span
>    NUMBER
xxTableSave(STRING filename, NUMBER tableHandle);

<span
>      same as TableExportBinary().

 

<span
>    NUMBER
xxTableLoad(STRING filename, NUMBER tablehandle)<span
>;<span
>

<span
>      same as TableImportBinary().

 

<span
>    NUMBER
xxTableExport(STRING filename, STRING seperator, NUMBER tablehandle, BOOL fHdrline=1,
NUMBER firstN=-1, BOOL fAppend=false)<span
>;

<span
>      Param: 

<span
>        seperator: is the field seperator
(usually the comma ",");

<span
>        fHdrLine:  controls whether a hdr line containing the field names will be
written to file

<span
>        firstN:    if -1 then all data will be exported, if n>0 then only the
first n rows will be exported.

<span
>        fAppend:   Appends to the file 

<span
>                   (Avoiding multiple
headerlines must be done by yourself: give fHdrLine=true only in the first
call...);

 

<span
>    NUMBER
TableImport(STRING filename, STRING seperator=",", STRING
reserved="", NUMBER tablehandle, NUMBER fHdrline=1, firstN=-1, NUMBER
reserved=0)<span
>;

<span
>      In this version of ABtool it is expected
that the user first defines the columns before calling this


<span
>      (in later versions an Auto-Import will
be added in which the table definition will be automatically 

<span
>      created from the import data). 

<span
>      That is: currently, columns must already
be defined before calling this! You have to analyse the

<span
>      file to import and according the column types define the columns
of out table.

<span
>      The data to import will be APPENDED to
the current table. If you don't want append, 

<span
>      then your table should be made empty
first if it cotains some data before calling this.

<span
>      Excess columns in the file are skipped.
So, if the file contains 10 columns and you

<span
>      need only the first 3, then simply
define only the first 3 via xxTableColumnAdd().

<span
>      Similar with the rows (records) to
import: you can limit it via the "firstN" parameter (-1 means
"all").

<span
>      The "seperator" parameter can
contain multiple seperator characters. Any occurence of

<span
>      one of them in the input data is treated
as field seperator. 

<span
>      Internal default is "\n\r\t".
They are appended to an internal copy of the users 

<span
>      given seperator string. The meaning of
the above field seperator characters is:

<span
>        \n NewLine

<span
>        \r Carriage Return

<span
>        \t Tab

<span
>      By default TableImport() knows only
these field seperators. You should supply the right 

<span
>      seperator used in the underlying file;
this will be mostly a comma (",").

<span
>                     

 

<span
>    NUMBER
xxTableDataClear(NUMBER tablehandle);

<span
>      Clears the user data and sets rows to 0.
The table definition and sortdefinitions remain.

<span
> 

<span
>    NUMBER
xxTableDelete(NUMBER tablehandle)<span
>;

<span
>      Deletes the table from memory.

<span
>      Passing -1 deletes all tables (if any);

<span
>       

<span
>    NUMBER
xxTableGetRowCount(NUMBER tablehandle);<span
>

<span
>      Gets the highest filled row number

 

<span
>    NUMBER
xxTableGetColCount(NUMBER tablehandle);<span
>

<span
>      Gets the number of defined columns

<span
>  

<span
>    NUMBER
xxTableSort(NUMBER tablehandle, NUMBER col, NUMBER fAscendingOrder = true,
NUMBER fIgnoreStrCase = true)<span
>;

<span
>      Sorts a table on a single column.

<span
>      Use SortEx() for sorting over multiple
fields after defining the sort columns by calling

<span
>      TableSortDefAdd() multiple times 

 

<span
>    NUMBER
xxTableSortDefAdd(NUMBER handle, NUMBER column, NUMBER fAscendingOrder = true,
NUMBER fIgnoreStrCase = true);

<span
>      Define the columns for sorting over
multiple columns via TableSortEx();

<span
>      If you want change the sort definitions
then call TableSortDefDelAll() and then

<span
>      redefine the sort columns by using
TableSortDefAdd() again

<span
>      Max 10 SortDef columns can be defined per table

<span
>      

<span
>    NUMBER
xxTableSortDefDelAll(NUMBER handle);

<span
>      Deletes the sort definitions of the
table (for TableSortEx());

 

<span
>    NUMBER
xxTableSortEx(NUMBER tablehandle);

<span
>      Sorts the table using multiple columns
for the sort (as defined via TableSortDefAdd() calls).

<span
>      Ie. before calling this call
TableSortDefAdd() to define the columns which make up the

<span
>      sort criteria. The order of the columns
is not relevant.

<span
>      Use SortEx() for sorting over multiple
fields after defining the sort columns by calling

<span
>      TableSortDefAdd() multiple times. 

 

<span
>    NUMBER
xxTableColumnFormatSet(STRING printfFormatStr, NUMBER column, NUMBER
tablehandle);

<span
>      Overrides the default print format
string for the given column to be used by the ascii exporter TableExport();

<span
>      The print format string must be a valid
"printf" like format string found in the programming languages C and
C++.

<span
>      Examples:

 

<span
>        - for Float type:

<span
>            "%f"<span
>     this is the default for Float. It prints
always with 6 decimals.

<span
>            "%.2f"<span
>   prints value left aligned and with 2
decimals

<span
>            "%8.2f"<span
>  prints value right aligned (and BLANK
prefixed) as a total of 8 chars of which 

<span
>                     the last 3 are the
decimal comma plus 2 decimals. Example: " 
123.45"

<span
>            "%08.2f" same as before
but here ZERO prefixing will be done. Example: "00123.45"

<span
>            "-8.2f"<span
>  Example: "123.45<span
>  "

<span
>            "%g"<span
>     this prints decimals only if there are
some. Very big and very small numbers are printed

<span
>                     in exponential
(scientific) notation. Example "1e20"

 

<span
>        - for String type:

<span
>             "%s"<span
>    This is the default for strings. It prints
all characters of the string

<span
>             "%15s"<span
>  prints 15 chars and rightaligning the value
if it is shorter than 15 chars

<span
>             "%-15s" same as above,
but leftaligns

<span
>              %-15.15s"<span
>  the value is cutted to 15 chars if it is
longer, or padded up to 15 with blanks. result is left aligned.

<span
>                         if value is empty
("") then 15 blanks will be printed

<span
>              

<span
>        - for the Integers Int16, Int32, and
Byte:

<span
>             "%d"<span
>    The default for these integers: it prints
left aligned and of course without any decimals

<span
>             "%4d"<span
>   4 digits, right aligned, BLANKS prepended
if there are less digits (but if value has more digits than all digits will be
printed);

<span
>             "%04d"<span
>  same as above but ZEROES will be prepended
if the number has less than 4 digits

 

<span
>        With numbers a rounding up/down will
be done if there are more decimals (not a simple cutting).

<span
>        And: if the format string is too
"small" then still all digits will be printed. 

<span
>             fe. specifiying "%5.2f"
for a float value which is 1000000 wll result in "1000000.00"

<span
>        Reminder: in the format string
"%5.2" the first number (5) specifies the TOTAL number of CHARS of
the output,

<span
>                  of which the last 2 are
decimal digits along with a decimal point before them.

<span
>        There are much more combinations and
formats possible. Please take a search for "printf format specifiers"
on the web.

<span
>        (This information was from memory. If
you find any discrepancies let me know please.);

<span
>       
See also file Table_1.afl, xxFormatNum() and xxFormatStr(), and file
FormatXXX.afl 

 

<span
>    NUMBER
xxTableGetRowLen(NUMBER tablehandle);

<span
>      REturns the length of each row in bytes.

<span
> 

 

<span
>    Tips for Tables:

 

<span
>      - if you want the columns not all be
exported, or in a different order, or even

<span
>        with additional data, then you can
achieve this by simply creating a second 

<span
>        table with the wanted columns and
their order, and copying relevant columns 

<span
>        from the first table to the second,
and exporting the second table only.

 

<span
>      - You can also export a limited number
of rows (fe. only the first 15).

<span
>        See the "firstN" parameter
of xxTableExport(). To export only the last N rows

<span
>        then either manually move them to the
top, or, if in case of a sorted table then

<span
>        do a reverse sort by using TableSort()
and setting the parameter "fAscendingOrder" 

<span
>        to 0 and then use TableExport() with
"firstN".

<span
> 

<span
>      - there is no limit neither on the
number of tables 

<span
>        nor on the number of columns per table
and also

<span
>        not on the number of records (rows) a
table can hold.

<span
>        Also columns of type 3 (string) can be
of any length.

<span
>        The default is 16 if not specified;
this can be changed

<span
>       
during the definition of a table (the "strSize" param of 

<span
>          TableColumnAdd(STRING
colname, NUMBER coltype, NUMBER tablehandle, NUMBER strSize = 16)<span
>;<span
>

 

<span
>      - the number of rows in a table is not
fixed. For example filling any cell 

<span
>        in row 150 (which is the 151st row; counting from zero) of a
table curently

<span
>        containing only 100 rows (ie. row 0 to
99) makes room not only for the row 150

<span
>        but also for the rows 100 to 149 and
initializes all columns of these new rows

<span
>        to binary zeros.

 

 

-----------------------------------------------------------------------------

<span
> 

Log
Files 

<span
>  NUMBER xxLog(STRING
str);

<span
>   NUMBER xxLogNum(NUMBER num)<span
>;

<span
>     Both variants log the passed value to the
default user log file ABtool/User.log .

<span
>     You can specify a different log file of
your own (use LogFileSet() function for this);

 

<span
>   NUMBER
xxLogfileSet(STRING logfname)<span
>;

<span
>     Sets the name of file where all logging
will be written (appended) to.

<span
>     If you specify a wrong directory then
your logging requests will fail.

<span
>     If a directory name is present in the
passed string then either use two

<span
>     backslashes or a single slash
"/".

 

<span
>   NUMBER
xxLogfileDel()<span
>;

<span
>     Deletes the logfile

 

<span
>   NUMBER
xxSysLog(STRING str)<span
>;

<span
>     Adds user string to ABtool's own log file
(see below).

<span
>   

<span
>   Remarks:

<span
>     ABtool.dll uses its own log file
ABtool_dll.log which is located in the ABtool

<span
>     directory under the AB directory. This
log file will be overwritten after each

<span
>     new loading of the plugin. User log files won't be overwritten,
so watch out 

<span
>     their sizes. The default file name for
the user log after loading the plugin is

<span
>     "ABtool/User.Log", and can be
changed by calling xxLogfileSet(filename).

<span
>     

-----------------------------------------------------------------------------

<span
>   NUMBER xxExec(STRING
program);

<span
>     Executes an external program, batch, or
command file. The string must contain the name

<span
>     of the program, and if it expects some
parameters then them too, all seperated by a blank.

<span
>     The return value is either the return
value of the program or of the command processor.

<span
>     With some programs this func will return
immediately after start of the program.

<span
>     But there are also some other programs
where this func will return only after the

<span
>     other program terminates.

<span
>     Improved (v0.9.18+): if there are some
blanks in the path then the whole string will 

<span
>       be enclosed in quotes if not already
done by the user (but it is assumed that there 

<span
>       are no parameters for the program.
Otherwise use the "embedding in quotes" method below).

 

<span
>     Examples:

 

<span
>     Start Excel: 

<span
>     xxExec("\"C:\\Program
Files\\Microsoft Office\\Office\\Excel.exe\"");

 

<span
>     Note: \" is evaluated to a single
", similar to the \\ --> \

 

<span
>     To start Excel and pass it a filename
which too contains blanks embed each part within quotes:

<span
>     xxExec("\"C:\\Program
Files\\Microsoft Office\\Office\\Excel.exe\" \"C:\\Program
Files\\AmiBroker\\ABTool\\Report.csv\"");

 

<span
>     Note: There is a blank between both
parts.

 

-----------------------------------------------------------------------------

<span
>   STRING
xxEnvGet(STRING envVar);

<span
>     Gets the value of the given environment
variable

<span
>     Example: xxEnvGet("PATH");<span
>  returns the PATH variable with its value

 

<span
>   NUMBER
xxEnvSet(STRING envVarAndValue)<span
>;

<span
>     Adds or updates the given environment
variable with the new content

<span
>     The envVar must be like this:<span
>  "MYENV=MyVal"

<span
>     Do not add too much new variables,
because there is only a limited space (this is operating system specific).

<span
>     

<span
>   NUMBER
xxEnvDel(STRING envVar)<span
>;

<span
>     Removes the environment variable and its
value.

<span
>     Specify only the name.

 

<span
>   STRING
xxEnvGetValOnly(STRING envname);

<span
>     Returns the value string of that
environment variable without "envName=" part, 

<span
>     or "" if envvar does not exist 

 

<span
>   NUMBER
xxEnvSetValOnly(STRING envVarName, STRING value);

<span
>     Alternative to xxEnvSet(), here the
"=" does not need to be given

 

-----------------------------------------------------------------------------

<span
>   STRING xxDirCurGet()<span
>;<span
>

<span
>     Returns the current directory incl. drive
letter

 

<span
>   NUMBER
xxMkDir(STRING dir)<span
>;

<span
>     Creates directory which can consist of
multiple parts like "test1/test2/test3".

 

-----------------------------------------------------------------------------

------------------------------------------------------------------

<span
>   STRING
xxFormatNum(STRING formatstr, NUMBER numvalue, ...);

<span
>     Flexible number formatting using C/C++
like printf formats

<span
>     Returns: the formatted result

<span
>     Example:

<span
>       resStr = xxFormatNum("%5.2f
%10.5f", valA, valB);

<span
>     Remarks: 

<span
>       Up to 10 numeric values can be passed

<span
>       This is similar to the sprintf()
function in C/C++

<span
>     See also info under
xxTableColumnFormatSet(), file FormatXXX.afl, and xxFormatStr();

 

<span
>   STRING
xxFormatStr(STRING formatstr, STRING strvalue);

<span
>     Flexible string formatting using C/C++
like printf formats

<span
>     Returns: the formatted result

<span
>     Example:

<span
>       resStr = xxFormatStr("%15s",
strA);

<span
>     Remarks: 

<span
>       Here only 1 value can be passed

<span
>       This is similar to the sprintf()
function in C/C++

<span
>     See also info under
xxTableColumnFormatSet, file FormatXXX.afl, and xxFormatNum();

 

 

-----------------------------------------------------------------------------

   NUMBER
xxDateToNumber(NUMBER func1, NUMBER func2, NUMBER y, NUMBER m, NUMBER <span
>d);<span
>

<span
>      Converts Y,M,D to a DN (daynumber) or
H,M,S to a TN (timenumber);

<span
>      For times pass h,m,s

<span
>      Returns a DN (or the DOW if func1=10)
for the passed Y,M,D, or a TN for the pased H,M,S, 

<span
>      depending on func1 as follows, or -1 for
error

<span
>      

<span
>         func1:

<span
>           0 (JDNA): Astronomical <span
> Julian Day Number (day 0 is -4712-01-01
12:00:00);

<span
>           1 (JDN) : Julian Day Number<span
>               (day 0 is -4712-01-01
00:00:00);

<span
>           2 (MJDN): Modified JDN<span
>                    (day 0 is<span
>  1858-11-17 00:00:00);

<span
>           3 (LDNA): Astronomical<span
>  Lilian Day Number (day 1 is<span
>  1582-10-15 12:00:00);

<span
>           4 (LDN) : Lilian Day Number<span
>               (day 1 is<span
>  1582-10-15 00:00:00);

<span
>           5 (DNAB): ABdaynum<span
>                        (for dates >= 1900;
NOT sequential!);

<span
>           6 (DNUM): daynum<span
>                          (for dates >=
1900);

<span
>           7 (TNAB): ABtimenum<span
>                       (for times; NOT
sequential!);

<span
>           8 (TNUM): timenum<span
>                         (for times);

<span
>           9 (YTD) : Year to day<span
>                     (days since Jan 1 of the
current year);

<span
>          10 (DOW) : Day of week of the given
date   (0=Sunday, 1=Monday, ...,
6=Saturday);

<span
>          11 (UNIX_X):<span
>     Unix time for given y,m,d (Seconds since
Jan 1, 1970 up the given y,m,d; HH:MM:SS either 0 or current time depending on
func2));

<span
>          12 (UNIX_Today): Unix time for
today       (Seconds since Jan 1, 1970
up to today; HH:MM:SS either 0 or current time depending on func2));

<span
>        func2:

<span
>           0 ignore current time

<span
>           1 take also into account the
current time (will be returned in the fractional part of the number);

 

<span
>       In all cases if y=m=d=0 or h=m=s=0
given then the current date or time is 

<span
>       taken depending on the func nbr.

<span
>       There is no plausibility check done on
the given y,m,d or h,m,s

<span
>       Return values < 0 indicate error
(fe. if a wrong funct nbr was given

<span
>       You can compare the results of JDN
(func1 = 1) with the date calculator at http://www.nr.com/julian.html

<span
>       See also: file xxCalendar.afl, xxDateFromNumber(),
Dow(), DayOfWeek();

<span
>    

 

<span
>    NUMBER
xxDateFromNumber(NUMBER func1, NUMBER func2, NUMBER daynumber)<span
>;<span
>

<span
>      Converts back to Y,M,D or H,M,S from a
daynumber DN or a timenumber TN as was returned 

<span
>      by xxDateToNumber().

<span
>      All dates should be >= -4800-03-01

<span
>      Returns one of Y,M,D,H,M,S depending on
func1, or -1 for error

<span
>      For times pass the received timenum

<span
>         func1:

<span
>           0 (JDNA): Astronomical<span
>  Julian Day Number (day 0 is -4712-01-01
12:00:00);

<span
>           1 (JDN) : Julian Day Number<span
>               (day 0 is -4712-01-01
00:00:00);

<span
>           2 (MJDN): Modified JDN<span
>                    (day 0 is<span
>  1858-11-17 00:00:00);

<span
>           3 (LDNA): Astronomical<span
>  Lilian Day Number (day 1 is<span
>  1582-10-15 12:00:00);

<span
>           4 (LDN) : Lilian Day Number<span
>               (day 1 is<span
>  1582-10-15 00:00:00);

<span
>           5 (DNAB): ABdaynum<span
>                        (for dates >= 1900;
NOT sequential!);

<span
>           6 (DNUM): daynum<span
>                          (for dates >=
1900);

<span
>           7 (TNAB): ABtimenum<span
>                       (for times; NOT
sequential!);

<span
>           8 (TNUM): timenum<span
>                         (for times);

<span
>           9 (YTD) : Year to day<span
>                     (days since Jan 1 of the
current year);

<span
>          10 reserved

<span
>          11 (UNIX_X): Converts back a Unix time to y,m,d,h,mi,s and
returns one of the date parts depending on func2

<span
>          12 (UNIX_X): Converts back a Unix
time to y,m,d,h,mi,s and returns one of the time parts depending on func2

<span
>         func2:

<span
>           0 Year from DN     (or
Hour from TN);

<span
>           1 Month from DN<span
>    (or Minute from TN)<span
>  

<span
>           2 Day from DN<span
>      (or Second from TN);

 

<span
>       There is no plausibility check done on
the given dn or tn

<span
>       Return values < 0 indicate error (fe.
if a wrong funct nbr was given

<span
>       You can compare the results of JDN
(func1 = 1) with the date calculator at http://www.nr.com/julian.html

<span
>       See also: file xxCalendar.afl,
xxDateToNumber(), Dow(), DayOfWeek();

 

 

 

 

-----------------------------------------------------------------------------

<span
>    NUMBER
xxGetErrno();

<span
>      Returnes the success/fail code of the
last ABtool function called.

<span
>      Calling this function clears the errno.
Usual meaning is: >=0 for success, else error was happened

<span
>      Beware: not all functions covered yet,
currently only the PersistentVarXXX functions

<span
>              do set this, all the other
ABtool functions will follow soon.

 

-----------------------------------------------------------------------------

<span
>    <a
name="_Toc44664968">STRING xxStrUpr(STRING string)<span
>;<span
>

<span
>      Returns upper case string

<span
>    

<span
>    STRING
xxStrLwr(STRING string);

<span
>      Returns lower case string

 

<span
>    NUMBER
xxStrRepl(STRING str, STRING substr, STRING newsubstr, reserved=0, fAll=true);

<span
>      Within a string replaces oldsubstr by
newsubstr.

<span
>      If fAll=true is given then all
occurences of oldsubstr are replaced by newsubstr.

<span
>      If newsubstr is empty then oldsubstr is
removed from the string.

<span
>      Returns the number of replacements done.


<span
>      Example:

<span
>                mystr = "this will go to
a CSV, but there is a comma in it!....";

<span
>                xxStrRepl(mystr,
",", " ", 0, true);

<span
>        This replaces the comma in mystr by a
blank char.

<span
> 

-----------------------------------------------------------------------------

<span
>    VARIANT
xxABI(STRING s1, STRING s2, NUMBER f1, NUMBER f2 = 0, NUMBER f3 = 0, NUMBER val
= 0);

<span
>      ABtool Automation Interface to AB from
within AFL.

<span
>      Gets/Sets AB settings, or performs AB
tasks using AB API calls.

<span
>      Using this you can automate programmatically many of the manual
tasks.

<span
>      Before using this func please read the
warnings in the file "xxABI_Reference.txt".

<span
>      There you will find a table containing
all possible parameters for this func.

 

<span
>      Example: to set the include watchlist setting to the watchlist
nbr 9

<span
>        xxABI("", "",
4,1,4, 9);

 

<span
>      Example: to open the Report window:

<span
>        xxABI("", "", 12,
0);

 

<span
>      Example: to save the Report in an html
file of your own

<span
>        xxABI("MyReport.html",
"", 12, 1);

<span
>     

-----------------------------------------------------------------------------

<span
>    Persistent
variables:

 

<span
>    AB variables of type String and Number can
be saved in persistent storage and

<span
>    recalled from any script. If AB quits or
ABtool.dll gets unloaded, then these 

<span
>    variables are automatically saved in the
binary file ABtool/PersistentVars.abt. 

<span
>    At the next loading of the plugin (which
is automatically done by AB), these variables 

<span
>    are read into memory and can again be
accessed as before. They retain their last values.

<span
>    

<span
>    Each persistent variable must be given a
unique name. There is no limitation neither

<span
>    on the number of variables nor their
lengths (numbers are fixed length, strings are 

<span
>    variable length).

<span
>    

<span
>    There are also some functions which give
some information about a persistent variable:

<span
>    its type (1=number, 3=string), and its
length.

<span
>    

<span
>    The variables are saved automatically, but
you can force ABtool to save them immediately

<span
>    by using the function
xxPersistentForceSave().

 

<span
>    ABtoolInit(), which normally reinitializes
ABtool by releasing all still open handles

<span
>    and memory, does NOT affect these
variables. If you get rid of the variables you can

<span
>    use xxPersistentDelAll(), or, after
quitting AB, manually delete the file (see above).

 

<span
>    Names of all persistent variables can be
"browsed" through by the help of the functions

<span
>    xxPersistentGetFirstName() and
xxPersistentGetNextName(). For example:

<span
>        x = xxPersistentGetFirstName();

<span
>        while (x != "");

<span
>          {

<span
>            //... do something ...

 

<span
>            // and go to the next persistent
variable name after this one

<span
>            x =
xxPersistentGetNextName(x);   

<span
>          }

<span
>    

<span
>    NUMBER
xxPersistentStrAdd(STRING uniquevarname, STRING strvariableToSave)<span
>;<span
>

<span
>      Saves a string variable in the global
and persistent storage.

 

<span
>    NUMBER
xxPersistentNumAdd(STRING uniquevarname, NUMBER numvariableToSave)<span
>;<span
>

<span
>      Saves a numeric variable in the global
and persistent storage.

 

<span
>    NUMBER
xxPersistentArrAdd(ARRAY array, STRING name, NUMBER type, NUMBER nelems)<span
>;<span
>

<span
>      Saves the given array in the persistent
storage. Name must not be existing yet.

 

<span
>    NUMBER xxPersistentStrSet(STRING
varname, STRING strvariableToSave, BOOL fAutoAdd=true);

<span
>      Updates the persistent string variable.

<span
>      If fAutoaAdd=true then the var will be
added if not preseent yet

 

<span
>    NUMBET
xxPersistentNumSet(STRING varname, NUMBER numvariableToSave, BOOL
fAutoAdd=true);

<span
>      Updates the persistent numeric variable.

<span
>      If fAutoaAdd=true then the var will be
added if not preseent yet

 

<span
>    NUMBER
xxPersistentArrSet(ARRAY array, STRING name, BOOL fAutoAdd, NUMBER type, NUMBER
nelems)<span
>;


<span
>      Saves the given array in the persistent
storage replacing previous item.

<span
>      If fAutoAdd is false and there is no
previous item under this name then error will be returned.

<span
>      If fAutoAdd is true then either an Add
or Change will be made.

 

<span
>    BOOLEAN
xxPersistentIsExist(STRING varname);

<span
>      Returns true or false (1 or 0) whether
if the given identifier was found in the

<span
>      persistent variables area.

<span
>       

<span
>    VARIANT
xxPersistentGet(STRING varname);

<span
>      Returns the persistent variable.

<span
>      Whether the variable was found or not
can be checked with xxGetErrno();

<span
>      immediately after this. If xxGetErrno()
returns 0 then it was successful,

<span
>      otherwise the given name was not saved
in the persistent storage.

<span
>      Beware: xxGetErrno() clears the errno,
so you shouldn't call it repeatedly.

<span
>      Example:

<span
>         x =
xxPersistentGet("myvar");

<span
>         if (xxGetErrno() == 0);

<span
>           { // "myvar" was found in
the list of persistent variables.

<span
>             // x contains a copy of myvar.
work with x, and later update the persistent copy

<span
>             // by calling
xxPersistentStrSet() or xxPersistentNumSet() depending on its type

<span
>             //...

<span
>             ; 

<span
>           } 

<span
>      Another method is to use PersistentVarIsExist(varname).

 

<span
>    NUMBER
xxPersistentDel(STRING varname)<span
>;

<span
>      Deletes the persistent variable.

 

<span
>    NUMBER
xxPersistentDelAll()<span
>;

<span
>      Deletes all persistent variables.

 

<span
>    STRING
xxPersistentGetFirstName();

<span
>      Returns the name of the first persistent
variable

<span
>      Beware: they are not sorted by any
means.

<span
>       

<span
>    STRING
xxPersistentGetNextName(STRING thisname);

<span
>      Returns the next persistent variables
name which comes (in memory) after the given one.

<span
>      Beware: they are not sorted by any
means.

 

<span
>    NUMBER
xxPersistentGetType(STRING varname);

<span
>      Returns the data type id of the
persistent variable

<span
>      Types: 1=Number, 3=String

<span
>      Return value -1 means variable not
found.

 

<span
>    NUMBER
xxPersistentGetLen(STRING varname);

<span
>      Returns the length of the user data of
this variable in bytes.

<span
>      In AB numeric types have a fixed length
of 4, strings have length >= 0.

 

<span
>    BOOLEAN
xxPersistentIsChanged();

<span
>      Returns true if the persistent storage
was modified by adding, deleting, or changing

<span
>      of any of the persistent variables.

 

<span
>    NUMBER
xxPersistentForceSave()<span
>;

<span
>      Forces an immediate saving of the data.
Normally saving is done during

<span
>      plugin unloading when AB quits. 

 

 

-----------------------------------------------------------------------------

<span
>   NUMBER
xxIsStrEmpty(STRING str);

<span
>     Returns true if string is not empty

 

<span
>   NUMBER
xxIsNumEmpty(NUMBER num);

<span
>     Returns true if number is not empty
("empty" in AB is defined as -1e10).

<span
>     You can also use the constant xxEMPTYVAL;
see xxDefineConstants();

<span
>     Note: always use this function rather
than doing a comparison against -1e10 or xxEMPTYVAL, 

<span
>           because AFL seems to have a bug
with such direct comparisons of -1e10. There are also

<span
>           the AFL functions IsNull() and
IsEmpty() for such comparisons.

<span
>           That is: use xxEMPTYVAL for setting
a variable, but use xxIsNumEmpty() for testing,

<span
>           and don't use something like
"if (myvar == -1e10)" or "if (myvar == xxEMPTYVAL)".

 

<span
>   NUMBER
xxIsEmptyVal(NUMBER num);

<span
>     Same as xxIsNumEmpty();

 

<span
>   NUMBER
xxGetNelems(ARRAY arr);

<span
>     Returns number of elements of the array.
In AB all arrays have same 

<span
>     size (number of elements). This gives the
same value as "Barcount" does.

 

<span
>   NUMBER
xxBitShiftLeft(NUMBER num, NUMER nBits);

<span
>     Bitwise left shift n bits of a number.
Number will be first converted

<span
>     to an integer value. 

<span
>   

-----------------------------------------------------------------------------

<span
>   NUMBER
xxWLclear(NUMBER wl);

<span
>     Clears given watchlist.

<span
>     

<span
>   NUMBER
xxWLclearByBits(NUMBER bits_32_to_63, NUMBER bizs_0_to_31);

<span
>     Performs a "groupwise" clearing
of watchlists. The position (0..31);

<span
>     of each 1 bit in the given numbers
represent the underlying watchlist number.

<span
>     The 64 watchlists of AB are distributed
over 2 number fields of size 32 bit.

<span
>     Example: the following clears the
watchlists 39 and 2 at the same time.

<span
>       xxWLclearByBits(xxBitShiftLeft(1, 7),
xxBitShiftLeft(1, 2));

<span
>     Beware: this is a little bit complicated
to use. It is recommended to use

<span
>     xxWLclear for single watchlist
operations.

 

<span
>   NUMBER
xxWLrandomFill(NUMBER destWL, NUMBER srcWL, NUMBER maxN);

<span
>     Fills dstWL from srcWL by randomly
selecting up to maxN tickers from srcWL.

<span
>     Before calling this maybe the dstWL
should be cleared by calling xxWLclear().

<span
>     The random selection is "true"
random, ie. it is not the same sequence after

<span
>     each start of AB. 

<span
>    

<span
>   NUMBER
xxWLaddTicker(STRING ticker, NUMBER wl);

<span
>     Adds ticker to the given watchlist.

<span
>         

<span
>   NUMBER
xxWLdelTicker(STRING ticker, NUMBER wl);

<span
>     Removes ticker from the given watchlist.

 

<span
>   NUMBER
xxWLexport(STRING filename, NUMBER wl, NUMBER fAppend=0);

<span
>     Exports tickers in watchlist to a file.
If filename is "" then a file 

<span
>     selection dialog will be opened. If wl=-1
then all tickers in the 

<span
>     database will be exported.

<span
>     The text file contains one ticker per
line.

 

<span
>   NUMBER xxWLimport(STRING
filename, NUMBER wl, NUMBER reserved=0);

<span
>     Imports tickers from a file into the
given watchlist. If filename is ""

<span
>     then a file selection dialog will be
opened.

<span
>     Beware: it is assumed that each line
contains only one ticker; only

<span
>     the first "word" in the line is
imported, the rest ignored.

<span
>    

-----------------------------------------------------------------------------

<span
>  Equivalent
TickerXXX() functions.   

<span
>  

<span
>  STRING
xxWLtickerFirst(NUMBER wl);

<span
>    Returns the first ticker in the given wl,
or "" if wl is empty.

<span
>    

<span
>  STRING xxWLtickerNext

<span
>    Returns the next ticker in the given wl,
or "" if wl is empty.

<span
>    

<span
>  STRING xxWLtickerPrev

<span
>    Returns the prev ticker in the given wl,
or "" if wl is empty.

<span
>    

<span
>  STRING xxWLtickerLast

<span
>    Returns the last ticker in the given wl,
or "" if wl is empty.

<span
>    

<span
>  STRING
xxWLtickerCount(wl=-1);

<span
>    Returns the number of tickers in the wl.

<span
>    If wl=-1 then the number of all tickers in
the DB is returned.

<span
>    

<span
>  STRING xxWLrefresh();

<span
>    After doing manual changes (via menues) to
the watchlists you should call this 

<span
>    to reflect the changes also to ABtool.

 

-----------------------------------------------------------------------------

<span
>  STRING
xxABtoolVersionStr();

<span
>    Returns ABtool version as string: for
example "0.9.22"

 

<span
>  STRING
xxABtoolVersionStr2();

<span
>    Similar to xxABtoolVersionStr(), but some
additional info like compilation date and time

<span
>    See also the ABtool_dll.log 

<span
>      

<span
>  NUMBER
xxABtoolVersionNum();

<span
>    Returns ABtool version as number: for
example 922 means version 0.9.22

<span
>      

<span
>  NUMBER
xxABtoolVersion(NUMBER func);

<span
>    Func can be 0..2 for major, minor, release
parts of a version.

 

<span
>  NUMBER
xxABtoolMinRequiredVersion(NUMBER iMinRequiredVersion);

<span
>    The passed iMinRequiredVersion must be
like vVVvv  (for example 10000 means
v1.0.0);

<span
>    Returns the current version. If the
current version is less than the passed

<span
>    version than a warning message will pop
up.

<span
>    If your script requires a specific minimum
version of ABtool then put this at the 

<span
>    beginning of your main script.

 

<span
>  NUMBER
xxAmiBrokerVersionNum();

<span
>    Returns AmiBroker version as number: for
example 43800 means version 4.38.0

 

<span
>  STRING xxAmiBrokerVersionStr();

<span
>    Returns AmiBroker version as string. For
example "4.38.0"

 

-----------------------------------------------------------------------------

<span
>  NUMBER
xxViewRefresh();

<span
>    Performs an updating of the workspace.
Normally done automatically.

 

-----------------------------------------------------------------------------

<span
>  NUMBER xxRand(NUMBER
range);

<span
>    Generates a random number betwen 0.0 and
the given range, excluding range.

<span
>    The returned value is a floating point
number. If you need only the integer 

<span
>    part of it then use xxToInt() to convert it.

 

<span
>  NUMBER
xxRandGetSeed();

<span
>    Returns the seed number the random number
generator (RNG) uses

 

<span
>  NUMBER
xxRandSetSeed(NUMBER seed);

<span
>    Sets seed number of the random number
generator (RNG). This gives a new 

<span
>    sequence (order) of random numbers
produced by xxRand().

<span
>    The seed number can be 0..4294967295<span
>   (this is 2^32-1);

<span
>    ABtool starts with a random seed.

<span
>    To set the seed randomly, use either the
current time or simply a random number :-);

<span
>   
Using the current time is the preferred method:
xxRandSetSeed(xxDateToNumber(12,1, 0,0,0));

<span
>    BEWARE: you should set the seed only once!
If you set it each time before 

<span
>    generating a random number then you will
mostly always get the same random number 

<span
>    generated!

<span
>    Tip: since ABtool already starts with a
random seed there is no need to set the seed.

<span
>         The net effect is: the generated
random numbers in all AB sessions will always

<span
>         already be of different sequences.

<span
>        

-----------------------------------------------------------------------------

<span
>  STRING
xxGetTmpFileName(STRING directory="", STRING filemask, BOOL
AfReturnFullPath=false);

<span
>    Returns a filename which does not already
exist in the given directory, or "" if name

<span
>    cannot be generated. 

<span
>    This function is useful for generating
filenames automatically without overwriting any existing files.

<span
>  

<span
>    If "directory" is ""
then the current directory will be taken.

<span
>        

<span
>    "filemask" must contain at least
one ? char. This will be replaced by digits and the so 

<span
>    generated name will be returned. There
must be 1 to 9 consecutive ? in the filemask. The filemask 

<span
>    may contain other characters before or
after the group of ? chars.

 

<span
>    The so generated filename is free for use.
Up to a minimal requirement the name can be specified 

<span
>    by the user; fe. in
"Myfile???.txt" the ??? will be replaced by digits until a
non-existing filename 

<span
>    is found (fe. "MyFile000.txt" if
that does not exist yet in the directory). The location of the 

<span
>    filename to generate can be controlled by
the "directory" parameter.

<span
>    

<span
>    Beware: actually no file will be created,
only a name will be generated, which does not exist 

<span
>    yet in that directory. The created
filename could for example be passed to TableExport() or FileOpen().

<span
>    

<span
>    The "filemask" part may not
contain slash or backslash, but both may contain dots and also spaces.

<span
>    

<span
>    Example: this will generate a filename to
be used in the ABtool subdirectory relative to the current directory (AB dir);

<span
>       fname =
xxGetTmpFileName("ABtool", "MyTestfile????.csv", true);

 

-----------------------------------------------------------------------------

<span
>  NUMBER xxType(STRING
typename);

<span
>    Returns the ABtool data type id as
follows. These types can be used for Tables and Arrays.

<span
>    Memory consumption depends on the size of
the data type. Standard Float type is of size 4 bytes.

<span
>    The only available numeric type in AFL is
Float, but within ABtool they can be any from the list

<span
>    below. For example Int16 is 2 bytes long
within ABtool, but if the value is passed to/from AB 

<span
>    this will be converted to a float and
carried in a float field.

 

<span
>    typecode  
typename typesize 
description   <span
>                                    synonym(s);

<span
>   
----------------------------------------------------------------------------------------------------------

<span
>          1 
*  Float<span
>     4      
single precision floating point                   Flt, Num

<span
>          2  *<span
>  ABarray  
4n      AB array can be of
variable size (see note);

<span
>          3 
*  String<span
>    1+     
zero terminated string (cstring)                  Str

<span
>          4 
*  Pointer<span
>   4      
A generic pointer to data or a function           Ptr 

<span
>         10 
*  Char      1       signed char<span
>                                       Chr, Ch

<span
>         11 
*  Byte      1       unsigned char<span
>                                     Byt, Bool

<span
>         12 
*  Int16<span
>     2      
16 bit   signed integer<span
>                           I16, Short

<span
>         13 
*  UInt16<span
>    2      
16 bit unsigned integer                           U16, UShort

<span
>         14 
*  Int32<span
>     4      
32 bit   signed integer<span
>                           I32, Int,<span
>  Long

<span
>         15 
*  UInt32<span
>    4  
    32 bit unsigned integer<span
>                           U32, UInt, ULong,
Handle, Hdl

<span
>         16 
-  Int64<span
>     8      
64 bit   signed integer<span
>                           I64

<span
>         17 
-  UInt64<span
>    8      
64 bit unsigned integer                           U64

<span
>         18 
-  Double<span
>    8      
double precision floating point                   Dbl  

<span
>         19 
-  LDouble<span
>   8      
long double precision floating point              LDbl

<span
>         20 
-  DATE      8       Windows'
datetime format (Double)                 DATETIME, DT

<span
>         21 
*  BitArray<span
>  1+     
Bit array can be used as xxTypedArray only        Bit, BitField

 

<span
>   Note: types 16 to 20 cannot be used,
because AB internally uses Float numbers,

<span
>         so only types which are <= 4 bytes
can be used. Longer types will be

<span
>         converted/cutted to Float resulting
in precission/data loss caused by

<span
>         the type conversion of a longer data
type to a shorter one.

<span
>         - The "Pointer" and
"Handle" types are experimental and cannot be used. 

<span
>         - Only those where a "*" is
can be used.

<span
>         - The DATE above has nothing to do
with ABs datenum; it is a Windows type.

<span
>           For storing ABs datenum use either
Float, Int32 or Uint32 in Tabledefinitions or ABtool Arrays.

<span
>         - ABarray is a
"problematic" datatype because it is a datetime synchronized array
which

<span
>           also can be different size
depending on AB settings and other factors. Daving/Restoring of this

<span
>           type is not an easy task, and it
was not intended to be used for such tasks.

<span
>   Note: both "typename" and
"synonym" give the same typecode.

 

<span
>   Limits / Ranges:

<span
>     Type                       MinVal                   MaxVal

<span
>    
----------------------------------------------------------

<span
>     Char                         –128                      127

<span
>     Byte                            0                      255

<span
>     Int16                      –32768                    32767 

<span
>     UInt16                          0                    65535

<span
>     Int32                 –2147483648               2147483647  

<span
>     UInt32                          0               4294967295

<span
>     Float             1.175494351e–38          3.402823466e+38

<span
>     Double   
2.2250738585072014e–308 
1.7976931348623158e+308

<span
>     LDouble  
2.2250738585072014e–308 
1.7976931348623158e+308

 

<span
>   Example: 
xxTableColumnAdd("MyColumn", xxType("Int32"), th);

<span
>     Here, xxType("Int32") will
return typecode 14, meaning Int32.

<span
>     You can either pass the typecode or use
xxType().

 

-----------------------------------------------------------------------------

STRING
xxTypeToStr(NUMBER typecode);

<span
>  Returns the data type as string (fe. for
typecode 1 "Float" is returned);



 



xxClass
stuff (experimental)

<span
>  The xxClass stuff is experimental, not
finished yet, mor funcs will follow soon.

<span
>  But the principle works well and is
promising for realizing some advanced level stuff.

 

<span
>  HANDLE
xxClassCreate(STRING name, HANDLE hParent=-1);

<span
>    Creates a class and returns its handle.

<span
>    If hParent is >= 0 then the newly
created class will be the child

<span
>    of the given parent handle. If hParent is
-1 then this newly created

<span
>    class is a root parent (it itself has no
parents).

 

<span
>  HANDLE
xxClassFirst();

<span
>    Returns the first of all created class
handles.

 

<span
>  HANDLE
xxClassNext(HANDLE h);

<span
>    Returns the next after the given handle.

<span
>    -1 indicates end of the hierarchical tree.

 

<span
>  BOOL
xxClassSave(STRING filename);

<span
>    Saves all members of the class into the
given file.

 


<span
>  BOOL
xxClassLoad(STRING filename);

<span
>    Loads the given class file

<span
>    The hierarchy and all relations will
automatically be restored.

 

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

 

 

<span
>  NUMBER
xxSizeOfType(NUMBER typecode);

<span
>    Returns the internal size of the given
basic data type.

<span
>    

<span
>    Since strings are made up of characters, a
1 will be returned; 

<span
>    for actual strings you should use
xxStrLen(str).

 

<span
>    "type" is one of the typecodes
listed under xxType().

<span
>    

<span
>    Example 1:
xxSizeOfType(xxType("Int16"));

<span
>      will return 2, meaning a 16 bit integer
type has a fixed size of 2 Bytes.

 

<span
>    Example 2: xxSizeOfType(xxType("Float"));

<span
>      will return 4, meaning a Float type has
a fixed size of 4 Bytes.

 

-----------------------------------------------------------------------------

<span
>  STRING
xxStudyGetNext(STRING currentStudyId, NUMBER chartId=1);

<span
>    Param:

<span
>      "currentStudyId":

<span
>        A two-character identifier of the
study. If "" is given then

<span
>        the first study id found will be
returned.

<span
>      "chartId":

<span
>        The id of the chart. The main chart
has the id 1. For the id's 

<span
>        of the other charts see study() in the
AFL help.

<span
>    

<span
>    Returns: 

<span
>      A two-character identifier of the study
next after the given studyId,

<span
>      or "" if there is no next.

<span
> 

<span
>    Example:

<span
>      sid = xxStudyGetNext("");<span
>          // get the first

<span
>      while (sid != "");

<span
>        {

<span
>          //... do something

<span
>          sid = xxStudyGetNext(sid);<span
>     // get the next after this

<span
>        }

 

<span
>    See also: study() in AFL reference or AB
online help

 

 

-----------------------------------------------------------------------------

FTP Functions 


NUMBER xxHttpFileGet(STRING localfilename, STRING
URLstring, NUMBER <span
>retryMax=3);<span
>

<span
>    Downloads given URL page to the given
local file

<span
>    Returns: >=0 success, else error

 

<span
>  NUMBER
xxFtpFileGet(STRING localfilename, STRING remoteserver, STRING remotedirectory,
STRING remotefilename,

<span
>                      STRING
loginname="anonymous",
loginpassword="sampleuser@xxxxxxxxx", fBinary=1);

<span
>    For binary files (ZIP etc.) fBinary must
be 1, for text files a 0 should be given.

 

<span
>  NUMBER
xxFtpFilePut(STRING localfilename, STRING remoteserver, STRING remotedirectory,
STRING remotefilename, STRING loginname="anonymous",
loginpassword="sampleuser@xxxxxxxxx", fBinary=1)<span
>;<span
>

<span
>    For binary files (ZIP etc.) fBinary must
be 1, for text files a 0 should be given.

 

 

* To
get historic data for one ticker (here DELL) use the following URLstring with
xxHttpFileGet():

http://table.finance.yahoo.com/table.csv?a=2&b=1&c=2003&d=2&e=15&f=2003&s=DELL&y=0&g=d&ignore=.csv

 

where:

<span
>  a: startMonth - 1

<span
>  b:
startDay

<span
>  c: startYear (4 digit);

<span
>  e: endMonth - 1

<span
>  f: endDay

<span
>  g: endYear (4 digit);

<span
>  s: ticker

 

Result:

Date,Open,High,Low,Close,Volume

14-Mar-03,26.82,27.12,26.10,26.50,36270500

13-Mar-03,26.40,27.08,26.10,26.89,27564100

12-Mar-03,25.72,26.01,25.14,26.01,24979900

11-Mar-03,26.05,26.18,25.61,25.74,20188800

10-Mar-03,26.50,26.65,25.81,25.95,16942600

7-Mar-03,25.58,26.83,25.50,26.73,25541400

6-Mar-03,26.43,26.44,25.92,26.00,21858500

5-Mar-03,26.10,26.72,26.06,26.68,19020400

4-Mar-03,26.52,26.59,26.02,26.13,15319900

3-Mar-03,27.10,27.20,26.22,26.46,17518100

 

 

* Get
current quotes for single or multiple tickers (here DELL, MSFT, IBM):

http://finance.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=DELL+MSFT+IBM

 

Result:

"DELL",29.491,"5/23/2003","4:00pm",-0.399,29.70,29.88,29.40,19146792

"MSFT",24.22,"5/23/2003","4:00pm",+0.06,24.20,24.54,24.03,77053072

"IBM",85.26,"5/23/2003","4:01pm",-0.82,85.75,85.95,85.10,5188500

 

Tip:
the charcters after f= are keys. You can specify which kind of data and in
which 

order
to receive. Do a google search on their meaning. There are much more codes.

 

-----------------------------------------------------------------------------

Windows
registry & Environment  functions:<span
>

 

Attention1:
The "YourCompany" parameter (see function headers below) must always
be the same. That name

<span
>            must be unique and not the name of
other companies present in the registry under HKLM\SOFTWARE

Attention2:
"BINARY" type registry data under the given tree may only be written
and read using ABtool only.

<span
>            Otherwise the structure of the
binary data is not known to ABtool and so garbage can be returned.

<span
>            The registry types REG_SZ (=
string) and REG_DWORD (integers) can also be created/changed/read by 

<span
>            other aplications. All arrays and
floating point values are of type BINARY.

Attention3:
in scripts use "\\" as registry path seperator. It is evaluated to a
single "\". The same is true

<span
>            also with directory/file paths. 

Note:
During the "Put" operations the given RegKey will automatically be
created if it does not exist yet.

 

NUMBER
xxRegistryPutStr(STRING YourCompanyName, STRING RegKey, STRING RegItem, STRING
RegItemVal);

<span
>  Adds/Modifies the given registry key with
the given value

<span
>  RegKey must start with
"SOFTWARE\\MyCompanyName\\" 
where MyCompanyName must be the same as the first param.

<span
>  Example: 

<span
>    xxRegistryPutStr("MyCompany",
"SOFTWARE\\MyCompany\\MyApplication", "MyItem",
"MyItemValue");

 

NUMBER
xxRegistryPutInteger(STRING YourCompanyName, STRING RegKey, STRING RegItem,
NUMBER RegItemVal);

 

NUMBER
xxRegistryPutFloat(STRING YourCompanyName, STRING RegKey, STRING RegItem,
NUMBER RegItemVal);

 

NUMBER
xxRegistryPutNumArray(ARRAY array, STRING YourCompanyName, STRING RegKey,
STRING RegItem, TypeOfDataInArray, NUMBER Nelems);<span
>

<span
>  "array" can be TypedArray or any
ABarray.

<span
>  "TypeOfDataInArray": see xxType().
For AB arrays pass xxType("ABarray"). 

<span
>  "Nelems": pass the number of
elements the passed array has. For "Abarray" give
"BarCount"

 

VARIANT
xxRegistryGet(STRING YourCompanyName, STRING RegKey, STRING RegItem);<span
>

<span
>  Returns registry key values

<span
>  Here you can read all keys, not just the
keys under your company tree. But this is true only for 

<span
>  simple strings and integer numbers (REG_SZ
and REG_DWORD). Under your own tree you can read all values,

<span
>  incl. previously written arrays.



 



Progress
Functions

NUMBER
xxProgressStart();

<span
>  Displays a progress indicator.

<span
>  Other features: 

<span
>    Cancel button 

<span
>    Dynamic text

 

<span
>  Example:

<span
>    xxProgressStart();

<span
>    xxProgressSetRange(50);

<span
>    for (i = 0; i < 50; i++);

<span
>      {

<span
>        xxProgressText("" + i);

<span
>        xxProgressSetPos(i);

<span
>        xxDelay(1000);<span
>   // simulates "hard working" :-);

<span
>      }


<span
>    xxProgressEnd();

 

NUMBER
xxProgressText(STRING text);

<span
>  Sets text field of the progress indicator.

 

NUMBER
xxProgressSetRange(NUMBER n);

<span
>  Sets range to n

 

NUMBER
xxProgressSetPos(NUMBER i);

<span
>  Sets position to i

 

OLD:
better use SetRange() and SetPos();

NUMBER
xxProgressAdvance();

<span
>  Advances 1/10 (ie. 10%).

<span
>  Call this 10 times and you have reached
100%.

<span
>  Returns -1 if the progress bar isn't active
(ie. cancelled by user);

<span
>  THIS IS OLD. Better use SetRange() and
SetPos();

 

NUMBER
xxProgressEnd();

<span
>  Ends the progress bar.

 

BOOL
xxProgressIsActive();

<span
>  Returns true/false (1/0) whether the
progress bar is still displayed

<span
>  or was ended by the program or cancelled by
the user.  

<span
> 

 

Example
on how to use the Progressbar correctly.

<span
> Includes displaying dynamic text on the
progress bar.

 

<span
> WL = 60;

<span
> nTickers = xxWLtickerCount(WL);

<span
> xxProgressStart();

<span
> xxProgressSetRange(nTickers);

<span
> fUserCancelled = false;

<span
> for (iTicker = 0; (not fUserCancelled)
&& (iTicker < nTickers); iTicker++);

<span
>  {


<span
>    if (iTicker == 0);

<span
>      strTicker = xxWLtickerFirst(WL);

<span
>    else

<span
>      strTicker = xxWLtickerNext(WL);

<span
> 

<span
>    txt = xxFormatNum("%.0f %%
finished", iTicker / nTickers * 100);

<span
>    txt = strTicker + "<span
>   " + txt;

<span
>    xxProgressText(txt);

<span
>    fUserCancelled =
xxProgressSetPos(iTicker);

 

<span
>    //... rest of your code ...

 

<span
>  }

<span
> xxProgressEnd();



 



Dialogs
/ Message Boxes

 

<span
>  NUMBER
xxMsgBox(STRING title, STRING caption, NUMBER flags)<span
>;

<span
>       Prompts a windows message box

<span
>       MsgBox flags parameters:

<span
>         Specify one of the following flags to
indicate the buttons contained in the message box:      

<span
>           0 MB_OK

<span
>           1 MB_OKCANCEL<span
>     

<span
>           2 MB_ABORTRETRYIGNORE

<span
>           3 MB_YESNOCANCEL<span
>     

<span
>           4 MB_YESNO<span
>     

<span
>           5 MB_RETRYCANCEL<span
>     

<span
>      

<span
>        Specify one of the following flags to
display an icon in the message box: 

<span
>          16 MB_ICONSTOP, MB_ICONERROR,
MB_ICONHAND     

<span
>          32 MB_ICONQUESTION<span
>     

<span
>          48 MB_ICONEXCLAMATION, MB_ICONWARNING<span
>     

<span
>          64 MB_ICONINFORMATION,
MB_ICONASTERISK      

 

<span
>       Specify one of the following flags to
indicate the default button: 

<span
>           0 MB_DEFBUTTON1<span
>     

<span
>         256 MB_DEFBUTTON2<span
>     

<span
>         512 MB_DEFBUTTON3<span
>     

<span
>         768 MB_DEFBUTTON4    


<span
>  

<span
>       The following flag is the default
modality of the dialog box: 

<span
>           0 MB_APPLMODAL

 

<span
>       In addition, you can specify the
following flags: 

<span
>       65536 MB_SETFOREGROUND<span
>     

<span
>      262144 MB_TOPMOST<span
>     

 

<span
>      Return value:

<span
>          0 indicates that there is not enough
memory to create the message box.

<span
>        Upon success, one of the values
described in the following table is returned.

<span
>          1 IDOK     

<span
>          2 IDCANCEL     

<span
>          3 IDABORT     

<span
>          4 IDRETRY     

<span
>          5 IDIGNORE

<span
>          6 IDYES

<span
>          7 IDNO     

-----------------------------------------------------------------------------

STRING
xxInputDlg(STRING strTitle, STRING strInitialValue);<span
>

<span
>  For interactive data input. The entered
string is returned.

<span
>  If user presses Cancel then "" is
returned.

<span
>  Example: this will prompt for entering a
ticker. The initial value shown in the

<span
>           input field will be DELL. You can
pass "" in the second field.


<span
>           The entered string is returned. It
can be "" if user cancelled or didn't

<span
>           give any text. 

<span
>    str = xxInputDlg("Enter ticker",
"DELL");

 

HANDLE
xxDialogCreate(STRING caption);

<span
>  Creates a dynamic dialog and returns a
handle to it. 


<span
>  The returned handle is required for the
other xxDialogXXX functions.

 

NUMBER
xxDialogItemAdd(STRING caption, NUMBER itemType, NUMBER x, NUMBER y, NUMBER
xlen, NUMBER ylen, HANDLE hDlg);

<span
>  Adds an item to the dialog

<span
>  itemType must be one of:

<span
>    xxEDITBOX

<span
>    xxRADIOBUTTON

<span
>    xxCHECKBOX

<span
>    xxSTATICTEXT

<span
>    xxPUSHBUTTON

<span
>    xxDATETIMEPICKER

<span
>  x,y,xlen,ylen are in screen units.

<span
>    They are offsets within the dialog which
is initially centered on the screen.

<span
>    The size of the dialog is determined by
the longest and highest items in it.

<span
>    You can use xxGetSystemMetrics() to get
the screen resolution.

 

<span
>  Note: The passed caption to an xxEDITBOX is
interpreted as the initial value of the editbox.

<span
>        For a label you have to use a seperate
xxSTATICTEXT.

 

 

NUMBER
xxDialogRun(HANDLE hDlg);

<span
>  Runs the dialog. The return value is xxIDOK
or xxIDCANCEL.

 

NUMBER
xxDialogItemSetStrVal(STRING value, NUMBER ordIndex, HANDLE hDlg);<span
>

<span
>  Sets the string of a string item (fe. of an
xxEDITBOX);

<span
>  ordIndex is the ordinal identification
number of the item; ie. 0,1,n

 

NUMBER
xxDialogItemSetNumVal(NUMBER value, NUMBER ordIndex, HANDLE hDlg);<span
>

<span
>  Sets the number of a numeric item (fe. of an
xxCHECKBOX);

<span
>  ordIndex is the ordinal identification
number of the item; ie. 0,1,n

 

VARIANT
xxDialogItemGetVal(NUMBER ordIndex, HANDLE hDlg);<span
>

<span
>  Returns the value of the given dialog item.

<span
>  ordIndex is the ordinal identification
number of the item; ie. 0,1,n

 

NUMBER
xxDialogDelete(HANDLE hDlg);

<span
>  Deletes dialog. Before doing this you can
retrieve the user filled values by

<span
>  calling xxDialogItemGetVal() and storing the
results in ordinary variables.

 

More
info:

<span
>  Each item added to the dialog can only be
accessed by using its ordinal number (0,1,...,n);

<span
>  That is: if items are inserted then the
ordinal numbers of the following items do 

<span
>  of course increase by 1. This is similar to
the xxTable columns.

 

<span
>  In a group of radiobuttons do get/set only
with the first one!

 

<span
>  The date picker works with AB datenums (ie.
yyymmdd much like what datenum() returns

<span
>  or use xxDateToNumber(5,0, y, m, d) to
convert y,m,d to an AB datenum);

 

Example:
see ABtool/Scripts/afl/DynDialog_Test.afl

 

-----------------------------------------------------------------------------

<span
>  NUMBER
xxWinOpen(NUMBER iWin=0);

<span
>    Opens a window for text output using
xxWinText(str); see below.

<span
>    Upto 5 windows can be opened (iWin 0 to
4);

<span
>    Returns: >=0 success, else error

<span
>  

<span
>  NUMBER
xxWinText(STRING str, iWin=0)<span
>;

<span
>    Writes given string to the given window

<span
>    Returns: >=0 success, else error

 

<span
>  NUMBER
xxWinClose(NUMBER iWin=0)<span
>;

<span
>    Closes the window.

<span
>    Returns: >=0 success, else error

 

 

<span
>  Tips for Windows:  

<span
>    - The size and position of the windows
will be restored at next start (but not the content! :-);

<span
>    - You can use xxFormatNum() for formatting
numbers for a "nice" look in the window.

<span
>    - You can do debug outputs to these
windows similar to the _TRACE()/DbgView combo.

<span
>    - The window's contents cannot be saved or
loaded yet, but this could be realized.

<span
>    - The window(s) don't open automatically,
you have to do that with xxWinOpen(winnbr).

 

 

 

-----------------------------------------------------------------------------

Arrays<span
>

ARRAY
xxTypedArrayCreate(NUMBER nelems, NUMBER type);<span
>

<span
>  Creates and returns a typed array of given
type and size

<span
>  For type use: xxType("Float") or
other valid types (see xxType());

<span
>  Example:

<span
>            myarr = xxTypedArray(15000,
xxType("Byte");

 

<span
>            This is of type "Byte",
so you cannot access its elements directly in AFL, instead 

<span
>            you must use the Get/Set/Inc/Dec
methods below. If the type were "Float" then you

<span
>            could use it as an ordinary
ABarray, but only upto the BarCount element

<span
>            (otherweise AFL will report "Subscript out of
range" error).

<span
>            For the rest again the methods
below would be required. So for all TypedArrays

<span
>            the methods below should be used.
Otherwise garbage will happen.

<span
>            Do not copy/assign such arrays to
other arrays! They will be cut to the length

<span
>            (BarCount * 4) bytes. For example
if BarCount today is 100 then the above array

<span
>            would be cutted from its original
size 15000*1 bytes to 100*4 bytes....

<span
>            So don't copy/assign TypedArrays to/from other arrays.

<span
>            TypedArrays can be saved and
reloaded in/from the persistent storage area or the registry. 

<span
>            Using the File I/O functions of
ABtool you can save/load them also in/from ordinary files.

<span
> 

NUMBER
xxTypedArrayGet(ARRAY typedarray, NUMBER n, NUMBER type);<span
>

<span
>  Returns content of given element n

 

NUMBER
xxTypedArraySet(ARRAY typedarray, NUMBER n, NUMBER newVal, NUMBER type);<span
>

<span
>  Sets content of given element n to the new
value

 

NUMBER
xxTypedArrayInc(ARRAY typedarray, NUMBER n, NUMBER type, NUMBER step=1);<span
>

<span
>  Increments content of element n

 

NUMBER
xxTypedArrayDec(ARRAY typedarray, NUMBER n, NUMBER type, NUMBER step=-1);<span
>

<span
>  Decrements content of element n

 

-----------------------------------------------------------------------------

<span
>  HANDLE
xxArrayCreate(NUMBER type, NUMBER strLen = 0, NUMBER sizeOfFirstDimension,
...);

<span
>     Creates a single or multi dimensional
array of the given type; Upto 10 dimensions are possible.

<span
>     Params:

 

<span
>       type:     

<span
>         Please see the list of data types
under xxType();

<span
>         For Strings only: pass the size in
the strLen param; default is 16 bytes

<span
>         The default numeric type is Float

<span
>         Within AB/AFL all numerics are of
type Float, but within ABtool they can be

<span
>         any from the list. For example Int16
is 2 bytes long within ABtool, but if the

<span
>         value is passed to/from AB this will
be converted to a float and carried in a float field. 

 

<span
>       strLen:


<span
>         defines the length of string elements
for a string array (= type 3). 

<span
>         For numeric arrays pass here a 0.

 

<span
>       sizeOfFirstDimension:

<span
>         the number of elements in the first
dimension

 

<span
>       ...

<span
>         similar to "sizeOfFirstDimension";
specify the other dimensions. Upto max. 10 dimensions possible.

 

<span
>     Returns: 

<span
>       a handle >= 0 which is required for
other ArrayXXX() calls

 

<span
>     Remarks: array of strings is also
possible; see above

<span
>              Float type is the native numeric
type used in AB.

 

<span
>   NUMBER
xxArrayStrValSet(STRING strVal, NUMBER handle, indexOfFirstDimension, ...)<span
>;<span
>

<span
>     Sets the specified element of a string
array with the passed string value.

 

<span
>   NUMBER
xxArrayNumValSet(NUMBER numval, NUMBER handle, indexOfFirstDimension, ...)<span
>;<span
>

<span
>     Sets the specified element of a numeric
array with the passed numeric value.

 

<span
>   VARIANT
xxArrayValGet(NUMBER arrayhandle, NUMBER indexOfFirstDimension, ...);

<span
>     Gets the value of the specified element
of the array.

<span
>     For all of the defined dimensions an
access index must be specified.

<span
>     You can use VarGetLastType() to check
whether the returned data is a string (type 3),

 

<span
>   NUMBER
xxArrayDelete(NUMBER arrayhandle)<span
>;

<span
>     Deletes the array. Memory will be freed.
After this, the arrayHandle becomes invalid.

<span
>     Passing -1 deletes all ABtool arrays
previously created.

 

<span
>   NUMBER
xxArraySave(STRING filename, NUMBER arrayhandle)<span
>;<span
>

<span
>     Saves array in given file

<span
>     Returrns 0 if successful, otherwise -1

 

<span
>   HANDLE
xxArrayLoad(STRING filename, NUMBER arrayhandle=-1);

<span
>     Loads array from given file.

<span
>     "arrayhandle" can be -1. A
previously created table will internally first

<span
>     be dleted.

<span
>     Returns: success >= 0, else error

 

 

<span
>   Tips/Info for Arrays:

<span
>     - Arrays have a fixed size and fixed
dimensions defined by the user at array creation

<span
>     - Bounds check is done: if specifying an
index outside the dimensions of the array

<span
>       then an error will be returned

-----------------------------------------------------------------------------

AB
Arrays

NUMBER
xxABArrayFirst(ARRAY arr, BOOL fIndex=true, BOOL fBool=false);<span
>

<span
>  Returns first filled value or index
depending on param fIndex

<span
>  fIndex: 

<span
>    if "true"<span
>  (1) then the value of the array element is
returned

<span
>    if "false" (0) then the index of
the array element is returned

<span
>  fBool:

<span
>    if array contains only bool values (0 and
1, and maybe the "Empty" value);

<span
>  Returns: the value or index of the first
filled element, or -1e10/-1 if none found

<span
>  Note: -1e10 is the "Empty" or
"Null" value in AB

 

NUMBER
xxABArrayNext(ARRAY arr, NUMBER ixCurrent, BOOL fIndex=true, BOOL fBool=false);<span
>

<span
>  Returns the next filled value or index
depending on param fIndex

<span
>  ixCurrent:

<span
>    is the current index. The search starts
after this.

<span
>  fIndex: 

<span
>    if "true"<span
>  (1) then the value of the array element is
returned

<span
>    if "false" (0) then the index of
the array element is returned

<span
>  fBool:

<span
>    if array contains only bool values (0 and
1, and maybe the "Empty" value);

<span
>  Returns: the value or index of the next
filled element, or -1e10/-1 if none found

<span
>  Note: -1e10 is the "Empty" or
"Null" value in AB

 

NUMBER
xxABArrayPrev(ARRAY arr, NUMBER ixCurrent, BOOL fIndex=true, BOOL fBool=false);<span
>

<span
>  Returns the prev filled value or index
depending on param fIndex

<span
>  ixCurrent:

<span
>    is the current index. The search starts
before this.

<span
>  fIndex: 

<span
>    if "true"<span
>  (1) then the value of the array element is
returned

<span
>    if "false" (0) then the index of
the array element is returned

<span
>  fBool:

<span
>    if array contains only bool values (0 and
1, and maybe the "Empty" value);

<span
>  Returns: the value or index of the prev
filled element, or -1e10/-1 if none found

<span
>  Note: -1e10 is the "Empty" or
"Null" value in AB

 

NUMBER
xxABArrayLast(ARRAY arr, BOOL fIndex=true, BOOL fBool=false);<span
>

<span
>  Returns the last filled value or index
depending on param fIndex

<span
>  fIndex: 

<span
>    if "true"<span
>  (1) then the value of the array element is
returned

<span
>    if "false" (0) then the index of
the array element is returned

<span
>  fBool:

<span
>    if array contains only bool values (0 and
1, and maybe the "Empty" value);

<span
>  Returns: the value or index of the last
filled element, or -1e10/-1 if none found

<span
>  Note: -1e10 is the "Empty" or
"Null" value in AB

 

ARRAY
xxGetEmptyABArray();

<span
>  Returns an empty AB array where all elements
are marked as "empty" (-1e10);

 

NUMBER
xxABarrayNelems();

<span
>  In AB all ABarrays have the same size. The
return value of this func is the same as "BarCount" of AFL.

 

-----------------------------------------------------------------------------

Misc<span
>

 

<span
>  VARIANT
xxStockPropertyGet(STRING ticker, STRING property, NUMBER arg = 0);

<span
>       Get property type information about any
ticker

<span
>       Returns: either NUMBER or STRING
depending in the type of the returned data

<span
>                (use VarGetLastType() to
determine the type);

<span
>       Args:

<span
>         property can be one of the following:

<span
>           FullName

<span
>           IsIndex

<span
>           IsFavourite

<span
>           IsContinuous

<span
>           IndustryID

<span
>           MarketID

<span
>           GroupID

<span
>           WatchListBits0to15

<span
>           WatchListBits16to31

<span
>           WatchListBits32to47

<span
>           WatchListBits48to63

<span
>           Code

<span
>           Issue

<span
>           BookValue

<span
>           NominalValue

<span
>           Address

<span
>           Alias

<span
>           WebID

<span
>           FinanceYear<span
>    (pass the quarter in the optional 3rd
param);

<span
>           FinanceIncome<span
>  (pass the quarter in the optional 3rd
param);

<span
>           FinanceEBT<span
>     (pass the quarter in the optional 3rd
param);

<span
>           FinanceEAT<span
>     (pass the quarter in the optional 3rd
param);

<span
>           IsDirty

<span
>           DataSource

<span
>           DataLocalMode

<span
>           MarginDeposit

<span
>           PointValue

<span
>           RoundLotSize

<span
>           TickSize

<span
>      
See ABtool_Examples.txt for an example usage. 

 

-----------------------------------------------------------------------------

<span
>     NUMBER
xxVarGetLastType();

<span
>       Returns the type of the data returned
by the last ABtool function 

<span
>       called (except VarGetLastType() itself)
as follows:

<span
>         0 Type unknown or uninitialized yet

<span
>         1 Number

<span
>         2 Array (of Numbers);

<span
>         3 String

<span
>        14 Int32  

<span
>       See ABtool_Examples.txt for an example
usage.

<span
>       Calling this function does not change
the last type returned; ie. now you cann call

<span
>       this func multiple times, and also
after every ABtool function call.

 

-----------------------------------------------------------------------------

NUMBER
xxDeleteStockFromDB(STRING ticker);

<span
>  Removes given ticker from the database.

<span
>  Returns: 0=success, else error

<span
>  Note: in the next version a function similar
to this will be added which

<span
>        deletes all stocks listed in a
watchlist from the DB.

 

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

NUMBER
xxRangeBarFirst();

<span
>  Returns first bar index for the set range in
AA. 

<span
>  The index is between 0 and BarCount-1

<span
>  In case of error -1 is returned

 

NUMBER
xxRangeBarLast();

<span
>  Returns last bar index for the set range in
AA. 

<span
>  The index is between 0 and BarCount-1

<span
>  In case of error -1 is returned

 

NUMBER
xxRangeBarOfStartDate(BOOL fExactDate = false);<span
>

<span
>   Returns element number of the corrosponding
>From date in AA Range

<span
>   or -1 if fExactDate = true was given but if
there is no such bar with this date

<span
>   The index is between 0 and BarCount-1

 

NUMBER
xxRangeBarOfEndDate(BOOL fExactDate = false);

<span
>   Returns element number of the corrosponding
To date in AA Range

<span
>   or -1 if fExactDate = true was given but if
there is no such bar with this date

<span
>   The index is between 0 and BarCount-1

 

------------

STRING
xxTypeToStr(NUMBER typecode);

<span
>  returns the data type as string (fe. for
typecode 1 the string "Float" is returned);

 

--------------------------------------------------------------------------------------------

 

NUMBER
xxAAcurrentlyScannedStockNum();

<span
>  Returns the currently scanned ordinal stock
number (0,1,2,...);

<span
>   STRING
xxCRC32str(STRING str);

<span
>            calculate the CRC32 for the given
value.

<span
>            The return value is a string
representing the computed CRC32 in hex format.

<span
>   STRING
xxCRC32num(NUMBER num);

<span
>     calculate the CRC32 for the given value.

<span
>     The return value is a string representing
the computed CRC32 in hex format.

 

STRING
xxQuoteCRC32(STRING ticker, STRING fieldid, NUMBER sYear, NUMBER sMonth, NUMBER
sDay, NUMBER eYear, NUMBER eMonth, NUMBER eDay);

<span
>        FieldId:

<span
>          D Date

<span
>          O Open

<span
>          H High

<span
>          L Low

<span
>          C Close

<span
>          V Volume

<span
>          I Open Interest<span
>          

<span
>        Return value: CRC32 value as
Hex-String, or "Error"

<span
>        Example: this calculates the CRC32 for
DELL's Close prices for

<span
>                 the given date range:

<span
>                   crcStr =
QuoteCRC32("DELL", "C", 2000,1,1, 2003,5,2);

<span
>        Remarks: There must be at least 1
quote in the specified date range,

<span
>                 otherwise "Error"
will be returned.

<span
>                 Using this the quote data of a stock can be tested for
equality

<span
>                 among users and databases.

 

-----------------------------------------------------------------------------

<span
>  NUMBER xxDelay(NUMBER
milliseconds);

<span
>    Pauses for the duration of given
milliconds (1000 ms == 1 second);

 

<span
>  NUMBER xxPause(NUMBER
milliseconds);

<span
>    same as xxDelay(); see there

 

 

-----------------------------------------------------------------------------

NUMBER
xxMemDbg(BOOL fEnable, BOOL fAppend, BOOL fReport, BOOL fFullLogging, BOOL
fRestart);

<span
>  This is for detecting possible memory leaks.
It logs all memory allocation and deallocation

<span
>  requests to the file ABtool/MemDbg.log.

<span
>  How to use it:

<span
>    at the top of your script put this:

<span
>       #pragma nocache

<span
>       xxMemDbg(true, false, true, true,
true);

 

<span
>    and at the end of your script this:

<span
>      xxAbtoolInit();

<span
>      xxMemDbg(false, false, true, true,
false);

 

<span
>    Then run your script, and analyze the last
report section of the file ABtool/MemDbg.log.

<span
>    If it says that there are some blocks not
freed, then we have a problem, Houston :-);

<span
>    The next step is to locate the code
statement which causes this. For this you need

<span
>    to disable parts of your code and repeat
the test until you locate it.

<span
>    The best would be posting the script in
the abtool group, so many people can try to

<span
>    locate the code position. 

 

<span
>    See also Richs3.afl for a practical use of
MemDbg().

 

NUMBER
xxGetSystemMetrics(NUMBER Category, NUMBER Item);<span
>

<span
>  Returns system information

 

<span
>  Category: 

<span
>    xxSCREEN = Screen

<span
>      Item:

<span
>        xxSIZE_X = X resolution

<span
>        xxSIZE_Y = Y resolution

 



 



Scripting<span
>

NUMBER
xxScriptEncrypt()<span
>  

<span
>  Encrypts (scrambles) the given script into a
binary scrambled format and puts 

<span
>  it into the given file

 

NUMBER
xxScriptDecrypt();

<span
>  Decrypts (decodes, unscrambles) an encrypted
script

 

NUMBER
xxScriptRun();

<span
>  Runs normal AFL scripts and also encrypted
scripts.

 

-----------------------------------------------------------------------------

EasyDLL<span
>

 

Using
functions in external DLLs of type "EasyDLL" (see the documentation
in "xxEasyDLL.txt");

HANDLE
xxDLLload(STRING dllname);

<span
>  Loads the given EasyDLL and returns a handle
which is required to call functions within the DLL.

 

<span
>  It first searches in the ABtool directory.
If that fails it tries to load via PATH.

<span
>  It is recommended to put EasyDLLs into the
ABtool directory, otherwise in a directory

<span
>  which is listed in the PATH environment
variable. A third alternative would be always

<span
>  giving absolute or relative path
information.

 

VARIANT
xxDLLcall(STRING "dllfunc(param)", HANDLE hDLL);

<span
>  Calls a function within a loaded EasyDLL. 

<span
>  For "dllfunc" give the name of the
exported function in the EasyDLL.

<span
>  "param" can be none or upto 10
names of currently defined AmiBroker variables, seperated by commas. 

<span
>  "hDLL" is the the handle returned
from xxDLLload().

 

NUMBER
xxDLLunload(HANDLE hDLL);

<span
>  Unlaods the EasyDLL from memory.

 

 

<span
>  Example:

<span
>    hDLL    
= xxDLLload("MyEasyDLL.DLL");

<span
>    avResult =
xxDLLcall("MyFunc(Low)", hDLL);

<span
>    xxDLLunload(hDLL);

 

<span
>  Here, the DLL "MyEasyDLL.DLL" is
loaded and the function MyFunc() is called.

<span
>  The "Low" price array of the
current stock in AB is passed to the MyFunc() function.

<span
>  The result of the function call is placed in
the AFL variable avResult.



 



Date
/ Time

STRING
xxABDatenumToDatestr(NUMBER ABdatenum);

<span
>  Converts ABdatenum to string according to
users regional setting

 

NUMBER
xxDatestrToABdatenum(STRING datestr);

<span
>  Converts datestring, which is in users
regional format, into ABdatenum

 

STRING
xxABtimenumToTimestr(NUMBER ABtimenum);

<span
>  For ABtimenum see AB doc: in a timenum the
time is encoded as HHMMSS in a numeric field.

<span
>  Returns the string representation of the
given time in users locale (ie. a string as "HH:MM:SS")<span
>  

 

NUMBER
xxTimestrToABtimenum(STRING timestr);

<span
>  Converts a timestring which is in user's
regional format (usually "HH:MM.SS") to 

<span
>  an ABtimenum and returns it. For further
info on ABtimenum consult the AB docs.

 

 

Remarks:


<span
>    Unfortunately, in AB formatting a date
into users locale is possible only within AddColumn():

<span
>      AddColumn(DateTime(), "dt",
formatDateTime);

<span
>    But these functions of ABtool overcome
this limitation; with them any datenum can be converted 

<span
>    everywhere into a string and back.

<span
>    The benefit of these functions is that
they automatically use the user's regional settings for

<span
>    the date format, so no further conversion
is required. Applications can work in all regions/countries

<span
>    without change.

 

<span
>  Example (set Range=n last quotes, and n=1):

<span
>    dt = DateTime();

<span
>    AddColumn(dt, "dt",<span
>    1.2);

<span
>    AddColumn(dt, "dtstr",
formatDateTime);

<span
>    dn = Datenum();

<span
>    AddColumn(dn, "dn", 1);

<span
>    datestr = xxABdatenumToDatestr(dn[BarCount - 1]);

<span
>    AddTextColumn(datestr,
"datestr", 1);

<span
>    dn2 = xxDatestrToABdatenum(datestr);

<span
>    AddColumn(dn2, "dn2", 1);

 



 



Constants<span
>

NUMBER
xxDefineConstants();

<span
>  Defines ABtool constants

<span
>  Should be called at the beginning of your
script or from within "ABtool/Functions.afl"

<span
>  These are simply AFL variables; real
constants, ie. unchangeable, seem not possible in AFL.

<span
>  So you better shouldn't change these
"constants" :-);

<span
>  After calling this the following constants
will be available:

 

<span
>    xxEMPTYVAL        (as used in AB: it is the number -1e10; see important note
under xxIsNumEmpty());

 

<span
>    xxFLOAT

<span
>    xxABARRAY

<span
>    xxSTRING

<span
>    xxPOINTER

<span
>    xxCHAR

<span
>    xxBYTE

<span
>    xxINT16

<span
>    xxUINT16

<span
>    xxINT32

<span
>    xxUINT32

<span
>    xxABDATENUM

<span
>    xxABTIMENUM

<span
>    xxHANDLE

<span
>    xxINT64

<span
>    xxUINT64

<span
>    xxDOUBLE

<span
>    xxLONGDOUBLE

<span
>    xxLDOUBLE

<span
>    xxDATETIME

<span
>    xxDATE

<span
>    xxBIT

 

<span
>    xxIDOK

<span
>    xxIDCANCEL

<span
>    xxIDYES

<span
>    xxIDNO

 

<span
>    xxSCREEN

<span
>    xxSIZE_X

<span
>    xxSIZE_Y

 

<span
>    xxSHORT_TRADE

<span
>    xxLONG_TRADE

<span
>    xxSHORT_AND_LONG_TRADE

 

<span
>    xxEDITBOX

<span
>    xxRADIOBUTTON

<span
>    xxCHECKBOX

<span
>    xxSTATICTEXT

<span
>    xxPUSHBUTTON

<span
>    xxDATETIMEPICKER

 

<span
>    The following are "undocumented"
yet:

 

<span
>    xxLISTBOX

<span
>    xxHSCROLL

<span
>    xxCOMBOBOX

<span
>    xxSPIN

<span
>    xxPROGRESS

<span
>    xxSLIDER

<span
>    xxHOTKEY

<span
>    xxLISTCTRL

<span
>    xxTREECTRL

<span
>    xxTABCTRL

<span
>    xxANIMATE

<span
>    xxRICHEDIT

<span
>    xxMONTHCALENDAR

<span
>    xxIPADRESS

<span
>    xxCOMBOBOX

 

-----------------------------------------------------------------------------

BOOL
xxIsOk(NUMBER xxReturnCode);

<span
>  Returns true (1) if the given returncode is
>= 0

<span
>  FYI: in ABtool all numeric returncodes >=
0 mean success, and all < 0 mean fail.

 

-----------------------------------------------------------------------------

STRING
xxGetCurrentTicker();

<span
>  Returns the currently selected/displayed
ticker in AB.

<span
>  For getting the currently scanned ticker use
the AFL function Name().



 



New
Features 

The
following new features in v0.9.21+ are advanced stuff and will be documented in
the next release:

<span
>  

<span
>  xxAutoSync(BOOL);<span
>          This will allow one or more user
variables be updated automatically 

<span
>                             depending on
external events like the currently shown ticker.

<span
>  

<span
>  xxAutoSyncStatus(NUMBER);<span
>  Returns whether the AutoSync feature is
enabled or not, and other infos

<span
>  

<span
>  xxTickerDocOpen(ticker);<span
>   Opens a new ticker document. This should be
called from external apps only.

 

 

-----------------------------------------------------------------------------

xxRunScript.exe<span
>

New
standalone tool (in v0.9.22+): ABtool/xxRunScript.exe

 

<span
> Usage: xxRunScript strScriptFile
strResultFile strDatabaseDir strStartDate strEndDate iAAmodule iApplyTo
iRangeMode iRangeN iWatchlist fRestoreScript

<span
>  ScriptFile: 
name of the AFL file

<span
>  ResultFile: 
where the results should be exported, or "" for no export

<span
>  DatabaseDir: directory of the database to
use, or "" for the default database 

<span
>  StartDate:  
startdate as string in user's regional date format, or "" to
ignore or for current date

<span
>  EndDate:    
enddate as string in user's regional date format, or "" to
ignore or for current date

<span
>  AAmodule:   
0=Scan, 1=Explore, 2=Backtest, 3=Optimize

<span
>  ApplyTo:    
0=all stocks, 1=current stock, 2=use filter

<span
>  RangeMode:  
0=all quotes, 1=n last quotes, 2=n last days, 3=use from/to date range

<span
>  RangeN:     
>= 1, or -1 for ignoring it

<span
>  Watchlist:  
0..63, or -1 to ignore it

<span
>  fRestore:   
0 or 1, whether the current script and AA settings should be restored
after running the given script

 

<span
>  This tool can also be used from within other
applications to pass and execute an AFL script in ABs AA.

 

NUMBER
xxRunScript(strScriptFile, strResultFile, strDatabaseDir, strStartDate, strEndDate,
iAAmodule, iApplyTo, iRangeMode, iRangeN, iWatchlist, fRestoreScript);<span
>

<span
>    In AFL it is not possible to start a
script from within a running script, but here is a workaround.

<span
>    This func starts ABtool/xxRunScript.exe
which in turn directs AA to start the given script.

<span
>    The parameters are the same as to
xxRunScript.exe; see above

 

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------



-----------------------------------------------------------------------------



ABtool/Functions.afl<span
>

Functions
in "ABtool/Functions.afl" (#include this in the beginning of your
script);

Beginnign
with v0.9.20 in this file also the xx constants are defined. Otherwise,

call
xxDefineConstants() yourself at the beginning of your script.

 

<span
>  xxForeign(ticker,
field);

<span
>    The only difference to the built-in
foreign() is that

<span
>    in xxForeign also "A" or
"Avg" are possible too.

 

<span
>  DumpPersistentStatus();

<span
>    Dumps all persistent variable names,
types, sizes etc. to xxWin(0) 

 

<span
>  DeleteStocksWithoutQuotes(watchlistnbr);

<span
>    Deletes stocks which have no quotes from
the database 

<span
>    and from the watchlist.

<span
>    The deleted tickers are printed to
xxWin(0). 

 

<span
>  DeleteStocksFromDB(iWL);

<span
>    Deletes all stocks listed in the given
watchlist from the database and the watchlist.

<span
>    The deleted tickers are printed to
xxWin(0). 

<span
> 

 

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------