# Tips on "RankPrev" to use in a ranking system

I am looking for a method to create a rule to weight ranking that is improving. In the screen and the simulator, it is possible to use “RankPrev” as a rule, but is there something similar for the ranking system that gives extra weight to stocks where the ranking score is improving?

You can certainly look at improving factor X in a ranking system by comparing the current value of X to a historical value. For example, to look at improving ROE%TTM, you can use (ROE%(0,TTM)-ROE%(1,TTM))/Abs(ROE%(1,TTM)).

Obviously, there’s no way to look at improvements in a whole ranking system within the ranking system itself because that would be an infinite loop.

My thinking was more on the total score.

Something like this, or a version of this: RankPrev (0) > RankPrev (2) and RankPrev (2) > RankPrev (4) and RankPrev (4) > RankPrev (8) and RankPrev (8) > RankPrev (16)

Is this possible to use in RS in any way?

No, as I said above, “Obviously, there’s no way to look at improvements in a whole ranking system within the ranking system itself because that would be an infinite loop.” Rankprev can’t be a factor in a ranking system. It can only be used in screens and simulations.

Can I get the ranking it had when I bought the certain stock?

Yes, in a screen, or the ranks tab of a ranking system, set the “As Of” box to the date you bought the stock.

I set the sell rule as RankPos > RankPosPrev(NoDays/5) + 20 but the system said “Parameter weeksAgo must be constant for RankPosPrev()”

Yes, RankPosPrev() only accepts numerals, not formulas. Also, NoDays is calendar days, so if you want to use something to signify weeks, use NoDays/7 or NoBars/5.

I think what you’re trying to do can be accomplished with nested Evals. For instance, Eval(NoDays < 8, RankPosPrev(1),Eval(NoDays < 15, RankPosPrev(2), Eval(NoDays < 22, RankPosPrev(3), . . . Eval( NoDays < 78, RankPosPrev(11),RankPosPrev(12)))))))) . . . something along those lines.

Actually, this can’t be done. Only 5 different offsets can be used at a time with RankPosPrev. I apologize for misguiding you.