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
corrections vs drawdowns
6 messages · Brian G. Peterson, Alec Schmidt, Enrico Schumann
Alec, I suspect that you may wish to start with setting geometric=FALSE in your call to findDrawdowns. Corrections are usually defined as a peak to trough difference in *price*, as a percentage of the peak price. So I think you do not want to compound the *returns* in calculating your drawdowns. Regards, Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock On Tue, 2019-01-08 at 16:09 +0000, Alec Schmidt wrote: > 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 > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-Finance at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R > questions should go.
Thank you Brian, geometric=FALSE gave me additional corrections in 2011 and 2012 but still no bear market of 2008: 08/30/2018 - 12/24/2018 (-11.04%) [80 Days] 07/21/2015 - 02/11/2016 (-10.05%) [143 Days] 09/17/2012 - 11/15/2012 (-8.42%) [42 Days] 03/27/2012 - 06/01/2012 (-9.44%) [47 Days] 07/08/2011 - 08/19/2011 (-15.96%) [31 Days] 05/02/2011 - 06/17/2011 (-7.59%) [34 Days] 02/22/2011 - 03/16/2011 (-6.54%) [17 Days] 07/18/2000 - 10/09/2002 (-97.34%) [559 Days] Alec
From: Brian G. Peterson <brian at braverock.com>
Sent: Tuesday, January 8, 2019 11:17 AM
To: Alec Schmidt; r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] corrections vs drawdowns
Sent: Tuesday, January 8, 2019 11:17 AM
To: Alec Schmidt; r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] corrections vs drawdowns
Alec, I suspect that you may wish to start with setting geometric=FALSE in your call to findDrawdowns. Corrections are usually defined as a peak to trough difference in *price*, as a percentage of the peak price. So I think you do not want to compound the *returns* in calculating your drawdowns. Regards, Brian -- Brian G. Peterson https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbraverock.com%2Fbrian%2F&data=02%7C01%7Caschmid1%40stevens.edu%7Ce6f064fd98b940503baf08d67584dcf1%7C8d1a69ec03b54345ae21dad112f5fb4f%7C0%7C0%7C636825610866789711&sdata=CEhprRb58LDRQj0OmzZ5qzUDDYwumGGjUl9T4CoUscY%3D&reserved=0 Ph: 773-459-4973 IM: bgpbraverock On Tue, 2019-01-08 at 16:09 +0000, Alec Schmidt wrote: > 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 > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-Finance at r-project.org mailing list > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-finance&data=02%7C01%7Caschmid1%40stevens.edu%7Ce6f064fd98b940503baf08d67584dcf1%7C8d1a69ec03b54345ae21dad112f5fb4f%7C0%7C0%7C636825610866789711&sdata=9c8z0kRyh9uaYahELBtBfeg9np8ppq0HYswDUg3myig%3D&reserved=0 > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R > questions should go.
I think that this is correct. NASDAQ was still in a drawdown. NASDAQ didn't make new all-time highs until 2014. Some people define 'corrections' as drawdown from most recent peak. Charles Schwab's definition is in-line with generally accepted usage: https://www.schwab.com/resource-center/insights/content/market-correcti on-what-does-it-mean The Motley Fool uses a similar but not identical definition: https://www.schwab.com/resource-center/insights/content/market-correcti on-what-does-it-mean quantmod has a 'findPeaks' function, but this is dependent on you setting a threshold for what defines a peak. A related Stack Overflow question may provide something in the direction of what you're looking for to look at drawdown from a recent peak. https://stackoverflow.com/questions/14737899/calculate-cumulatve-growth -drawdown-from-local-min-max I would certainly be happy to include a 'findCorrections' function in a later version of PerformanceAnalytics if we could parameterize what constitutes a 'recent high' for that purpose. Regards, Brian
On Tue, 2019-01-08 at 16:36 +0000, Alec Schmidt wrote:
Thank you Brian, geometric=FALSE gave me additional corrections in 2011 and 2012 but still no bear market of 2008: 08/30/2018 - 12/24/2018 (-11.04%) [80 Days] 07/21/2015 - 02/11/2016 (-10.05%) [143 Days] 09/17/2012 - 11/15/2012 (-8.42%) [42 Days] 03/27/2012 - 06/01/2012 (-9.44%) [47 Days] 07/08/2011 - 08/19/2011 (-15.96%) [31 Days] 05/02/2011 - 06/17/2011 (-7.59%) [34 Days] 02/22/2011 - 03/16/2011 (-6.54%) [17 Days] 07/18/2000 - 10/09/2002 (-97.34%) [559 Days] Alec From: Brian G. Peterson <brian at braverock.com> Sent: Tuesday, January 8, 2019 11:17 AM To: Alec Schmidt; r-sig-finance at r-project.org Subject: Re: [R-SIG-Finance] corrections vs drawdowns Alec, I suspect that you may wish to start with setting geometric=FALSE in your call to findDrawdowns. Corrections are usually defined as a peak to trough difference in *price*, as a percentage of the peak price. So I think you do not want to compound the *returns* in calculating your drawdowns. Regards, Brian On Tue, 2019-01-08 at 16:09 +0000, Alec Schmidt wrote:
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
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
Brian, Thanks again. It would be great if you implement findCorrections(). I think it becomes a popular topic... ? On top of my head, the default version needs just one parameter, ie. if we're looking for corrections of 10%, let's check them after every peak of 10%+ since the last correction's trough. But of course there may be a more generic setup. Alec
From: Brian G. Peterson <brian at braverock.com>
Sent: Tuesday, January 8, 2019 11:55 AM
To: Alec Schmidt; r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] corrections vs drawdowns
Sent: Tuesday, January 8, 2019 11:55 AM
To: Alec Schmidt; r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] corrections vs drawdowns
I think that this is correct. NASDAQ was still in a drawdown. NASDAQ didn't make new all-time highs until 2014. Some people define 'corrections' as drawdown from most recent peak. Charles Schwab's definition is in-line with generally accepted usage: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.schwab.com%2Fresource-center%2Finsights%2Fcontent%2Fmarket-correcti&data=02%7C01%7Caschmid1%40stevens.edu%7C104e1f582d6242bfce0208d6758a227a%7C8d1a69ec03b54345ae21dad112f5fb4f%7C0%7C0%7C636825633496698033&sdata=rkHsOOY4EdLB9LUu4bomU4%2F98T3kHidzSJY%2BGEQ4NsI%3D&reserved=0 on-what-does-it-mean The Motley Fool uses a similar but not identical definition: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.schwab.com%2Fresource-center%2Finsights%2Fcontent%2Fmarket-correcti&data=02%7C01%7Caschmid1%40stevens.edu%7C104e1f582d6242bfce0208d6758a227a%7C8d1a69ec03b54345ae21dad112f5fb4f%7C0%7C0%7C636825633496698033&sdata=rkHsOOY4EdLB9LUu4bomU4%2F98T3kHidzSJY%2BGEQ4NsI%3D&reserved=0 on-what-does-it-mean quantmod has a 'findPeaks' function, but this is dependent on you setting a threshold for what defines a peak. A related Stack Overflow question may provide something in the direction of what you're looking for to look at drawdown from a recent peak. https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F14737899%2Fcalculate-cumulatve-growth&data=02%7C01%7Caschmid1%40stevens.edu%7C104e1f582d6242bfce0208d6758a227a%7C8d1a69ec03b54345ae21dad112f5fb4f%7C0%7C0%7C636825633496708038&sdata=R9gkq2ILuqhdJQpjyijXw%2Flmogrxto8WP%2BvV05K6lgo%3D&reserved=0 -drawdown-from-local-min-max I would certainly be happy to include a 'findCorrections' function in a later version of PerformanceAnalytics if we could parameterize what constitutes a 'recent high' for that purpose. Regards, Brian On Tue, 2019-01-08 at 16:36 +0000, Alec Schmidt wrote: > Thank you Brian, > geometric=FALSE gave me additional corrections in 2011 and 2012 but > still no bear market of 2008: > > > 08/30/2018 - 12/24/2018 (-11.04%) [80 Days] > 07/21/2015 - 02/11/2016 (-10.05%) [143 Days] > 09/17/2012 - 11/15/2012 (-8.42%) [42 Days] > 03/27/2012 - 06/01/2012 (-9.44%) [47 Days] > 07/08/2011 - 08/19/2011 (-15.96%) [31 Days] > 05/02/2011 - 06/17/2011 (-7.59%) [34 Days] > 02/22/2011 - 03/16/2011 (-6.54%) [17 Days] > 07/18/2000 - 10/09/2002 (-97.34%) [559 Days] > Alec > > > > From: Brian G. Peterson <brian at braverock.com> > Sent: Tuesday, January 8, 2019 11:17 AM > To: Alec Schmidt; r-sig-finance at r-project.org > Subject: Re: [R-SIG-Finance] corrections vs drawdowns > > Alec, > > I suspect that you may wish to start with setting geometric=FALSE in > your call to findDrawdowns. > > Corrections are usually defined as a peak to trough difference in > *price*, as a percentage of the peak price. > > So I think you do not want to compound the *returns* in calculating > your drawdowns. > > Regards, > > Brian > > > On Tue, 2019-01-08 at 16:09 +0000, Alec Schmidt wrote: > > 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