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

[amibroker] Re: getting a list of watchlists that my symbol belongs to



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@xxx> wrote:
>
> --- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@> wrote:
> >
> > Put in some _TRACE commands to see if you're getting what you 
> expect from
> > the fgets.
> > 
> > If you still can't figure it out - I'll try to get it working Fri.
> > 
> > d 
> > 
> > > -----Original Message-----
> > > From: amibroker@xxxxxxxxxxxxxxx 
> > > [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of murthysuresh
> > > Sent: Thursday, June 19, 2008 8:41 PM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: getting a list of watchlists that my 
> > > symbol belongs to
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@> wrote:
> > > >
> > > > The only way I know is to read 
> the ..Database\WatchLists\Index.txt 
> > > file
> > > > using the fOpen/fGet.. functions.
> > > > 
> > > > Then using a loop go down thru that list and check to see if 
any
> > > > Database\WatchLists\entry + .Tls exists Then you can either 
do 
> as 
> > > you
> > > > described in step 2 or more simply - read each watch list to 
> see if 
> > > it
> > > > contains your current ticker. If it does write your title 
using 
> the 
> > > name of
> > > > the watch list file.
> > > > 
> > > > d 
> > > > 
> > > > > -----Original Message-----
> > > > > From: amibroker@xxxxxxxxxxxxxxx 
> > > > > [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of murthysuresh
> > > > > Sent: Wednesday, June 18, 2008 7:35 PM
> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > Subject: [amibroker] getting a list of watchlists that my 
> > > > > symbol belongs to
> > > > > 
> > > > > i want to print the list of watchlists my stock belongs to 
> either 
> > > in 
> > > > > commentary or in title. here is the logic. i know how to do 
a 
> few 
> > > > > things and dont know the rest and need some help.
> > > > > 
> > > > > my algorithm is simple and basic
> > > > > 1. get list of all watchlists in my app. dunno how to do 
this
> > > > > 2. loop thro the list and check if symbol is in that 
> > > watchlist.use 
> > > > > INWATCHLISTNAME 
> > > > > 3. if 2 matchies, then Title=Title + WatchlistName
> > > > > 
> > > > > 
> > > > > I could use some help for step 1.
> > > > > REgads
> > > > > 
> > > > > Seede
> > > > > 
> > > > > 
> > > > > ------------------------------------
> > > > > 
> > > > > 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 NEW RELEASE ANNOUNCEMENTS and other news always check 
> DEVLOG:
> > > > > http://www.amibroker.com/devlog/
> > > > > 
> > > > > For other support material please check also:
> > > > > http://www.amibroker.com/support.html
> > > > > Yahoo! Groups Links
> > > > > 
> > > > > 
> > > > > 
> > > > > No virus found in this incoming message.
> > > > > Checked by AVG. 
> > > > > Version: 8.0.100 / Virus Database: 270.4.0/1507 - Release 
> > > > > Date: 6/18/2008 7:09 AM
> > > > >
> > > >
> > > 
> > > ok. i have tried so far, it does not seem to work for me. pl 
let 
> me 
> > > know if you find something incorrect in this. i tried to put 
this 
> in 
> > > the commentary section.
> > > 
> > > fh = fopen( "E:\\data\\Stocks\\WatchLists\\index.txt", "r"); 
> > > 
> > > if( fh ) 
> > > { 
> > >    while( ! feof( fh ) ) 
> > >    { 
> > >      if(InWatchListName( wcName=fgets( fh ) )){
> > > 			printf(wcName);
> > > 		}
> > >     
> > >    } 
> > > } 
> > > 
> > > else 
> > > { 
> > >    printf("ERROR: file can not be found (does not exist)"); 
> > > } 
> > > 
> > > 
> > > 
> > > ------------------------------------
> > > 
> > > 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 NEW RELEASE ANNOUNCEMENTS and other news always check 
DEVLOG:
> > > http://www.amibroker.com/devlog/
> > > 
> > > For other support material please check also:
> > > http://www.amibroker.com/support.html
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > No virus found in this incoming message.
> > > Checked by AVG. 
> > > Version: 8.0.100 / Virus Database: 270.4.0/1509 - Release 
> > > Date: 6/19/2008 8:00 AM
> > >
> >
> it opens the file. i think there is a CR/LF at the end of every 
> Watchlist name which cannot be deleted using afl commands. this 
makes 
> the inWatchlistName to fail.
> 
> fh = fopen( "E:\\data\\Stocks\\WatchLists\\index.txt", "r"); 
> 
> if( fh ) 
> { 
>    while( ! feof( fh ) ) 
>    { 
> 		wcName=fgets( fh );
> 
>  /*if(StrFind( wcName,"\n" )){
> 			printf("found carriage return");
> 		}
>     */
> 
> 		//printf(wcName);
> 
> 		StrReplace(wcName,"\n","");
>  if(StrFind( wcName,"\n" )){
> 			printf("found carriage return");
> 		}
> 			
>      if(InWatchListName( wcName )){
> 			printf(wcName);
> 		}
>     
>    } 
> 	fclose(fh);
> } 
> 
> else 
> { 
>    printf("ERROR: file can not be found (does not exist)"); 
> }
>


...more challenges. i tried to use jscript to trim teh carriage 
return. i get a wierd syntax error near the <%. can someone point out 
where i am wrong syntactically.

fh = fopen( "E:\\data\\Stocks\\WatchLists\\index.txt", "r"); 

if( fh ) 
{ 
   while( ! feof( fh ) ) 
   { 
		wcName=fgets( fh );

 /*if(StrFind( wcName,"\n" )){
			printf("found carriage return");
		}
    */

		//printf(wcName);

		StrReplace(wcName,"\n","");
 if(StrFind( wcName,"\n" )){
			printf("found carriage return");
		}
		
	EnableScript("jscript")
	<%
	function mytrim(x)
		{
		return x.replace('\n', '', 'g');

		}
	%> 

	script = GetScriptObject();
	wcNametrimmed=script.mytrim(wcName);
		
     if(InWatchListName( wcName)){
			printf(wcName);
		}
    
   } 
	fclose(fh);
} 

else 
{ 
   printf("ERROR: file can not be found (does not exist)"); 
} 




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

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/