Hello community,
I am new and have problems with afl and need your friendly help.
I tried to work with results to get results from the first results. To show the problems I simplified my snippet. I took a List with only 17 securities and searched only for “Close greater than 50.
First I tried the Exploration/Watchlist- Method from Tomasz Janeczko ( “how to add exploration results to a watchlist”). The Date of the last Bar was 03.13.2020. In the generated watchlist there were stored 11 Securities (Filter C >50). Searching manually with Plot there are only 7 securities with a C above 50.
Here my snippet.
List = "531370,747206,855681,870747,878841,A0DJ6J,B00340,B75200,BASF11,E40225,KSAG88,A0HN5C,A2AP36XETF,B55750,C23100,CBK100,E23212";
for ( i = 0; ( sym = StrExtract( List, i ) ) != ""; i++ )
{
C = Close;
}
Plot( C, "", colorGold);
listnum = 49; //
if ( Status( "stocknum" ) == 0 )
{
oldlist = CategoryGetSymbols( categoryWatchlist, listnum );
for ( i = 0; ( sym = StrExtract( oldlist, i ) ) != ""; i++ )
{
CategoryRemoveSymbol( sym, categoryWatchlist, listnum );
}
}
Filter = C >= 50;
AddColumn( Close, "Close" );
if ( LastValue( Cum( Filter AND Status( "barinrange" )) ) )
{
CategoryAddSymbol( "", categoryWatchlist, listnum );
}
After that I tried with the same data to work with the “Composite and Scan Method” (Herman van den Bergen). Here I got only 5 numbers with C > 50 rather than 7 securities. Why that?
Here is this snippet.
List = "531370,747206,855681,870747,878841,A0DJ6J,B00340,B75200,BASF11,E40225,KSAG88,A0HN5C,A2AP36XETF,B55750,C23100,CBK100,E23212";
NumList = 1+StrCount(List, ",");
for ( i = 0; ( sym = StrExtract( List, i ) ) != ""; i++ )
{
C = Close;
}
Plot( C, "", colorGold);
Values17 = C > 50;
Buy = 0;
Sell = 0;
AddToComposite(1,"~rscongestion","I",1 + 2 +16); // , 1 + 2 + 8 + 16
AddToComposite(Values17,"~rsbullish","V");
V1 = Foreign("~rscongestion","I");
ValGood = LastValue((Foreign("~rsbullish","V",1))); // LastValue
ValBad = NumList-ValGood; // V1
What is wrong in my snippets.
Please help!