January 24, 2016
How to count symbols in given category
When we want to find out how many symbols belong to given category (such as watchlist) then for manual inspection, it is enough to hover the mouse cursor over the particular category name in the Symbols window and the information will be shown in a tooltip:
If we want to check such information using AFL code, we could read the list of symbols returned with CategoryGetSymbols and by counting commas (which separate symbol names) find out the number of tickers.
A reusable function is presented below:
function CategoryCountSymbols( category, number )
{
count = StrCount( list = CategoryGetSymbols( category, number ), ",");
return IIf( list == "", 0, count + 1 );
}
Title = "Symbols in watchlist 0: " + CategoryCountSymbols( categoryWatchlist, 0 )
Filed by Tomasz Janeczko at 7:26 am under AFL,Data
Comments Off on How to count symbols in given category