Counting active stocks in S&P 100 Past & Present

I have Norgate Platinum data with access to delisted securities. My objective is to count delisted securities for the last 100 weeks on a weekly timeframe.

Here is the code:

wlnum = GetOption( "FilterIncludewatchlist" );
List = CategoryGetSymbols( categoryWatchlist, wlnum );

if( Status( "stocknum" ) == 0 )
{
StaticVarRemove( "~delistCount*" );
StaticVarRemove( "~testSymbolCount*" );
StaticVarRemove( "~closeAbove100*" );

for( n = 0; ( Symbol = StrExtract( List, n ) )  != "";  n++ )
{
    SetForeign( Symbol );
    
    dt = Datetime();
    
    delisting_date = GetFnDataForeign("DelistingDate", symbol);
  is_delisted = DateTimeDiff(dt, delisting_date) > 0;

  is_closeAbove100  = Close > 100;
        
    StaticVarAdd( "~delistCount", is_delisted);
    StaticVarAdd( "~closeAbove100", is_closeAbove100);

  StaticVarAdd( "~testSymbolCount", 1 );


   RestorePriceArrays();
}

}

svDelistCount = StaticVarGet( "~delistCount" );
svTestSymbolCount = StaticVarGet( "~testSymbolCount" );
svCloseAbove100 = StaticVarGet( "~closeAbove100" );

Filter = Status( "stocknum" ) == 0;
SetOption("NoDefaultColumns",True);
AddColumn(DateTime(), "Date", formatDateTime);

AddColumn (svDelistCount, "Count of Is Delist?");
AddColumn (svCloseAbove100, "Count of C > 100");
AddColumn (svTestSymbolCount, "Symbol Count");

This is the result that I am getting. Can please someone point me in the right direction?

image

I have already checked this post on the forum but it didn't help.

Hi @Tomasz @fxshrat can you please guide me on this?