Market Timing -- No, not that kind
IntroductionLooking for patterns. It is human nature, and it is what drives those of us who engage in technical analysis to look for 'better' indicators -- indicators which are more accurate or timely in identifying patterns in the movement of a security that will have an outcome that is more likely positive for our accounts than not.
We do not always succeed in our predictions, and no system is likely to ever "bat 1000" (since baseball season is upon us). We struggle to make sure that our stop losses prevent run-away downside and that our risk return allows us to remain profitable even if our trades are no better than a 50-50 guess.
What follows is an investigation I've thrown together on a slow Friday afternoon. It is not investment advice, and it is not authoritative. It relies on a short window of time in which the market has made nearly unimaginable gains. It may be misconstrued to promote one style of trading over another -- it should not. It is, however, an interesting (to my brain) look at the movements of the market.
Time and Probability
So, when we look for better entries and exits, we look at multiple time frames, multiple indicators, strengths, trends, stochastics, and a host of others trying to decide what the probability of a good outcome for the trade is going to be.
As I was sitting looking at my trade going nowhere fast last Wednesday or Thursday, having watched a trade Sunday go through the roof, I wondered if there was any pattern to discern in what time of day I entered a trade. So I fired up a jupyter notebook (python) and dug into some data provided via yfinance, a drop in replacement for yahoo finance's API.
What follows are the rather surprising findings from that investigation.
Why ES Futures
I trade these, so I chose to examine them. They trade nearly around the clock, from Sunday to Friday. If you're not into trading ES futures, the same analysis might be applicable to other securities, but I haven't really tried. The ES futures do represent a broad swath of the market after all.
Hold Time
Rather than focusing on when to exit (highs, lows, averages, any of that) I decided to look at what would happen if I entered a trade at a given time, and held the position for a set number of minutes. This is easily accomplished in a program and eliminates bias based on the indicator (set of indicators) chosen for trading.
I opted to make calculations for the following hold times:
- 30 minutes (1/2 hour)
- 60 minutes (1 hour)
- 120 minutes (2 hours)
- 180 minutes (3 hours)
- 240 minutes (4 hours)
- 360 minutes (6 hours)
- 720 minutes (12 hours)
- 1440 minutes (24 hours)
I then broke these into short, medium, and long hold times:
Short:
- 30 minutes (1/2 hour)
- 60 minutes (1 hour)
- 120 minutes (2 hours)
Medium:
- 120 minutes (2 hours)
- 180 minutes (3 hours)
- 240 minutes (4 hours)
- 360 minutes (6 hours)
Long:
- 360 minutes (6 hours)
- 720 minutes (12 hours)
- 1440 minutes (24 hours)
Profit / Loss per trade was calculated by finding the close price t minutes later and finding the difference between close prices at the open and close of the trade.
This was done on 5 minute data, and then aggregated by hour of the day, and separately by day of the week. The data are presented as box plots.
Graphs
For time of day graphs, hours are integer values as East Cost (New York) Time.
Returns aggregated by time of day, all hold lengths
Returns aggregated by time of day, short hold lengths
Returns aggregated by time of day, medium hold lengths
Returns aggregated by time of day, long hold lengths
for all day of week graphs, 0 is Monday, 1 is Tuesday... 6 is Sunday.
Returns aggregated by day of week, all hold lengths
Returns aggregated by day of week, short hold lengths
Returns aggregated by day of week, medium hold lengths
Returns aggregated by day of week, long hold lengths
Results of all holds separated by length of hold
Conclusions
There is a lot here to digest. What is most notable is that, from the hourly charts, there is a tremendous decrease in volatility during the trading day, and a matching decrease in average profit. Perhaps the 'sure thing' is not the lucrative thing... that makes some sense.
I think that from this briefest investigation, I will not worry about trades on certain days or at certain times of day and rather focus my efforts on finding entries at times which have higher historical probability for being profitable, if not lucrative. Perhaps I will size my orders and risk accordingly -- along with my expectation of normal market movements.
I have drawn my own conclusions from what is presented here, and offer it to you for your own, and to start a discussion. If you have questions, please ask. I enjoy the dialog about this kind of thing as much as anything.
Post Script
This is all run on 60 days of data at 5 minute intervals. If anyone has access to 24 hour 1 minute data going back a year or more, and wants to share, I'll be happy to run my analysis and post it back here. I'm sure I could tease it out of ToS, but I really don't like programming OAuth protocols for API access.
Happy Trading,
Mashume