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

Re: [amibroker] rename script



PureBytes Links

Trading Reference Links

There is no stock.name
there is stock.fullname and stock.ticker

I think also that stock = AmiBroker.Stocks.Add( fields[ 0 ] ); adds
new stocks to the list, it appears you are trying to use it to replace
the ticker names


--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


On 12/31/05, brhelpdesk <cassianoqs@xxxxxxxxx> wrote:
> I need a script to rename symbols. I tried this:
>
> /*
> ** The data is stored in lines with following format
> ** <old name>,<new name>
> */
>
> WScript.Echo( "Script Started" );
>
> /* change this line according to your data file name */
> ImportStocks("test.txt");
>
> WScript.Echo( "Finished" );
>
> function ImportStocks( filename )
> {
>        var fso, f, r;
>        var ForReading = 1;
>        var AmiBroker;
>        var fields;
>        var stock;
>
>
>        /* Create AmiBroker app object */
>        AmiBroker = new ActiveXObject( "Broker.Application" );
>
>        /* ... and file system object */
>        fso = new ActiveXObject( "Scripting.FileSystemObject" );
>
>        /* open ASCII file */
>        f = fso.OpenTextFile( filename, ForReading);
>
>        i = 1;
>        /* read the file line by line */
>        while ( !f.AtEndOfStream )
>        {
>                r =  f.ReadLine();
>
>                /* split the lines using comma as a separator */
>                fields = r.split(",");
>
>                try
>                {
>
>                        /* add a ticker - this is safe operation, in
> case that        */
>                        /* ticker already exists, AmiBroker returns
> existing one */
>                        stock = AmiBroker.Stocks.Add( fields[ 0 ] );
>
>                        stock.name = fields[ 1 ];
>
>                }
>                catch( e )
>                {
>                                WScript.echo( "There is a problem in
> line no." + i + ".\nThe line looks as follows:\n'" + r + "'\nIt will
> be skipped and next lines will be processed as normal" );
>                }
>
>                i++;
>        }
>
>        /* refresh ticker list and windows */
>        AmiBroker.RefreshAll();
>
> }
>
>
> but didn't work. error in this line
> stock.name = fields[ 1 ];
> Is it possible to rename? Other field work eg.
> stock.webid = fields[ 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
>
>
>
>
>
>
>
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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