Folks,I can do with some of your gyaan.
--- In [email protected], "sohamdas" <soham...@...> wrote: > > Hi Folks, > > I have this file in this format > > 3MINDIA,Diversified,0 > AARTIIND,Chemicals,1 > ABAN,Oil Drilling And Exploration,2 > .,.,. > .,.,. > > and using this file to run this code: > > EnableScript("jscript"); > /* change this line according to your data file name */ > <% > var filename = "Industry.csv"; > 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); > /* read the file line by line */ > while ( !f.AtEndOfStream ) > { > r = f.ReadLine(); > > /* split the lines using comma as a separator */ > fields = r.split(","); > > /* add a ticker - this is safe operation, in case that */ > /* ticker already exists, AmiBroker returns existing one */ > stock = AmiBroker.Stocks.Add( fields[ 0 ] ); > stock.IndustryID = parseInt( fields[ 2 ] ); > } > /* refresh ticker list and windows */ > AmiBroker.RefreshAll(); > %> > Buy = Sell =0; > > But this code is not working. > Would like to know, where I am going wrong. > > I would like to classify the stocks as per the industryid. > Help appreciated > Soham >
