[R-SIG-Finance] Expected lengths of streaks
BBands
bbands at gmail.com
Wed May 4 02:05:55 CEST 2011
About 1,000 years ago I calculated the expected length of a losing
streak by iterative simulation using rle
trades <- sample(c("W", "L"), 1000, replace = TRUE, prob =
c("0.66", "0.33"))
trades.rle <- rle(trades)
tapply(trades.rle$lengths, trades.rle$values, max)
There must be other, better ways today...
jab
--
John Bollinger, CFA, CMT
www.BollingerBands.com
If you advance far enough, you arrive at the beginning.
More information about the R-SIG-Finance
mailing list