Create different lists

Hi Guys,

I need to create the 4 GICS levels in 4 different lists.

List35 = "";
List3510 = "";
List351010 = "";
List35101010 = "";

List35 = CategoryGetSymbols( categoryGICS, 35); 
List3510 = CategoryGetSymbols( categoryGICS, 3510); 
List351010 = CategoryGetSymbols( categoryGICS, 351010);
List35101010 = CategoryGetSymbols( categoryGICS, 35101010);

Count1 = StrCount(List35,",")+1;
Count2 = StrCount(List3510,",")+1;
Count3 = StrCount(List351010,",")+1;
Count4 = StrCount(List35101010,",")+1;

gicsNum = StrToNum(GicsID(0));
gics = GicsID(0);

qq = 0;
aa = 1;

Level 4 "List35101010" does not work well and has 19 symbols:


It is because of more than 7 significant digits, see here.

You may use category name to get member list of a category.

function GetMembersByCatName(listname, category) {
	listnum = CategoryFind(listname, category);
	list = CategoryGetSymbols(category, listnum);
	return list;

As I don't use Gics I don't know whether you have to insert full one (Gics code+name)

gics1 = GetMembersByCatName("35101010 Health Care Equipment", categoryGics);

Or whether just using Gics code works

gics1 = GetMembersByCatName("35101010", categoryGics);

Or whether just using Gics name works

gics1 = GetMembersByCatName("Health Care Equipment", categoryGics);

So try it.


Thank you very much @fxshrat as always your answer is perfect.

Hi @fxshrat,
It only works by name and maximum 3 levels.
With the 4th level it won't let me create the list because there are more than 8 digits.
At least I have 3 levels.