Skip to content
Prev 4701 / 15274 Next

n-period return

This is because xts aligns the series before operations.
(Delta[i]>Delta[i-1]) returns an empty xts object because Delta[i] and
Delta[i-1] don't share any common index values.

Something like this will work:
+  if (Delta[i]>lDelta[i]) sum <- sum + Delta
+ }

Though you're going to have the same problem when you try to add "sum"
and "Delta" if they're both xts objects.

HTH,
Josh
--
http://www.fosstrading.com



On Mon, Aug 3, 2009 at 10:55 AM,
ehxpieterse<eduard.pieterse at macquarie.com> wrote: