Sentiment indicator using Rotation Rank
Author: gaylort
Creation Date: 9/15/2011 10:32 AM
profile picture

gaylort

#1
I am using a Rotation Strategy to trade, but I also use it as a market sentiment indicator. I manually track the rank of several specific ETF symbols in a list of 30 using Excel.
This is easy enough, but backtesting parameter changes within the indicators, and changes in the weighting of the indicators over a few hundred bars is really tedious. I want to capture and plot the daily rank score of these several symbols on a bar by bar basis over a period of a couple of years. Looking at the rotation examples in the forum and Wealth Lab I see that the information is in a "list" in a "holder", but I don't know how to get it into a data series that I can chart. In the several examples of rotation strategies that I have found, the point at which I want to capture the information is just after the "list.Sort(this);" line. I want to get the rank of several specific symbols in the list at that point and add them each to a data series (or something) that I can chart.
On 3/13/2011 in an answer to "trader rog" Eugene said that the calculations were stored in Bars.Cache and are stored as a DataSeries. But I don't know what to do with this information.
I am new to Wealth Lab and C# and cannot find much on "holders". Can anyone point me to an example of this sort of thing.

Thanks
profile picture

Eugene

#2
I'm trying to understand the task from a bird's eye view:

1. Suppose you have the position of each symbol in a DataSet ranked by some indicator on a bar by bar basis. What would you do with it in Wealth-Lab?

2. You mentioned a market sentiment indicator that you keep in Excel. What's the connection to the rotation rank? Maybe what you're looking for could be better accomplished with Index Manager, one way or another?

If you give us the destination, maybe you won't need to care about holders and lists.
profile picture

gaylort

#3
I have a list of 30 ETF symbols representing equities, bonds, currencies, etc., and including SPY, TLT, UUP, and SHY. I rank the symbols daily on ROC and separately on ATR then combine the two. For example, if SPY is ranked 10 on ROC and 15 on ATR and I am using a 60-40 setup, I multiply ROC rank by 0.6 and ATR rank by 0.4 and subtract the ATR result from the ROC result for a final score. (ATR is sorted low to high.) I chart the resulting score for each of the above four symbols in Excel. Tracking the movement of these gives me an idea of where the market is heading and what is causing it.
The process begins just like a stock rotation strategy, except that the goal here is to simply produce a chart, not a trade. On each bar I want to sort the list on ROC, then sort the list on ATR, then for each of the four symbols above calculate the final score and store that score in a DataSeries, or something that I can chart once all the bars are completed. It will produce four plots, one for each symbol. Ultimately I want to optimize the parameters for the indicators ATR & ROC, and modify the 60-40 weighting for different situations. I think I can collect the data in separate holder for each symbol, that isn't cleared after each bar, but I don't know how to get it into a form to chart. Thanks for the quick response.
profile picture

gaylort

#4
Here is a better view of the flow I want. I think.
This is just an outline, not any kind of code.

for each bar
for each symbol
get ROC
add to ROCholder (or list of some kind)
get ATR
add to ATRholder
next symbol
sort ROCholder hi to lo to get ROCrank
sort ATRholder lo to hi to get ATRrank

for each symbol
score = (ROCrank * 0.6) - (ATRrank * 0.4)
add result to SCOREholder (or list of some kind)
next symbol
sort SCOREholder hi to lo to get scoreRank
add SPY scoreRank to a SPYlist
add TLT scoreRank to a TLTlist
and so on for UUP & SHY
next bar
Chart SPYlist
Chart TLTlist
and so on
profile picture

Cone

#5
Logic is sound, except replace "SPYlist" etc. with DataSeries and then you have it. It's just a matter of programming.
profile picture

Eugene

#6
I'm sorry but can't offer any assistance with coding 'til the end of the month, but here's a starting point:

Combined rotation/ranking question

See code in my reply # 1/17/2011 4:26 AM.
profile picture

gaylort

#7
Thanks for the help guys. I think I have it working. One problem though. When I chart the SPY DataSeries, I want the Y axis to run from lower values at the top to larger values at bottom. In other words, I want to invert the y axis on the indicator chart pane. I do this in Excel, so I assume there is a way in C#, but I can't seem to find the right question to ask.

Thanks
profile picture

Eugene

#8
Frankly, I hear about this idea for the first time here. There's no WealthScript property/feature to invert the scale but you could change the sign of the values in a copy of your DataSeries and plot the copy as usual. So that e.g. RSI 10.0 becomes -10, 65.0 becomes -65.
profile picture

gaylort

#9
Thanks. I think I will just get used to looking at the rankings "upside down".
On another topic, where can I find the genetic optimizer? I see a little talk about it in the forum, but I cannot find anything on it in my Fidelity version of Wealth Lab.
profile picture

Cone

#10
Any extension that is not "Fidelity Supported" will not automatically appear in the Extensions Manager. You have to find and download it from this site. Click Extensions in the upper menu above for all the details (or see the User Guide).
profile picture

gaylort

#11
Thanks. Don't know how I missed the "Get Extensions" tab.