Jeff: Thanks for your simpler slope formula (and Sean, thanks for your formula, too). Here's Jeff's:
b := 0; refday := 0; daysback := 200; y := close(refday) - close(refday-daysback); x := refdays-daysback; slope := (y - b) / x;
The difference between this and the MSWIN formula is that yours is getting a slope based on one day (refday), compared with the "daysback" close.
The beauty of the MSWIN formula appears to be that is compares 14-day periods with the entire "daysback" period. There is a subtle difference between the two parts of the numerator, and between the two parts of the denominator. The two parts in the numerator are 1: 14*(sum(cum(1)*c,14) and 2: sum(cum(1),14)*(sum(c,14))). My formula, posted in the previous note, is wrong -- I used close(0)*14 in one part of the numerator formula and a sum of previous closes over 14 days in the other part, but that's not the solution, I don't think. It may be easier to see the difference between the two parts in the denominator: 14*(sum(pwr(cum(1),2),14) and pwr(sum(cum(1),14),2). I haven't figured it out yet, but it seems to be comparing the most recent 14-day period with a sum of all the 14-day periods in the chart. It's doing this in the numerator and denominator. It may be a mystery worth solving, because it's the formula Metastock and Wow seem to be using for slope (Wow's plot is similar to the one created by the MSWIN formula.)
Brooke |