{"id":149,"date":"2012-06-04T14:38:55","date_gmt":"2012-06-04T14:38:55","guid":{"rendered":"https:\/\/www.wdiam.com\/?p=149"},"modified":"2020-08-06T20:27:34","modified_gmt":"2020-08-06T20:27:34","slug":"you-are-horrible-at-market-timing","status":"publish","type":"post","link":"https:\/\/www.wdiam.com\/b\/2012\/06\/04\/you-are-horrible-at-market-timing\/","title":{"rendered":"You are Horrible at Market Timing"},"content":{"rendered":"<p>You are horrible at market timing. Don&#8217;t even attempt it. I probably can&#8217;t convince you how horrible you are, but hopefully some empirical data analysis will show how you and the majority of people are no good at market timing.<\/p>\n<p>Recently a friend came to me lamenting about a recent stock purchase he made, lamenting how the stock has gone down since he&#8217;s bought it and how he should have waited to buy it for even cheaper. From this, I was reminded by an anecdote from a professor from my econometrics class. I was taking the class in late 2008, which if you don&#8217;t remember, was right in the midst of the major financial collapse, with all the major indices taking a huge <a href=\"http:\/\/www.google.com\/finance?chdnp=1&amp;chdd=1&amp;chds=1&amp;chdv=1&amp;chvs=maximized&amp;chdeh=0&amp;chfdeh=0&amp;chdet=1272052800000&amp;chddm=221403&amp;chls=IntervalBasedLine&amp;cmpto=NASDAQ:QQQ;NYSEARCA:DIA&amp;cmptdms=0;0&amp;q=NYSEARCA:SPY&amp;ntsp=0\">nose dive<\/a>.<\/p>\n<p>Students being students, somebody asked the professor what he thought about the collapse and what he was doing himself in his own personal account. Keep in mind the tone was what a &#8220;normal&#8221; person does instead what a 1000-person hedge fund does. He referred to a past study that showed that most recoveries in the equities space didn&#8217;t come from steady returns but instead were concentrated on a few, infrequently-spaced days. That is, there was no way for you to catch the recoveries unless you were already invested the day before. And, if you were sitting on cash before, saw the move happen, and attempted to then get into the markets, it would have been too late for you.<\/p>\n<p>I decided to (very) roughly replicate this purported study for my friend.<\/p>\n<p>I first went to google to <a href=\"http:\/\/www.google.com\/finance\/historical?q=NYSEARCA:SPY\">download daily prices<\/a> for SPY. They provided a nice facility for you to export the data to a csv format.<\/p>\n<p>The data is relatively straightforward.<\/p>\n<pre>Date,Open,High,Low,Close,Volume\n29-May-12,133.16,133.92,132.75,133.70,32727593\n25-May-12,132.48,132.85,131.78,132.10,28450945\n24-May-12,132.67,132.84,131.42,132.53,31309748\n...\n<\/pre>\n<p>I wrote some R code to read in this data and to trim out days that didn&#8217;t have an open, which left me with observation starting in 2000\/01\/03 and ~3100 data points. Additionally, I created log returns for that day&#8217;s open to close, i.e., <span class=\"katex-eq\" data-katex-display=\"false\">log(p_{close}) - log(p_{open})<\/span>.<\/p>\n<pre lang=\"\u201drsplus\u201d\"># Get the data\nxx &lt;- read.table(file=\"~\/tmp\/spy.data.csv\", header=T, sep=\",\", as.is=T)\nnames(xx) &lt;- c(\"date\", \"open\", \"high\", \"low\", \"close\", \"vlm\")\n\n# Get date in ymd format\nxx$ymd &lt;- as.numeric(strftime(as.Date(xx$date, \"%d-%b-%y\"), \"%Y%m%d\"))\nxx &lt;- xx[, names(xx)[-1]]\nxx &lt;- xx[,c(ncol(xx), 1:(ncol(xx)-1))]\n\n# We want to work with complete data\nxx &lt;- xx[xx$open != 0,]\n\n# I prefer low dates first than high dates\nxx &lt;- xx[order(xx$ymd),]\nrownames(xx) &lt;- 1:nrow(xx)\n\n# Getting open to close\nxx$o2c &lt;- log(xx$close) - log(xx$open)\nxx &lt;- xx[!is.infinite(xx$o2c),]\n<\/pre>\n<p>Getting the top 10 return days is relatively straightforward. Note that finger-in-the-wind, a lot of the top 10 return days came from end of 2008, for which presumably a lot of people decided to put their money into cash out of fear.<\/p>\n<pre lang=\"\u201drsplus\u201d\">&gt; head(xx[order(-xx$o2c),], n=10)\n          ymd   open   high    low  close       vlm        o2c\n635  20020724  78.14  85.12  77.68  84.72    671400 0.08084961\n2202 20081013  93.87 101.35  89.95 101.35   2821800 0.07666903\n2213 20081028  87.34  94.24  84.53  93.76  81089900 0.07092978\n2225 20081113  86.13  91.73  82.09  91.17 753800996 0.05686811\n2234 20081126  84.30  89.19  84.24  88.97 370320441 0.05391737\n2019 20080123 127.09 134.19 126.84 133.86  53861000 0.05189898\n248  20010103 128.31 136.00 127.66 135.00  17523900 0.05082557\n2241 20081205  83.65  88.42  82.24  87.93 471947872 0.04989962\n2239 20081203  83.40  87.83  83.14  87.32 520103726 0.04593122\n2315 20090323  78.74  82.29  78.31  82.22 420247245 0.04324730\n<\/pre>\n<p>Emphasizing this point more, if you didn&#8217;t have your cash in equities at the beginning of the day, you would have missed out on the recovery. An additional point we can do is to see what the returns were on the prior day. In other words, is there some in-your-face behavior the prior day that would lead you to believe that huge returns would have come the next day?<\/p>\n<pre lang=\"\u201drsplus\u201d\">&gt; max.ndx &lt;- head(order(-xx$o2c), n=10)\n&gt; max.ndx &lt;- as.vector(t(cbind(max.ndx, max.ndx-1)))\n&gt; xx[max.ndx,]\n          ymd   open   high    low  close       vlm          o2c\n635  20020724  78.14  85.12  77.68  84.72    671400  0.080849612\n634  20020723  82.55  83.24  78.85  79.95  65806500 -0.032002731\n2202 20081013  93.87 101.35  89.95 101.35   2821800  0.076669027\n2201 20081010  86.76  93.94  83.58  88.50  90590400  0.019856866\n2213 20081028  87.34  94.24  84.53  93.76  81089900  0.070929778\n2212 20081027  85.97  89.51  83.70  83.95  62953200 -0.023777015\n2225 20081113  86.13  91.73  82.09  91.17 753800996  0.056868113\n2224 20081112  88.23  90.15  85.12  85.82 454330554 -0.027694962\n2234 20081126  84.30  89.19  84.24  88.97 370320441  0.053917369\n2233 20081125  87.30  87.51  83.82  85.66 454188290 -0.018964491\n2019 20080123 127.09 134.19 126.84 133.86  53861000  0.051898981\n2018 20080122 127.21 132.43 126.00 130.72  75350600  0.027218367\n248  20010103 128.31 136.00 127.66 135.00  17523900  0.050825568\n247  20010102 132.00 132.16 127.56 128.81   8732200 -0.024463472\n2241 20081205  83.65  88.42  82.24  87.93 471947872  0.049899616\n2240 20081204  86.06  88.05  83.74  85.30 444341542 -0.008870273\n2239 20081203  83.40  87.83  83.14  87.32 520103726  0.045931222\n2238 20081202  83.47  85.49  82.04  85.27 469785220  0.021335407\n2315 20090323  78.74  82.29  78.31  82.22 420247245  0.043247296\n2314 20090320  78.76  78.91  76.53  76.71 371165651 -0.026373176\n<\/pre>\n<p>Looking at the data, we can see that there were both positive and negative returns the day before. However, there weren&#8217;t any moments of &#8220;large return today, I better get in.&#8221; My perception of this is that, from the perspective of a normal investor saving for retirement, they should just leave their money in and are already hopefully using some variant of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Dollar_cost_averaging\">dollar cost averaging<\/a>.<\/p>\n<p>For what it&#8217;s worth, my professor said he hardly touched his own personal investments, presumably just putting his 401k money in a few indices and forgetting about it. His time was better spent on writing academic papers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You are horrible at market timing. Don&#8217;t even attempt it. I probably can&#8217;t convince you how horrible you are, but hopefully some empirical data analysis will show how you and the majority of people are no good at market timing. Recently a friend came to me lamenting about a recent stock purchase he made, lamenting &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.wdiam.com\/b\/2012\/06\/04\/you-are-horrible-at-market-timing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;You are Horrible at Market Timing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[20,25,35],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-investing","tag-investing-2","tag-market-timing","tag-r"],"_links":{"self":[{"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":2,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":604,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/posts\/149\/revisions\/604"}],"wp:attachment":[{"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wdiam.com\/b\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}