Skip to content

Length of a curve?

3 messages · wlblount, R. Michael Weylandt

#
how would i calculate the length of this plot for a trading day?  i am using
ibrokers data for stocks in 3 min. bars

library(quantmod)
load("~/R/UVXY")          #3 min xts  stock data

reg10 <- rollSFM(Cl(pricedata),seq(nrow(pricedata)),10)
rma10 <- reg10$alpha + reg10$beta*seq(nrow(pricedata))



i am looking for the length of the rma10 plot for one trading day (ie. if it
were a piece of string, the measurement once straightened out) .  i would
like to compare this measurement to the same measurement for previous days
(regular trading hours 9:30am-4:00pm).

sorry for the non-technical language.  Bill






--
View this message in context: http://r.789695.n4.nabble.com/Length-of-a-curve-tp4665208.html
Sent from the Rmetrics mailing list archive at Nabble.com.
#
On Wed, Apr 24, 2013 at 12:26 PM, wlblount <bill at easterngrain.com> wrote:
I'd assume that, for regular data, you'd just add up the absolute
values of the differences between observations.

MW
#
On Wed, Apr 24, 2013 at 4:32 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
Sorry -- that's not quite correct. But the idea's right: to be the
length of a curve, you just want to do

sum(sqrt((dx)^2 + (dy)^2))

If your dx is constant, it's an easy enough calculation but you'll
need to define a 'conversion' from 3 minutes to distance and from
price differences to distance.