[R-SIG-Finance] Expected lengths of streaks
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 =
trades.rle <- rle(trades)
tapply(trades.rle$lengths, trades.rle$values, max)
There must be other, better ways today...
John Bollinger, CFA, CMT
If you advance far enough, you arrive at the beginning.
More information about the R-SIG-Finance