DV(2)
Author: zorgnak
Creation Date: 7/18/2009 10:54 AM
profile picture

zorgnak

#1
Market Sci Blog (http://marketsci.wordpress.com/) posted a new indicator that seems interesting.
"The simple unbounded version (a) for each trading day calculate: [(close / average of the high and low price) – 1]. And then (b) take the average of today and yesterday’s result."

"The bounded version oscillates between 0 and 100 like RSI. To calculate the bounded version we take today’s unbounded value and compare it to the last year (252 trading days). The highest value over the last year receives a value of 100, the lowest 0, and everything else its percentage rank in between (in other words, we’re using the PERCENTRANK function in Excel)."

Anyone care to take a shot at it?


profile picture

Cone

#2
I can do the unbounded part while feeding the baby...
CODE:
Please log in to see this code.


The bounded part will have to wait until I or someone else has time to write a PERCENTRANK function for our Community.Components. Here's "a" PercentRank code I wrote for 4x - it's probably at least a good guide if nothing else.

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

zorgnak

#3
Give the baby a kiss for me.
zorg
profile picture

Eugene

#4
The unbounded DVI2 added to Community.Indicators. Thank you Robert.
profile picture

DartboardTrader

#5
This is my version of the PercentRank function.. Take the highest and lowest of the given period. Return today's value of 'd' as a percent of the range between d's highest and lowest.

CODE:
Please log in to see this code.


If you make a strategy with an exponential equity curve using this indicator, beware the siren's call, especially in this Prozac+Viagra driven "bull market"! No offense to anyone needing either in the current market conditions.

Feel free to add DV2 and DV2Bounded to Community.Indicators; and PercentRank to Community.Components.

My DV2 result is identical to Cone's, but mine is a one-liner.

--Mike
profile picture

Eugene

#6
Thanks for your contribution Mike, it will be included in the next update.
profile picture

zorgnak

#7
David Varadi is doing some interesting work with the DV2 concept.

http://cssanalytics.wordpress.com/
profile picture

jupiter

#8
According to this site: http://marketsci.wordpress.com/2009/07/15/varadi’s-rsi2-alternative-the-dv2

the bounded DV(2) oscillates between 0 and 100 just like the RSI.

However, the version shown by DartboardTrader doesn't, and neither does the "DV2_Bounded" version in "Community Indicators". Not only that, DartboardTrader's version differs from the one in Community Indicators. Neither oscillates between 0 and 100 limits. Any clarification is much appreciated.

Tom



profile picture

Eugene

#9
QUOTE:
Not only that, DartboardTrader's version differs from the one in Community Indicators.

Mike's version is "the one in Community Indicators" :) Double check that both the periods and data loading settings match. It requires no less than 252 bars, and may be more to stabilize (?)
profile picture

jupiter

#10
Sorry, my bad! I should have applied the DV2_Bounded against the DV(2) indicator itself, instead of the default "Close" series.

Still, it doesn't oscillate between 0 and 100. I noticed the DV2 oscillates between negative and positive values, and the DV2_bounded is just a scaled-up replica of the DV2, instead of acting like the RSI, with 0 and 100 limits.

Could it be that the largest negative value of the DV2 within the last 252 bars should be assigned as 0, and the highest positive value of the DV2 (within the same range) should be assigned as 100, and then everything in between is ranked proportionally with respect to those 2 references? However, only positive values should be compared to 100 level, and negatives values to 0 level. That way, a DV2's value of 0 will correspond to the 50 level, as in the RSI?
profile picture

topcat77

#11
Jupiter, did you find an answer to this?
profile picture

DartboardTrader

#12
Try this instead. The PercentRank above is more suitably called "PercentRange", because you get the percentage of the highest-lowest range versus today's price.

The revised Percent Rank below bases the range from the lowest in the series, effectively giving you the rank of where today fits in the range of the period's highest and lowest values. The difference is pretty dramatic, and you get values in the 0.0-1.0 range you are expecting.

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

Eugene

#13
Thanks Michael, this function's output seems like what the doctor ordered. Community.Indicators updated.
profile picture

topcat77

#14
Dartboard
this is most useful, thanks for taking the time to provide a fix
Dinsa
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).