You don't get minus results with CMO because it's got absolute value (abs) in the formula to prevent it.
100*(abs((sum(fml("Vid1"),pers2)-sum(fml("Vid2"),pers2))/ (sum(fml("Vid1"),pers2)+sum(fml("Vid2"),pers2))))
It can be built like this:
Vid1: if c>ref(c,-1), c - ref(c,-1),0) Vid 2: abs(if (c<ref(c,-1), c - ref(c,-1),0))
CMO:
100*(abs((sum(fml("Vid1"),pers2)-sum(fml("Vid2"),pers2))/ (sum(fml("Vid1"),pers2)+sum(fml("Vid2"),pers2))))
The article in TASC gives the band formulas in Excel as:
K9 * 1.01, where K9 is E9, the close the day before. That's what it says, and it's unclear. Looking at the graph, though, K9 really is Vidya. You're right, so you could express the bands like this:
Vidya upper band: fml("vidya")*var
where var is represents the vertical shift, and the default is 1.01
Vidya lower band: fml("vidya")*var
where the default is .99
Vidya is:
((2/(pers+1))*(abs((sum(fml("Vid1"),pers2)-sum(fml("Vid2"),pers2))/ (sum(fml("Vid1"),pers2)+sum(fml("Vid2"),pers2))) )*c)+((1-( (2/(pers+1))*(abs((sum(fml("Vid1"),pers2)-sum(fml("Vid2"),pers2))/ (sum(fml("Vid1"),pers2)+sum(fml("Vid2"),pers2))) )))*ref(c,-1))
where pers is Period for Vidya smoothing constant, with default of 9 and pers2 is periods for CMO, where default is 12
I followed each step detailed in the Excel formulation given in the October 1995 issue of TASC.
The first step is Vid1: if c>ref(c,-1), c - ref(c,-1),0)
The second step is Vid2: abs(if (c<ref(c,-1), c - ref(c,-1),0))
It continues like this:
Vid3: sum(fml("Vid1"),9) Vid4: sum(fml("Vid2"),9) Vid5: abs((fml("vid3")-fml("vid4"))/(fml("vid3")+fml("vid4")))
Vidya (.1538*fml("vid5")*c)+((1-(.1538*fml("vid5")))*ref(c,-1))
.1538 represents 2/(K4+1), where K4 was given as 12
The longer Vidya formula is the same thing, but I plugged all the long formulas in and introduced variable periods.
I followed the Excel formulation point by point, using WOW's "if" formula to reference back when necessary. You can see it referencing back upon itself here:
Vid1: if (c>ref(c,-1), c - ref(c,-1),0) Vid 2: abs(if (c<ref(c,-1), c - ref(c,-1),0)) Vid3: sum(fml("Vid1"),9) Vid4: sum(fml("Vid2"),9)
I'm sure you're talking about something else, though, when you mention self-referencing, but I found nothing in the Excel formulas that could not be duplicated in the WOW formulas.
In the longer Vidya formula. Vid3 and Vid4 are spelled out and given variable periods, but they're still the same; they're referencing back to Vid1 and Vid2.
The method used to translate it to WOW was almost identical to the method used for TDREI, and the TDREI formula generated a chart identical to the one in TASC. I've probably made mistakes with my first effort with Vidya, as I made errors when I first posted TDREI, but I did follow the Excel formulas, and didn't run into anything that WOW couldn't translate.
I do respect your view that it can't be done in WOW, and I'm going to go over and over the formula to find out if there are any discrepancies.
I confess that anyone who looks very closely is going to find one discrepancy. The Excel formulas 1 and 2 (what they call F3 and G3) refer to the price 7 days ago in a 9-day period, and the day before that, 8 days ago (which would be the ninth day in a 9-day period including the current day). I tested it using c and ref(c,-1), instead of ref(c,-7) and ref(c,-8), under the theory that we were still talking about prices in a 9 day moving average, one day and the day before. I did this cautiously, expecting a discrepancy in the plot, but the difference was infintesimal. Still, Vid1 and Vid2 (F3 and G3) could be more accurately expressed like this:
Vid1: if (ref(c,-7)>ref(c,-8), ref(c,-7) - ref(c,-8),0) Vid 2: abs(if (ref(c,-7)<ref(c,-8), ref(c,-7) - ref(c,-8),0))
Instead of this:
Vid1: if (c>ref(c,-1), c - ref(c,-1),0) Vid 2: abs(if (c<ref(c,-1), c - ref(c,-1),0))
But I changed it because it was difficult to make the moving averages variable, since 7 and 8 apply to 9-day periods, and they'd have to be changed with each moving average. But as I said, the change in the plots was infintesimal when I changed it to c>ref(c,-1)
Perahps this is where the difficulty lies, where it cannot be translated. But as I said, Ii found next to no difference in the plots. And if you wanted to be exact, you could write in the exact values for each moving average and have separate indicators for each one in WOW, one for 9, one for 21, etc.
I'll say this at the end of this long note: I usually make mistakes, and I expect there are enormous ones in my Vidya formula that I'm not aware of. Your note certainly gives me pause. Right now, though, I can't see what the error is. Tomorrow, it'll probably be a different story. I hope all of us can work out a workable formula. If not, c'est la vidya.
Brooke |