PureBytes Links
Trading Reference Links
|
Here is the latest version of the script including correct error handling etc.:
//-----------------------------------------------------
/* ABtool_demo.AFL for private plugin ABtool.DLL v0.0.3beta 030503Sa
Author: Uenal Mutlu (uenal.mutlu@xxxxxxxxxxx)
Demonstrates the use of some of the following AFL extension
functions of the plugin "ABtool.DLL" (still beta version!).
You should set "ApplyTo current stock" and "n last quotes n=1"
before starting such a script.
The very first call of any of the TickerXXX functions takes a little
bit longer to execute due to scanning the database and building an
internal table (snapshot). All subsequent calls are much faster.
After any changes to any of the watchlists call TickerRefresh().
STRING TickerFirst(NUMBER watchlistnum);
Gets first ticker in the atchlist.
(Eventually first put all your stocks to one WL to use
these TickerXXX functions on all tickers in the DB)
STRING TickerNext(NUMBER watchlistnum);
STRING TickerPrev(NUMBER watchlistnum);
STRING TickerLast(NUMBER watchlistnum);
NUMBER TickerCount(NUMBER watchlistnum = -1);
-1 means all tickers in the database
NUMBER TickerRefresh();
Call this after any changes you made to any of the watchlists.
NUMBER FileOpen(STRING filename, STRING mode);
mode: "r" for readonly
"w" for write (will create if not existing)
"a" for append (will create if not existing)
It returns a FileHandle, which is required for the other FileXXX functions.
NUMBER FileWriteStr(STRING str, NUMBER filehandle);
STRING FileReadLine(NUMBER filehandle);
newline char will be removed internally
NUMBER FileClose(NUMBER filehandle);
Closes a file.
Passing -1 closes all open files
NUMBER GPercent(NUMBER fromval, NUMBER toval);
"Geometric percent"; also negative values correctly handled
ARRAY GPercentA(ARRAY fromval, ARRAY toval);
Array version of GPercent()
NUMBER RelPos(NUMBER bottom, NUMBER top, NUMBER value);
Calculates relative position of the value relative to the bounds
ARRAY RelPosA(ARRAY bottom, ARRAY top, ARRAY value)";
Array version of ReelPos()
*/
//-----------------------------------------------------
//-----------------------------------------------------
Filter = true;
WL = 1; // set your WL here
fname = "test2a.txt"; // define the filename
//-----------------------------------------------------
nTickerWL = TickerCount(WL);
AddColumn(nTickerWL, "TickersInWL", 1);
nTickerAll = TickerCount();
AddColumn(nTickerAll, "TickersAll", 1);
//-----------------------------------------------------
// write all tickers in WL to the file:
fh = FileOpen(fname, "w");
if (fh >= 0)
{
ticker = TickerFirst(WL);
fEnd = false;
while (!fEnd)
{
if (ticker == "")
fEnd = true;
else
{
FileWriteStr(ticker + "\n", fh);
// get ticker's Close price array via foreign
tC = foreign(ticker, "C");
//... here do something useful with "tC" variable...
ticker = TickerNext(WL); // get next ticker
}
}
FileClose(fh); // dont forget to close!
}
//-----------------------------------------------------
// read the file:
fh = FileOpen(fname, "r");
if (fh >= 0)
{
fEnd = false;
while (!fEnd)
{
ticker = FileReadLine(fh);
if (ticker == "")
fEnd = true;
else
{
// do here something better than that:
ticker = ticker;
}
}
FileClose(fh); // dont forget to close!
}
//-----------------------------------------------------
FileClose(-1); // this closes all open files (if any).
//-----------------------------------------------------
----- Original Message -----
From: <amibroker@xxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, May 03, 2003 2:47 PM
Subject: [amibroker] New file uploaded to amibroker
>
> Hello,
>
> This email message is a notification to let you know that
> a file has been uploaded to the Files area of the amibroker
> group.
>
> File : /ABtool/ABtool_v0_0_3_beta.zip
> Uploaded by : anty3de <uenal.mutlu@xxxxxxxxxxx>
> Description : ABtool.DLL AFL plugin v0.0.3 beta
>
> You can access this file at the URL
>
> http://groups.yahoo.com/group/amibroker/files/ABtool/ABtool_v0_0_3_beta.zip
>
> To learn more about file sharing for your group, please visit
>
> http://help.yahoo.com/help/us/groups/files
>
> Regards,
>
> anty3de <uenal.mutlu@xxxxxxxxxxx>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/KXUxcA/fNtFAA/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/
|