Is it possible to create a stock ranking system from a portfolio?
Author: mikesblack
Creation Date: 4/14/2016 9:20 PM
profile picture

mikesblack

#1
Can WealthLab allow me to rank each member of a portfolio? E.g. Find the top 10 percent of highest ROC.
Thanks
profile picture

Eugene

#2
Check out the "Symbol Rotation" strategy folder. Click "Download" in the "Open Strategy" dialog to get more. They're widely discussed on the forum.
profile picture

mikesblack

#3
Thanks, I'll check them out.
profile picture

mikesblack

#4
I'm a bit confused having looked at these strategies. All I wish to do is allow an indicator to determine the top or bottom percentage of value. Let's say (ATRP.Series(Bars, 5) is within the top 10 percent of all stocks within the SP 500. Print stocks. TIA
profile picture

Eugene

#5
Don't give up that easily. New concepts almost always confuse. For ATRP follow this FAQ: I need other rotation rule other than the built-in RSI. 10% of 500 stocks is 50. Use this as your "n Symbols". PrintDebug prints.
profile picture

mikesblack

#6
QUOTE:
10% of 500 stocks is 50. Use this as your "n Symbols". PrintDebug prints.

I did look through the material. They gave an example using the highest high as of bar. I can't quite understand how to apply the logic here. I would be grateful if you can supply the code. This will provide an example for other indicators I wish to incorporate.
profile picture

Eugene

#7
I have no idea where you found the example using the "highest high" but in fact not in the Wiki FAQ I referred to. There is no shortage of examples in the Symbol Rotation folder showing all kinds of DataSeries like volatility, ROC, RSI, either top (strongest stocks) or bottom (weakest ones) - the world doesn't need more examples than the dozen at your fingertips. Just replace one series (RSI) with another (ATRP). If unsure how to do so, see those examples along with DataSeries chapters in the WealthScript Guide/QuickRef. Just a one-liner exemplified in the FAQ.
profile picture

mikesblack

#8
OK. I am still unable to figure this out. How then can I see the results of the top 10 percent of stocks with the highest ATRP? Is there a specific rotation strategy that will allow me to rank the stocks in a portfolio. I just tried "Weekly Oversold Rotation" but was unable to figure what I wish to do. Sorry I might seem rather obtuse. Many thanks for your help.
profile picture

Eugene

#9
Okay, here's a simple example listing top/bottom stocks by ROC as of the last bar. Before running, click "References..." in the Editor, check System.Core and click OK. The code is designed to be run on single symbol only. Since you'd be inevitably asking about ATRP I've thrown it in there ;)

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

mikesblack

#10
Thank you Eugene. I'm looking at it now.
profile picture

mikesblack

#11
Thank you Eugene. I'm receiving a runtime error: Attempting to Deserialize an empty stream. I looked through multiple single stocks in different data sets. It runs on any stock within "Indexes" and returns one stock with " Listing Top 1 stock". Is there anything I might do to understand and change this?
profile picture

Eugene

#12
Please don't hesitate to search the Wiki/forum:

"Runtime error: Attempting to Deserialize an empty stream."