An 8 bit trading model
This tweet from @StockCats introduces a trading model predicting the percentage likelihood of a gain in S&P 500 index for a single day. The model uses a pattern derived from the daily changes in the index over eight trading sessions and provides the likelihood the index is up the following trading session.
The tweet lists 23 different patterns and the likelihood (expressed as a percentage) the index advances the following day. The model predictions are drawn from the S&P 500 index since 1950.
The pattern is an eight digit (or bit) binary number. A binary number is a string of 0s and 1s. A daily close higher than the previous day is represented with a 1, while a daily close at the same or lower level than the previous day is represented with a 0.
For example, if the S&P 500 closes are:
Tuesday 2079.51
Wednesday 2049.62
Thursday 2091.69
Friday 2077.07
Monday 2063.59
Tuesday 2047.62
Wednesday 2052.23
Thursday 2012.37
Friday 2021.97
the resulting binary number is 01000101. The order left to right is from the earliest to most recent trading session. The number starts with 0 because the first daily transition is from 2079.51 Tuesday to 2049.62 Wednesday. The number ends with 1 because the last Friday trading session rises from the previous close of 2012.37 to 2021.97.
In an 8 bit binary number there are 256 possible combinations of 1s and 0s. So, in this trading model there are 256 possible up or down patterns representing all the daily changes over eight days. I have not found any references to this trading model after searching the internet, so I will refer to it as the 8 bit trading model.
@StockCats asked for a fact check of the data, which I took to mean verifying, for example, the pattern 01101010 actually did precede an up day 76% of the time in the S&P 500 index since 1950.
Yahoo Finance has daily trading data for the S&P 500 back to January 3, 1950. You can go to the Yahoo Finance page for the S&P 500 index, click on ‘Get Prices’, and download the daily open, high, low, close, volume, and adjusted close data to your computer.
After downloading the historical data, I wrote a script to generate the trading pattern for each eight day period since 1950 and to record the up/down change in the index the following trading day. For a non programmer, a speadsheet (such as sheets.google.com) could also be used to make these calculations as well as automatically create future daily patterns.
My goal was to recreate the data in the table. To my surprise, the highest % up day pattern in @StockCats’ tweet matched my findings. The rest of the 10 highest percentage patterns showed some discrepancies between my data and the tweet, but I do not consider the differences sufficient to reject the model.
This does not mean I accept the model. Lots of analysis remains to be done.
Here are the 10 patterns with the highest percent probability of the following day being an up day:
PATTERN % UP Day ================ 01101010 76.47% 01111101 71.08% 10000101 70.21% 00100001 70.00% 10110101 69.57% 10001001 69.12% 10011101 69.12% 00001101 68.63% 00111011 68.13% 00101000 67.74%
The first and third patterns in my table match @StockCats’ data. However, the second pattern in my table is not listed in his table. The second pattern in his table, 01111101, is the 11th highest pattern in my table with the following day up 67.5% compared with 72%.
I consider these minor differences irrelevant. Without a precise understanding of how, and more importantly when, the data in the tweet was collected I cannot determine a cause for the differences. If the tweet data is from 1950 to 2012 or 2013, it is entirely possible the relative positions of the patterns have changed over the past couple of years. My data includes nearly all of 2015.
We want to know if the data can be used as a successful trading model. I’ll proceed with my numbers because I know how they were generated and I can further refine them if necessary for more detailed analysis.
I noted earlier that while the tweet shows 23 patterns, there are 256 possible 8 bit numbers. My scripts found all 256 patterns numerous times over the period since 1950 (there are about 16,500 8 day trading periods since January 3, 1950).
The 23 patterns in the table turn out to be the patterns with the highest and lowest likelihood of a following up day. Many of the 256 patterns fall within the range of 48% to 52% up days, which is no better than random and would not provide a trading advantage. You might as well flip a coin if you wanted to trade on such slim odds.
So I will only look at the patterns with the highest and lowest likelihood of preceding an up day. The model intent appears to be to be long when the pattern predicts a high likelihood of an up day and to be short when the pattern predicts a low likelihood of an up day.
For completeness, here are the 10 patterns with the lowest likelihood of the following day being an up day:
PATTERN % UP Day ================ 11000010 38.46% 00010010 37.78% 00000010 37.21% 11010111 37.14% 11011010 36.84% 00100010 36.51% 10001100 36.36% 00000110 36.23% 00110110 36.21% 11110010 33.33%
As with the highest percentage up days, this data mostly overlaps the data in @StockCats’ tweet.
In the next post I will look deeper into the data to determine how it has changed over time since 1950.











