Quantcast
Channel: AFL – AmiBroker Knowledge Base
Viewing all articles
Browse latest Browse all 24

How to count symbols in given category

$
0
0

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:

Category symbol count

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 CategoryCountSymbolscategorynumber )
{
   count StrCount( list = CategoryGetSymbolscategorynumber ), ",");  
   return IIf( list == ""0count );
}    

Title "Symbols in watchlist 0: " CategoryCountSymbolscategoryWatchlist);

Viewing all articles
Browse latest Browse all 24

Trending Articles