- Joined
- 30 June 2007
- Posts
- 7,200
- Reactions
- 1,226
sinner, I don't know what the variables represent in that DV equation. Can you help? Would like to code it for AB if possible.
sinner, I don't know what the variables represent in that DV equation. Can you help? Would like to code it for AB if possible.
Dude I posted a link with excel spreadsheets on how to calculate it. Surely you can reverse engineer that?
I'll run a simple example for crude DV here, please only use it as an example to understand the equation.
I'm using my own variables here, so please try to stay with me.
Let's say we are interested in 2 day mean reversion, and we want to weight each days values equally amongst the total days. So n=2 and w=0.5 (1/n=1/2=0.5)
UnboundedDV2TodayEOD = (X*w)+(Y*w) where
X=(TodaysClose/((TodaysHigh+TodaysLow)/2)-1)
Y=(YesterdaysClose/((YesterdaysHigh+YesterDaysLow)/2)-1)
BoundedDV2TodayEOD = PercentRank(DV2TodayEOD, 252)
where PercentRank(Z,D) returns the rank of Z across the array of the last D values for Z, as a percentile. (this is an Excel function, so you can hop on MSDN to find good info on it)
That's the basic DV2, which is a 'SPY optimised' version of the general DVOscillator, where n can be any value (e.g. you could have a DV3 or DV72) and w can be independent for each value calculated (e.g. you could have DV3 where todays value weighs 0.5, yesterdays 0.3 and the day before 0.2). So n and w can be adaptive/optimised parameters, or adjusted per security. You can also adapt on entry threshold values such that the indicator switches from 'mean reversion' to 'follow through' based on your adaptation engine. Indicator values for the bounded version are naturally adaptive.
I'll post the marketsci link again
http://marketsci.wordpress.com/2009/07/22/roundup-dv2/
Thanks.
I seem to be getting a syntax error, not sure why. w and ww were initialized. Am I close?
unboundeddv2 = (((C/((H+L)/2)-1))*w + ((Ref(C,-1)/((Ref(H,-1)+Ref(L,-1))/2)-1))*ww;
Hello and welcome to Aussie Stock Forums!
To gain full access you must register. Registration is free and takes only a few seconds to complete.
Already a member? Log in here.