Interesting technique. Thanks.
I am curious, though, about why you chagned the formula from (P(t) - P(t-1))/P(t-1) to
(P(t+1) - P(t))/P(t). I realize it amounts to the same thing in most cases but I did find it a bit disconcerting when reading the code.