[R-SIG-Finance] corrections vs drawdowns
Enrico Schumann
e@ @ending from enrico@chum@nn@net
Tue Jan 8 21:00:25 CET 2019
On Tue, 08 Jan 2019, Alec Schmidt writes:
> I tried to use the function findDrawdowns() to compile NASDAQ (^IXIC)
> corrections. For the sample starting on
>
> 2007-01-01, I get the following start -to-trough periods with
> drawdowns higher than 10%
>
> 08/30/2018 - 12/24/2018 (-23.64%) [80 Days]
> 07/21/2015 - 02/11/2016 (-18.24%) [143 Days]
> 09/17/2012 - 11/15/2012 (-10.90%) [42 Days]
> 03/27/2012 - 06/01/2012 (-12.01%) [47 Days]
> 05/02/2011 - 10/03/2011 (-18.71%) [108 Days]
> 11/01/2007 - 03/09/2009 (-55.63%) [339 Days]
>
>
> However, if the sample starts on 2000-06-01, I get
> 08/30/2018 - 12/24/2018 (-23.64%) [80 Days]
> 07/21/2015 - 02/11/2016 (-18.24%) [143 Days]
> 07/18/2000 - 10/09/2002 (-73.94%) [559 Days]
>
> i.e. no bear market of 2008...
>
> This is because ^IXIC didn't recover in 2007 from its
> fall from top in 2000. This implies that various
> reports on market corrections do not use the max
> drawdown. Is there consensus (and possibly R scripts)
> that address this problem?
>
> Thanks! Alec
>
Perhaps the function 'streaks' in package
'PMwR' does what you want.
library("tseries")
library("PMwR")
z <- get.hist.quote("^IXIC", quote = "Close", retclass = "zoo",
start = as.Date("2007-1-1"))
streaks(z)
## start end state return
## 1 2007-01-03 2007-03-05 <NA> -0.03403819
## 2 2007-03-05 2007-10-31 up 0.22149128
## 3 2007-10-31 2008-11-20 down -0.53967656
## 4 2008-11-20 2009-01-06 up 0.25549343
## 5 2009-01-06 2009-03-09 down -0.23223471
## 6 2009-03-09 2018-08-29 up 5.39242799
## 7 2018-08-29 2019-01-04 down -0.16903607
See also
https://stats.stackexchange.com/questions/354157/determining-up-down-market-trends-in-timeseries-data/373622#373622
https://cran.r-project.org/web/packages/PMwR/vignettes/Drawdowns_streaks.pdf
--
Enrico Schumann (maintainer of PMwR)
Lucerne, Switzerland
http://enricoschumann.net
More information about the R-SIG-Finance
mailing list