I want to calculate the number of stocks that satisfy the condition RSI >80 from a list of categoryGroup. However, after Explorer, the Explorer results are not the same as the results I calculated myself with Excel. How to fix this code to calculate Exactly?

```
wlnum = GetOption( "FilterIncludeGroup" );
List = CategoryGetSymbols( categoryGroup, wlnum );
AboveLevel = 80; // Param("TestLevel", 20, 5, 35, 1);
BelowLevel = 20;
PeriodRSI=3;
if( Status( "stocknum" ) == 0 )
{
// cleanup variables created in previous runs (if any)
StaticVarRemove( "~RSI*" );
StaticVarRemove( "~RSICount*" );
StaticVarRemove ("~RSIBelow*");
for( n = 0; ( Symbol = StrExtract( List, n ) ) != ""; n++ )
{
SetForeign( symbol );
RSIVal = RSI( PeriodRSI ); // put in the RSI you are interested in
//TestLevel = 20; // this line seems to work here or above - see line 8
DKVol=MA(V,20)>100000 AND V>150000;
RSIabove = RSIVal > AboveLevel AND DKVol;
RSIbelow= RSIVal < BelowLevel AND DKVol;
RSI80=Cross(80,RSIVal) AND DKVol;
RSI20=Cross(RSIVal,20) AND DKVol;
RSITang50=Cross(RSIVal,50) AND DKVol;
RSIGiam50=Cross(50,RSIVal) AND DKVol;
RSITang= RSIVal>Ref(RSIVal,-1) AND DKVol;
RSIGiam= RSIVal<Ref(RSIVal,-1) AND DKVol;
StaticVarAdd( "~RSIabove", RSIabove);
StaticVarAdd( "~RSIbelow", RSIbelow);
StaticVarAdd( "~RSI80", RSI80);
StaticVarAdd( "~RSI20", RSI20);
StaticVarAdd( "~RSITang50", RSITang50);
StaticVarAdd( "~RSIGiam50", RSIGiam50);
StaticVarAdd( "~RSITang", RSITang);
StaticVarAdd( "~RSIGiam", RSIGiam);
//StaticVarAdd( "~RSICount", NOT IsNull( RSIabove) );
RestorePriceArrays();
}
}
svRSIabove = StaticVarGet( "~RSIabove" );
svRSIbelow = StaticVarGet( "~RSIbelow" );
svRSI80 = StaticVarGet( "~RSI80" );
svRSI20 = StaticVarGet( "~RSI20" );
svRSITang50 = StaticVarGet( "~RSITang50" );
svRSIGiam50 = StaticVarGet( "~RSIGiam50" );
svRSITang = StaticVarGet( "~RSITang" );
svRSIGiam = StaticVarGet( "~RSIGiam" );
///////////////
// Kich ban VNINDEX
///////////////
BanhetCP=Ref(svRSIabove,-1)>80 AND svRSIGiam50>=30 AND (svRSIGiam50-svRSITang50)>5 AND svRSIGiam>=100 AND (svRSIGiam-svRSITang)>70;
GiamCP=(Ref(svRSIabove,-1)>80 AND svRSIGiam50>=30 AND (svRSIGiam50-svRSITang50)>5 AND svRSIGiam>=100 AND (svRSIGiam-svRSITang)>70) OR
(svRSIabove>100 AND svRSIGiam50>=30 AND (svRSIGiam50-svRSITang50)>5 AND svRSIGiam>svRSITang) OR
svRSIGiam50>40 OR (svRSIabove>100 AND svRSI80>=50);
CannhacGiam=svRSIabove>80 AND svRSIGiam50>=30 AND svRSI80 >=30 AND svRSIGiam50>svRSITang50;
MuaCP= (svRSIabove<100 AND svRSITang>=100 AND (svRSITang-svRSIGiam)>70 AND svRSITang50>=30 AND (svRSITang50-svRSIGiam50)>5) OR svRSI20>=40;
TextVNI=WriteIf(BanhetCP,"Ban het CP", WriteIf(GiamCP,"Giam ty trong CP",WriteIf(CannhacGiam,"Can nhac giam ty trong CP", WriteIf(MuaCP, "Mua/Gia tang CP",""))));
ColorVNI=IIf(BanhetCP OR GiamCP,colorRed,IIf(MuaCP,colorLime,colorDefault));
Buy=Cross(RSI( PeriodRSI ),50) AND V>300000 AND C>WMA(C,40);
///////////////
// Explore
///////////////
Filter = 1 AND MA(V,20)>100000 AND V>150000;
AddColumn( Day(), "Day", 1.0 );
//AddColumn( C, "P", 1.0 );
AddColumn( V, "Volume", 1.0 );
AddColumn( Ref(RSI( PeriodRSI ),-1), "Pre_RSI14", 1.2, colorBlack, IIf(Ref(RSI( PeriodRSI ),-1) > aboveLevel, colorLime, colorDefault )) ;
AddColumn( RSI( PeriodRSI ), "RSI14", 1.2, colorBlack, IIf( RSI( PeriodRSI ) > aboveLevel, colorLime, colorDefault ) );
AddColumn( RSI( PeriodRSI )-ref(RSI( PeriodRSI ),-1), "+/-RSI", 1.2, colorBlack, IIf( RSI( PeriodRSI )>ref(RSI( PeriodRSI ),-1), colorLime, colorDefault ) );
AddColumn( svRSIabove, ">80", 1.2, colorBlack, IIf( svRSIabove > 80, colorred,IIf(svRSIabove > 60,colorYellow,colorDefault )));
AddColumn( svRSIbelow, "<20", 1.2, colorBlack, IIf( svRSIbelow >100, colorLime,IIf(svRSIbelow >80,colorYellow, colorDefault )));
AddColumn( svRSITang, "Tang", 1.2, colorBlack, IIf( svRSITang > 100 AND (svRSITang-svRSIGiam)>50 , colorLime, colorDefault ) );
AddColumn( svRSIGiam, "Giam", 1.2, colorBlack, IIf( svRSIGiam > 100 AND (svRSIGiam- svRSITang)>50 , colorLime, colorDefault ) );
AddColumn( svRSI80, "Giamduoi80", 1.2, colorBlack, IIf( svRSI80 > 50, colorred, colorDefault ) );
AddColumn( svRSIGiam50, "Giamduoi50", 1.2, colorBlack, IIf( svRSIGiam50 >= 30, colorred,IIf( svRSIGiam50 >= 20, colorYellow, colorDefault ) ));
AddColumn( svRSI20, "Tangtren20", 1.2, colorBlack, IIf( svRSI20 > 40, colorLime, colorDefault ) );
AddColumn( svRSITang50, "Tangtren50", 1.2, colorBlack, IIf( svRSITang50 >= 30, colorLime,IIf( svRSITang50 >= 20, colorYellow, colorDefault ) ));
AddTextColumn(TextVNI,"Kich ban VNI",1.2,colorDefault,ColorVNI);
AddColumn( IIf(Buy,1,0), "BuyRSI", 1.0 );
```