Rotation Strategy based on a ratio of two stocks
Author: changhengyiu
Creation Date: 9/6/2015 12:04 PM
profile picture

changhengyiu

#1
I am trying to test Rotation Strategy base on a ratio of two stocks but never succeed. Could you tell me what parts are not correct?? I put three sets symbols in it for example. There will be more sets in it actually.
CODE:
Please log in to see this code.
profile picture

Eugene

#2
How about this?

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

changhengyiu

#3
Eugene,thanks a lot. There shows a error message when i run it. I show it with a picture. Could you take a look?
profile picture

Eugene

#4
Please either run not on All Data (select "Most recent" or "Fixed bars") or change this line:

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

changhengyiu

#5
Thank you, It works well!
profile picture

changhengyiu

#6
Hi Eugene
I found that "Min.holding time" doesn't have function here. Could you take a took?
profile picture

Eugene

#7
It is purposefully disabled due to a bug:

ActiveTrader 2012-05 | Efficient Rotation strategy

See posts #31 (problem) and #33 (solution).
profile picture

Swissi

#8
I am looking for a way to use fundamental data as basic input for a rotation script. F.ex. I have 10 currencies and I have ten interest rate differential series. I want now to rank each week/month the interest rate differentials and buy the three currenices with the three highest differentials.
The Dogs of the Dow strategy does use fundamental information to rank the 30 Dow stocks. But the script use FundamentalDataItems, which are not available in my case.
Can I use GetExternalSeries in a rotation script?

profile picture

Eugene

#9
QUOTE:
Can I use GetExternalSeries in a rotation script?

Why not? The rotation Strategy in post #2 does exactly that i.e. uses GetExternalSymbol (or GetExternalSeries if you like).
profile picture

Swissi

#10
Thank you for the hint!

I just take a part of the code:

CODE:
Please log in to see this code.


How can get a printout (f.ex. PrintDebug) of lstPreminum1? I would like to have more information about the content of the list.
Where can I find more information about "List"?

profile picture

Eugene

#11
QUOTE:
Where can I find more information about "List"?

This is such a basic primitive of .NET that you can find this and other collections covered in (absolutely) any C# 101 resource: How do I start with C# ? Although it's slightly off topic, the "lstPreminum1" is a Dictionary rather than a List.

QUOTE:
How can get a printout (f.ex. PrintDebug) of lstPreminum1?

As simple as this:
CODE:
Please log in to see this code.

Each "item" here is a KeyValuePair<string, DataSeries>. That's why the .Value part of it has Description property - because it's a DataSeries. Any type can be assigned here - it's just an example.