Up/Down and Intensity Day Summation Rank (UDIDSRI Indicator)
Author: 07nioe
Creation Date: 4/25/2015 8:54 AM
profile picture

07nioe

#1
Hi,
I would like to compute an indicator which works as follows:
1) calculate ROC(close,1)
2) If ROC(close,1) >0 write 1 in a new DataSeries
3) If ROC(close,1)<=0 write -1 in the new DataSeries above
4) Sum the movements for the last 20 days
5) Calculate the % rank of today’s sum, compared to the last 50 days of sums.

The original idea you will find here:
http://qusma.com/2012/10/14/the-predictive-value-of-the-number-of-recent-updown-days-udidsri/
Thank you for help.

Best
Niels
profile picture

Eugene

#2
Niels,

Not sure what I'm doing wrong as the end result does not look quite the same as on the website's chart:

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

Carova

#3
Is it possible that he is using log returns?

Vince
profile picture

Eugene

#4
Thanks for your suggestion Vince. Probably I'm doing something wrong with log returns but the output is still very different...

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

07nioe

#5
I think the exact calculation you will find at the bottom of the website. There is a link to an excel sheet in which the calculation can be reconstructed. But I don't know what the adjusted close prices are.

Best
Niels
profile picture

Eugene

#6
Here's version based on the Excel spreadsheet. Still not the same. OK, I leave this up to you.

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

sedelstein

#7
QUOTE:
I think the exact calculation you will find at the bottom of the website. There is a link to an excel sheet in which the calculation can be reconstructed. But I don't know what the adjusted close prices are.


A suggestion:

Adjusted closes are from the Yahoo finance website. It adjusts for splits and dividends. Try inputting these prices into WL and see if that solves the problem
profile picture

Eugene

#8
Thanks for your suggestion. I'm working with adjusted Yahoo! data and it does not solve the discrepancy in the indicator shape.
profile picture

07nioe

#9
My suggestion: power and %Rank periods differ between the code above and the original ones. Thus, put the %Rank period to 50 and choose the Power value between 1 and 5. The author uses the value 5 on his website and 1 in the excel-sheet. In don't know which one is correct.

CODE:
Please log in to see this code.


profile picture

Eugene

#10
Yep, 50-day Percent Rank and a Power of 1 seem to do the trick. I think it's ready for inclusion into Community Indicators. Thanks everyone.