For starters directory separators need to be double backlashes or single forward slashes in AFL ... Did you close the file when done ?
--- In [email protected], Ken Close <[EMAIL PROTECTED]> wrote: > > Fred: > > Thanks for the support. > Check my attempt below which does not work, and offer another suggestion > please. Also, I would think you have been around to know that examples and > descriptions in the help file are often so simple (some would say trite), > that they are not helpful in getting a task done. New and even experienced > users would certainly agree. Thus, requests for help, like mine, are often > made **after** hours spent in the help files and scouring the Message files > does not produce an answer or even a hint. You assume they have not been > read, but often they have and do not answer the question asked. > > In this case, it is not only **not** obvious, but impossible so far to > figure out how to get the symbols from the tls file into a variable (what > type?) so they can be added to the Watchlist via the CategoryAddSymbol > command. > > Again, the following code does not produce any error messages but nothing > happens with either Scan or Explore (set to current symbol, n=1). I can not > even get the error message in the if/else statement to show up when I enter > a nonexistent filename---where is it supposed to show up? > > (Again, so much is missing from the help files that dialog like this is > necessary, even after reading it several times.) > > > // For Test, use WL 8 Test > WLNum = 8; > IPList = GetCategorySymbols(categoryWatchlist, WLNum); > > for (i = 0; i < 999999; i++) > { > TickerNext = StrExtract(IPList, i); > if (TickerNext == "") > i = 999999; > else > CategoryRemoveSymbol(TickerNext, categoryWatchlist, WLNum); > } > > // Open and get symbols in TLS > > fh = fopen( "C:\Documents and Settings\Owner\My Documents\My > Documents\AmiBroker\_Z_ETFs\DIA.tls", "r"); > if( fh ) > { > while( ! feof( fh ) ) > { > Sym =( fgets( fh ) ); > CategoryAddSymbol( Sym, categoryWatchlist, 8); > > } > } > else > { > printf("ERROR: file can not be found (does not exist)"); > } > Filter=1; > Buy=0; > AddColumn(Close, "Price", 1.2); > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of Fred > Sent: Friday, September 15, 2006 11:10 AM > To: [email protected] > Subject: [amibroker] Re: Loading Symbols via AFL--was: I need a little help > with an ATC > > Ken, > > I already answered your a) & c) questions on another board and provided code > for you to use. > > If you are wanting to get the list from a .tls or .txt file then use the > > fopen( filename, mode ) > > command to open whatever file you want to get the list from ... the > > fgets( filehandle ) > > command to read line items from the file ... the > > CategoryAddSymbol( symbol, category, number ) > > To add the symbol(s) to whatever category . and the > > fclose( filehandle ) > > To close the file when you are done. > > Books, Documentation & Help Files are wonderful things . especially when > one actually uses them. > Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/amibroker/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
