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

Re: [amibroker] Looping through "foreign" files



PureBytes Links

Trading Reference Links




Hi Chuck,
would the following help? If yes, I can send you 
a 
beta of the plugin. <FONT 
face=Arial>But, it is a beta and not certified
yet by amibroker.com. 

I'm open for more useful additions to the 
plugin.
UM
 
/* ABtool.AFL for private plugin 
ABtool.DLL   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. 
 
     STRING TickerFirst(NUMBER 
watchlistnum);             
// gets first ticker in the WL (eventually put all to a WL to use 
this)     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 FileOpen(STRING filename, 
STRING mode);       // mode: "r", "w", 
"a"     NUMBER FileClose(NUMBER 
filehandle);                 
// filehandle was returned by FileOpen()     NUMBER 
FileWriteStr(STRING str, NUMBER filehandle);
     STRING FileReadLine(NUMBER 
filehandle);              
// newline char will be removed internally*/
 
Filter = true;
 
WL    = 
1;             // 
set your WL herefname = "test2a.txt";  // define the 
filename
 
nTickerWL = TickerCount(WL);AddColumn(nTickerWL, 
"TickersInWL", 1);
 
nTickerAll = TickerCount();AddColumn(nTickerAll, 
"TickersAll", 1);
 
// write all tickers in WL to a filefh = FileOpen(fname, 
"w");ticker = TickerFirst(WL);FileWriteStr(ticker + "\n", fh);fEnd = 
false;while (!fEnd)  {    ticker = 
TickerNext(WL);    if (ticker != 
"")      FileWriteStr(ticker + "\n", 
fh);    else      fEnd = 
true;  }FileClose(fh);  // dont forget to close!
 
// read file:fh = FileOpen(fname, "r");fEnd = false;while 
(!fEnd)  {    ticker = 
FileReadLine(fh);    if (ticker != 
"")      ticker = ticker;  // do here 
something better than that    
else      fEnd = true;  
}FileClose(fh);  // dont forget to close!
 
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=chuck_rademacher@xxxxxxxxxx 
  href="">Chuck Rademacher 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, May 02, 2003 11:04 PM
  Subject: RE: [amibroker] Looping through 
  "foreign" files
  <FONT 
  face=Arial>
  I'll 
  partially answer my own question by asking another.   Perhaps it 
  might give someone an idea for helping me.   
  <FONT face=Arial color=#0000ff 
  size=2> 
  Is 
  there some way to access a text file from within a loop?    The 
  text file could contain all of the tickers that I want to access in the 
  loop.   Or... do I need to write a dll to do 
  this?
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>Cheers
  <BLOCKQUOTE 
  >
    <FONT face="Times New Roman" 
    size=2>-----Original Message-----From: Chuck Rademacher 
    [mailto:chuck_rademacher@xxxxxxxxxx]Sent: Friday, May 02, 2003 
    4:52 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
    [amibroker] Looping through "foreign" files
    <FONT face=Arial color=#0000ff 
    size=2>The time has come for me to find a better way of looping through 
    thousands of foreign files.
    <FONT face=Arial color=#0000ff 
    size=2> 
    <FONT face=Arial color=#0000ff 
    size=2>For each stock in my watchlist, I want to look at all of the other 
    stocks in that watchlist within a loop.   
    <FONT face=Arial color=#0000ff 
    size=2> 
    If 
    the "foreign" statement would accept a stockID number instead of a ticker, I 
    could probably make a decent loop to do the job.   But, alas, 
    that's not how it works.
    <FONT face=Arial color=#0000ff 
    size=2> 
    <FONT face=Arial color=#0000ff 
    size=2>Surely someone has been here before?
    <FONT face=Arial color=#0000ff 
    size=2> 
    <FONT face=Arial color=#0000ff 
    size=2>Any assistance would be 
appreciated.






Yahoo! Groups Sponsor












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 the Yahoo! Terms of Service.