Limiting top 50 stocks on each day in exploration window based on their rsi

i want to display only top 50 stocks on each day in exploration window based on their rsi values of past 1 year .
I tried using staticvargenerateranks function but some ranks are getting skipped .
what else can be done?

StaticVarGenerateRanks() is the correct function to use for this task. What do you mean by “some ranks are getting skipped”? It might be helpful to post your code and an example of the problem.

@manan.singhal I agree with @mradtke that you need to post your code for anyone to try to help figure out what is going wrong.

But you did write that you wanted to list an exploration, so here is a simple example with the SetSortColumns and addRankColumn help sorting an Exploration.
https://www.amibroker.com/guide/afl/setsortcolumns.html
https://www.amibroker.com/guide/afl/addrankcolumn.html

You still need to use StaticVarGenerateRanks() if you want to create a trading signal.

rsiPeriods = Param( "rsiPeriods", 252, 10, 300, 2 );

yearlyRSI = RSI( rsiPeriods ); // using 252 daily bars


Filter = 1; // show all bars
SetSortColumns( -3 );
AddColumn( yearlyRSI, "RSI(" + rsiPeriods + ")" );
addRankColumn();

image

1 Like

thanks for replying...
some ranks getting skipped mean that next rank to 13 is 20 ; 13,14 etc are getting skipped automatically.
it has been done using staticvargenerateranks function.
no filter has been applied to it and also logically the stocks are correctly ordered.
refer from the below screenshot.
screenshot1

thanks for replying…
the problem is I have to perform some tasks on that ranks , so how can I work in same afl using addrankcollumn as its a runtime function.

Check the watchlist you are using in the symbol ranking loop is exactly the same as the one in your Analyser Filter setting. It’s likely you are ranking stocks from one list that are then excluded in the filter setting for the output in the Explore.

I am working on all symbols so, watchlist problem is not the cause of concern

We probably will not be able to help you solve your problem without seeing your code.

3 Likes