Hey all - I'm interested in trying to do a comparison of stocks, in
terms of relative strength as Tom Dorsey describes it.
Now, for two stocks, this is easy to do. But what I want to do is
scan a group and then compare them against each other. So, if have 3
stocks (A,B,C,D), I'd like to compare:
- A and B
- A and C
- A and D
- B and C
- B and D
- C and D (I think I got all the combinations!)
And then I want to rank them and buy the top N stocks. I'm really not
sure where to begin with this.
I believe I want to use the Rotational backtester - but I'm not clear
on how I would make the positionscore right. I'm thinking of
something like this (this is pseudo code):
for i = 0 to NumberofEquities - 1
{
for j = 0 to NumberofEquities - 1
{
Equity(i)_RS = (Equity(i)/Equity(j)) * 1000
if i > 0 and j > 0 then
if Equity(i)_RS > Equity(i-1)_RS then
PositionScore(Equity(i)) = PositionScore(Equity(i)) + 1
}
}
But I'm really not clear on whether doing something like this is possible.
If anyone could give me a good starting point, I'd appreciated.
Thanks!