StockFetcher Forums · Filter Exchange · Ranking -- This week vs. last week<< >>Post Follow-up
glgene
523 posts
msg #126610
Ignore glgene
1/6/2016 5:50:23 AM

Is it possible to do multi-period rankings of stocks in a watchlist?

I'm thinking of tracking the performance of a few primary S&P 500 Sector ETFs, based on a performance sorting routine (ROC 1 week), I would like the output to look something like this:

Lastwk, Thiswk, Sym, ROC(5)%
2 ............... 1 ..... XLK....2.35
1.................2 ..... XLP.....2.28
3................ 3...... XLV......2.20
4.................4...... XLI......1.95
6.................5...... XLU.....0.98

And so on (these are made-up numbers above just to show you my concept). As you can see, I sorted on ROC(5), and I included the corresponding ranking number on the "Thiswk" column. But how to show both the "Thiswk" and "Lastwk" corresponding ranking numbers (1 thru 9, for example)? I put the dots there (.) merely as an alignment feature in this write-up; I know the dots would not be present in the final output.

Is this doable in StockFetcher? Sure hope so!

Gene in FL



glgene
523 posts
msg #126721
Ignore glgene
1/14/2016 5:26:03 AM

Kevin,

Since you are the Maestro here (that's a compliment), is my ranking question in this thread doable with StockFetcher scripting, covering "multiple" time periods, such as...

13 wks. ago... 4 wks. ago...2 wks. ago... Last week (past 5 days)

Gene in FL

Kevin_in_GA
4,039 posts
msg #126725
Ignore Kevin_in_GA
1/14/2016 12:01:16 PM

Here is how I code for a ranking of key asset classes (SPY, IWM, AGG, EFA) over a specified time frame. This base code should meet your needs. If you want to look at ranking the previous week, just set up a second set of user defined variables that have "1 week ago" at the end.

Fetcher[

set{var1,WEEKLY ROC(14,1)}
set{var1a, IND(SPY, var1)}
set{var1b, IND(IWM, var1)}
set{var1c, IND(EFA, var1)}
set{var1d, IND(AGG, var1)}

ADD COLUMN WEEKLY ROC(14,1) {14 week performance}

SET{RANK1A, COUNT(var1 is above var1a,1)}
SET{RANK1B, COUNT(var1 is above var1b,1)}
SET{RANK1C, COUNT(var1 is above var1c,1)}
SET{RANK1D, COUNT(var1 is above var1d,1)}
SET{RANK1E, RANK1A + RANK1B}
SET{RANK1F, RANK1C + RANK1D}
SET{RANK1G, RANK1E + RANK1F}
SET{RANK, 4 - RANK1G}
ADD COLUMN RANK {current rank}


SYMLIST(IWM,EFA,SPY,AGG)
ADD COLUMN SEPARATOR
SORT ON COLUMN 5 DESCENDING
chart-display is weekly
CHART-TIME IS 26 WEEKS
]




glgene
523 posts
msg #126726
Ignore glgene
1/14/2016 1:02:59 PM

Thanks much, Kevin...

The ranking info, incorporated within your script, is precisely what I'm talking about. Great! I need ~4 interval periods, so let me begin work. You have shown me the way. I'll report back with my work-in-progress as I proceed; I'm sure it will need some help along the way. You are the Maestro... I am not.

Gene in FL

StockFetcher Forums · Filter Exchange · Ranking -- This week vs. last week<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus