Create a new list

Hi,
I want to create a new list from two lists (same as filter settings).

// List GICS 10 Energy (31 Tickers)
list1 = CategoryGetSymbols( categoryGICS, 10); 
WatchListsStr = "";

for( i = 0; ( symbol = StrExtract( list1, i ) ) != ""; i++ )
{
    SetForeign( symbol );
          
		// --> WatchList SP500
	if( InWatchList( 8 ) )  
        {
          WatchListsStr += symbol + ",";
        }

}

// 27 Tickers but nothing comes out
_TRACE(""+WatchListsStr); 

Thanks for your help,
Carlos

Run below code via explorer over your filter setting of your picture (You may set to "Match Any" alternatively to get any matching symbol). Don't forget to set your combined WL number in 4th line of below code.

// Set Filter include in Filter window
// Set your combined WL number in below code
// And run via Explorer
wl_num = 64; // set WL number to add combined symbols to

SetOption( "RefreshWhenCompleted", 1);

Filter = 0;
if ( Status( "action" ) == actionExplore )
	CategoryAddSymbol("", categoryWatchList, wl_num); // add to combining WL 
3 Likes

Thank you very much @fxshrat, it is perfect.