Rotation System with Two or More Ranking Criteria
Author: Swissi
Creation Date: 3/26/2018 2:58 PM
profile picture

Swissi

#1
There are many good rotation scripts available on the WL platform. But as far as I can see, they all use just one single ranking factor (f.ex. RSI).
I am looking for a script with two or more ranking criteria (RSI, volatility, momentum, ...). It would be nice to have the additional option of having different weightings for each criteria.

profile picture

Eugene

#2
Check out this discussion: Combined rotation/ranking, up to post #16 when it got hijacked and lost its original direction.
profile picture

superticker

#3
Studying the above cited Combined rotation/ranking solution, I think the list.Sort(this) statement in the code below:
CODE:
Please log in to see this code.

... should be moved down (immediately before the last FOR loop) so the "cumulative list" is sorted just prior to poorest-ranking symbol removal.
CODE:
Please log in to see this code.

Oops, this isn't going to work either. The "list.Add(rh)" statements above need to save the "composite rank" (indexer composite) of both listRSI and listROC as the new cumulative "list.val", then sort on that composite ranking item. Hmmm. You can't employ the values of listRSI.val and listROC.val themselves to compute the composite because their indicator values may be orders of 10 different; one needs to compute the composite from their indexer ranks instead.
profile picture

Eugene

#4
QUOTE:
one needs to compute the composite from their indexer ranks instead.

Like the Efficient Rotation strategy does, for example? Much easier indeed.

CODE:
Please log in to see this code.
profile picture

superticker

#5
Actually, the code cited above (and reproduced below)
CODE:
Please log in to see this code.

... will work because the same indicator is used in all cases, so the values returned by these indicator instances are compatible. But if the indicators are different, then you have a problem. For example, if indicator RSI is ten times the value range of indicator ROC, then ROC will always be under represented in listComposite[index].val. So you can't simply add values of different indicators up to get a composite rank; that won't work.

But what you can do is add their ranks (or ranking indexers) up to get a composite rank. I've given a solution below, but it has problems. IndicatorHolder needs to be enhanced to take parameters (which is easy to fix). But you also need to define a Predicate delegate before the list.Find(<IndicatorHolder>Predicate) method will function. Other than that, this is what I have:
CODE:
Please log in to see this code.

One other thing. You don't need separate list element types for all three of these List<...>s. Instead, define a single IndicatorHolder class, then create three separate instances of List<IndicatorHolder> for listComposite, listRSI, and listROC from that single type. Keep it simple (but not too simple).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).