to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i
With the S&P 500 (Index: SPX) having ended its latest prolonged winning streak of 7 days earlier this week, we wondered how frequently such long streaks for the index happen.
We're defining a long streak as lasting six or more trading days. Since 3 January 1950, the index has experienced 321 long streaks. 208 of those have been winning streaks and 113 have been losing streaks. The longest winning streak of 14 days began on 26 March 1971. The longest losing streak began on 22 April 1966 and lasted 12 trading days.
We've generated the following barcode chart to visualize each of the S&P 500's long streaks since 3 January 1950:
In the chart, we're using the horizontal axis as a timeline, with the vertical bars marking the date each long streak began. The duration of the streak is shown by the length of the bars - these are shown as positive values if they were winning streaks and negative values if they were losing streaks. Periods where streaks occurred more frequently appear as thicker bars, while periods where long streaks were sparse appear as empty or blank space.
Overall, the combination of the relative frequency of the long streaks and the scale of the chart produces a visualization that looks a bit like a UPC barcode.
The visualization does reveal a number of interesting patterns.
Here is some data to quantify these observations.
From 3 January 1950 through 31 December 1980, there were 120 winning streaks and 72 losing streaks, a W/L ratio 1.7-to-1. From 2 January 1981 through 2 July 2021, when the S&P 500's most recent long streak began, there have been 88 winning streaks and 41 losing streaks, a 2.1-to-1 W/L ratio.
Splitting this latter period roughly in half, from 2 January 1981 through 31 December 1999, there were 44 winning streaks and 26 losing streaks, a 1.7-to-1 W/L ratio, similar to what was seen from 1950 through 1980. Since 3 January 2000 however, there have been 44 winning streaks and 15 losing streaks, nearly a 3-to-1 W/L ratio.
What changed in the last 20 years to produce that outcome? Is it a statistical anomaly where we'll eventually have a period characterized by clusters of long losing streaks as the trend reverts to the mean? Or has something else changed to stop losing streaks in the S&P 500 from becoming long losing streaks during this period?
We don't know the answers to these questions. As far as we know, we're also the first to report these observations, but if we learn others have noticed and reported it, we'll add that information to the end of this post. For now though, we're very happy to find ourselves back at the cutting edge of discovery!
Yahoo! Finance. S&P 500 Historical Data. [Online Database]. Accessed 7 July 2021.
Labels: data visualization, SP 500
Welcome to the blogosphere's toolchest! Here, unlike other blogs dedicated to analyzing current events, we create easy-to-use, simple tools to do the math related to them so you can get in on the action too! If you would like to learn more about these tools, or if you would like to contribute ideas to develop for this blog, please e-mail us at:
ironman at politicalcalculations
Thanks in advance!
Closing values for previous trading day.
This site is primarily powered by:
The tools on this site are built using JavaScript. If you would like to learn more, one of the best free resources on the web is available at W3Schools.com.