PureBytes Links
Trading Reference Links
|
Uenal,
This one must have slipped by as the advent of saving things in
Environment variables didn't exist when I first started playing qith
ABTool. It's getting to be as bad keeping up with enhancements in
ABTool as it is in AB, but please DON'T stop.
Thanks for the info and example,
Fred
--- In amibroker@xxxxxxxxxxxxxxx, uenal.mutlu@xxxx wrote:
> Fred,
> the picture gets clearer here. Maybe the following
> fact of ABtool will be useful here: If you don't call
> ABtoolInit() then all the ABtool objects used are
> still there. They got automatically deleted during
> DLL unload. Until then (ie. during an AB session,
> your created ABtool objects (tables, array, file handles
> etc.) are available for all scripts executed and all
> iterations/scans run in AB; you just need to save
> the handle (a simple number) of these objects somewhere
> globally. I already had sent a similar example.
> The idea is saving the handle (just a number) in an
> environment variable.
>
> The following method might be of help for tables.
> It is already possible. Simply replace your xxTableCreate()
> calls for the same table structure by the following few lines.
> Afterwards the content of your table becomes persistent
> for the entire duration of an AB session.
> UM
>
> /*---------------------------------------------------------------
-------
> * TIP: HOW TO USE ABtool OBJECTS IN A GLOBAL AND PERSISTENT
MANNER:
> *
> * We can keep an ABtool handle incl. their data persistent for
the
> * duration of an entire AB session (ie. as long as ABtool.dll
is loaded).
> * We simply store the handle in an operating system global area
in an
> * environment variable. We can later recall it from everywhere.
> * Since environment variables contain string values we need to
convert
> * our handle number to a string, and later back to ordinary
numeric AB var.
> * BTW, handles in ABtool are simple numbers >= 0
> * Example:
> * xxEnvSetValOnly("MySavedHandle", xxToString(th1));
> *
> * Now in all scripts instead requesting a new table handle via
> * xxTableCreate() you can check if there was one already saved,
and
> * take that, or create and save a new one if it is the first
time:
> *
> * // check if that envVar exists
> * envVal = xxEnvGetValOnly("MySavedHandle");
> * if (envVal != "")
> * { // if yes, then take the saved handle
> * th1 = xxToNumber(envVal);
> * // xxMsgBox("Using saved handle (" + th1 + ")", "Info");
> * }
> * else
> * { // first time creation of the handle and at the
> * // same time saving the handle in the envVar:
> * th1 = xxTableCreate();
> * xxEnvSetValOnly("MySavedHandle", xxToString(th1));
> * // also the table definition should be done here
> * //...
> * }
> *
> * But, if you ever call ABtoolInit() then all handles and all
memory
> * used by them get released, so you shouldn't call it in your
scripts
> * if you want use the saved handle.
> *
> *---------------------------------------------------------------
-------*/
>
> // check if that envVar exists:
> envVal = xxEnvGetValOnly("MySavedHandle");
> if (envVal != "")
> { // yes, then take the saved handle
> th1 = xxToNumber(envVal);
> // xxMsgBox("Using saved handle (" + th1 + ")", "Info");
> }
> else
> { // no, first time creation of the handle and at the
> // same time saving the handle in the envVar:
> th1 = xxTableCreate();
> xxEnvSetValOnly("MySavedHandle", xxToString(th1));
>
> // step2: define the table fields (this is a one time task
too!)
> // change the following with your own table structure
> xxTableColumnAdd("Ticker", 3, th1); // column 0 is of
type string
> xxTableColumnAdd("NumA", 1, th1); // column 1 is of
type float
> xxTableColumnAdd("NumB", 1, th1); // column 2 is of
type float
> xxTableColumnAdd("NumC", 1, th1); // column 3 is of
type float
> xxTableColumnAdd("NumD", 1, th1); // column 4 is of
type float
> }
>
> //........
>
>
>
>
> ----- Original Message -----
> From: "Fred" <fctonetti@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, May 13, 2003 8:45 PM
> Subject: [amibroker] Re: Scoring and Ranking System example using
ABtool
>
>
> > Uenal,
> >
> > An example at the moment is that given that AB does not handle
> > portfolio investments correctly in terms of how invested you are
and
> > what initial capital is needed and how that relates to the watch
list
> > size as opposed to how many trades are actually being taken etc.
in
> > order to combat these things it's necessary to control
transactions
> > oneself and keep track of how individual trades affect portfolio
> > equity etc. and since AB processes portfolios on a symbol by
symbol
> > basis rather then on a bar by bar basis one needs to keep track
of
> > this info on a bar by bar basis or at least that's how I'm doing
it
> > and it works fine but for each symbol I need to export the table
and
> > then import it for the next symbol to continue.
> >
> > Fred
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, uenal.mutlu@xxxx wrote:
> > > From: "Fred" <fctonetti@xxxx>
> > > > I understand the functionality of Table Export/Import, but
for
> > > > example in running an AA back test or optimization across
> > multiple
> > > > symbols my understanding is that AB clears the contents of
> > virtually
> > > > everything between one symbol and the next and it would be
> > usefull to
> > > > be able to some how have persistancy in tables as opposed to
> > having
> > > > to export them at the end of processing for one sysmbol and
then
> > > > importing them again at the beginning of processing of the
next
> > > > symbol.
> > >
> > > Need to think a while on this...
> > > Please give me a small practical example to follow.
> > >
> > > > On another topic, I know this can be done externally using
OLE
> > > > Automation etc., but it would be usefull to be able to get at
all
> > > > the "settings" information that AA has, a lot of which can
not be
> > > > gotten with a STATUS("xxx") type command from within an AA.
> > >
> > > Got it, will see.
> > >
> > > UM
> > >
> > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, uenal.mutlu@xxxx wrote:
> > > > > Hi Fred,
> > > > > the functions xxTableExportBinary(), xxTableImportBinary(),
and
> > > > > their ASCII versions xxTableExport() and the new
xxTableImport()
> > > > > are possibilities for making the tables persistent: just
save
> > > > before quitting
> > > > > and load after starting. This also could be automated. If
there
> > is
> > > > demand
> > > > > for this le me know.
> > > > > As stated in my Todo list there is another point with an
> > extension
> > > > DB.
> > > > > The persistent variables will be automatically
saved/loaded.
> > > > Unfortunately
> > > > > they are delayed due to the Sort bug introduced in the last
> > version.
> > > > > FYI: a bugfixed version was uploaded.
> > > > > UM
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Fred" <fctonetti@xxxx>
> > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > Sent: Tuesday, May 13, 2003 6:32 PM
> > > > > Subject: [amibroker] Re: Scoring and Ranking System example
> > using
> > > > ABtool
> > > > >
> > > > >
> > > > > > Uenal,
> > > > > >
> > > > > > Is the implication here that things like ABTool tables
could
> > be
> > > > made
> > > > > > to be persistant ?
> > > > > >
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, uenal.mutlu@xxxx wrote:
> > > > > > > Here is a sample code on how to use the Ticker and Table
> > > > > > > functions of the ABtool plugin to realize Systems based
on
> > > > > > > Scoring and Ranking.
> > > > > > > Attached is the AFL program code
> > ("xx_Sorting_And_Ranking.afl")
> > > > > > >
> > > > > > >
> > > > > > > Some other info on ABtool:
> > > > > > >
> > > > > > > - ABtool documentation bug:
> > > > > > > TableSortDefDeleteAll() was renamed to
TableSortDefDelAll
> > ()
> > > > > > > Just forgot to update the dox :-( In the next version
it
> > will
> > > > be
> > > > > > fixed.
> > > > > > >
> > > > > > > - Persistent AFL variables:
> > > > > > > The next version of ABtool will have global and
> > persistent
> > > > AFL
> > > > > > > variables implemented. Persistent means "always
> > available";
> > > > ie.
> > > > > > they
> > > > > > > got saved and restored automatically. The user can
save
> > > > copies of
> > > > > > > single number variables and string variables in
> > persistent
> > > > area,
> > > > > > and
> > > > > > > recall them whenever he/she likes. Each variable is
> > > > identified by
> > > > > > a
> > > > > > > unique name the user gives the variable. So, this is
like
> > the
> > > > > > environment
> > > > > > > variables, but env vars are limited to string type
only
> > and
> > > > are
> > > > > > limited
> > > > > > > by size and the number of envvars by the operating
> > system.
> > > > The
> > > > > > persistent
> > > > > > > variables don't have any limitations. Put as much
vars as
> > you
> > > > > > like there
> > > > > > > (also very long strings), and they will be available
even
> > > > after
> > > > > > restarting
> > > > > > > AB or the plugin.
> > > > > > >
> > > > > > > I'm just testing it. Till then.
> > > > > > > UM
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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/
> >
> >
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/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/
|