I am stumped.  Maybe there's a way to do this using menus but i can't
find it.

I spent time creating custom groups and watchlists and now i want to
move a copy of this grouping information to a new database.  Does
anyone know an easy way to do this?  I've started down the path of
writing code and its turning out not to be so straightforward.  Below
is my early start on fput-ing and fget-ing categories to a bunch of
files.  It doesn't work unless you iterate each group at a time the
way i have it now.  Following that is my FGET code that i would run
when the new database - this isn't really hitting it either.

FPUT code (run on old database)
-----------

//1) use scan
//2) for the fputs/catgetsym function below, you have to change
'categoryxxxx' each time you change for i=1;i<2 to i=2,;i<3
//3) reason you have to do this is b/c for some reason catgetsym won't
take "cat" into the place where categoryxxx goes

Buy=0;
//put csv ticker list for each category into variable list 101 to 5063//
//naming:               List101         10255           Market
//naming:               List201         20255           Group
//naming:               List301         30255           Industry
//naming:               List401         4063            Sector
//naming:               List501         5063            watchlist

for( i=5;i<6;i++)
{//1
        if(i==1){VarSetText("Cat","categoryMarket");}
        if(i==2){VarSetText("Cat","categoryGroup");}
        if(i==3){VarSetText("Cat","categoryIndustry");}
        if(i==4){VarSetText("Cat","categorySector");}
        if(i==5){VarSetText("Cat","categoryWatchlist");}
        for( j=0;j<50;j++)
                {//2
                        eyejay=i*10000+j;_TRACE("i = "+i);_TRACE("cat 
"+cat);_TRACE("j =
"+j);_TRACE("eyejay ="+eyejay);
                        fh=fopen("C:\\program
files\\amibroker\\cat\\list"+eyejay+".csv","w");_TRACE("file
"+"C:\\program files\\amibroker\\Cat\\List"+eyejay+".csv");
                                if(fh)
                                {//3
                                        _TRACE("j "+j);
//                                      qs=CategoryGetSymbols("cat",j);
//                                      _TRACE("qs "+qs);
                                        
fputs(CategoryGetSymbols(categoryWatchlist,j),fh);
                                        fclose(fh);
                                }//3
                }//2
}//1



FGET code (to run on new database)
----------------------
//put csv ticker list for each category into variable list 101 to 5063//
//naming:               List101         10255           Market
//naming:               List201         20255           Group
//naming:               List301         30255           Industry
//naming:               List401         4063            Sector
//naming:               List501         5063            watchlist

_TRACE(" ");
_TRACE(" B E G I N ");
Buy=0;
for(i=2;i<3;i++)
{//1
        for(j=0;j<50;j++)
                {//2
                        eyejay=i*10000+j;_TRACE("i = "+i);_TRACE("j = 
"+j);_TRACE("eyejay =
"+eyejay);
                        fh=fopen("c:\\program
files\\amibroker\\cat\\list"+eyejay+".csv","r");_TRACE("file
"+"c:\\program files\\amibroker\\cat\\list"+eyejay+".csv");
                                if(fh)
                                {//3
                                        while(!feof(fh))
                                        {//4
                                                syms=fgets(fh);_TRACE("syms 
"+syms);
                                                
for(k=0;sym=StrExtract(syms,k)!="";k++)
                                                {//5
                                                        sym=StrExtract(syms,k);
                                                        _TRACE("k "+k);
                                                        _TRACE("sym "+sym);
                                                        _TRACE("name "+Name());
                                                
if(sym==Name()){CategoryAddSymbol("",categoryMarket,j);_TRACE("y YYYY");}
                                                        sym=StrToUpper(sym);
                                                
if(sym==Name()){CategoryAddSymbol("",categoryMarket,j);_TRACE("y Y Y
yyy");}
                                                }//5
                                        }//4
                                }//3
                        }//2
}//1





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/

<*> 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/
 



Reply via email to