Prospecting through layers of rock – or scouring through time-series data from the Karachi Stock Exchange – may seem like a taxing task; but if you’re lucky, you can strike gold.
Data mining involves sifting through tomes of raw data; looking for patterns that seem to hold over time in order to exploit them in the future. Mathematics forms the core of the exercise.
German mathematician Leopold Kronecker once said that “God made the integers; all else is the work of man.” With statistical confidence, I can tell you that imprints of the ‘work of man’ are all over Oil and Gas Development Authority, and Karachi Stock Exchange (KSE) time-series data; which I will share with you in this article.
Over the last eighteen years, data trends show that Tuesdays have been the days of highest returns in the KSE, compared to any other day. Fridays, on the other hand, are the only day with an average negative return. In decreasing order, the best days to trade are Tuesday, Wednesday, Monday and Thursday, with Friday rounding off the list.
These findings are not standalone, though, and volatility plays a significant factor. But again, the volatility numbers tie in beautifully with these results; showing that Friday is the most volatile, while Wednesday is the least. The overall best reward-to-risk ratio still goes to Tuesday.
What do these findings mean? If you had worked only on Tuesdays, Wednesdays and Mondays during the last eighteen years; buying in the morning and selling in the evening; you could’ve made twice as much as what the index made, or eighteen times your original investment.
If you live in the western part of the world, you must have heard the Wall Street adage “sell in May and go away”. Just dump your entire portfolio in May and head for the beach. Return to the market in October and play long again. But what does data from Pakistan say about the best months for trading?
Surprisingly, from the data, May remains the worst month to invest in. However, I should add that you shouldn’t ‘go away’ after you ‘sell in May’, because June and July aren’t bad months to invest in. In decreasing order, the best months to invest in, on a risk-adjusted basis, are February, January, September, July, June, November, April, December, March and October; August and May being the worst with a higher probability of a downside. January and May are the most volatile.
Interestingly, the numbers behind the numbers that we see on our trading screens speak volumes about what people are thinking. Volatility, for instance, is a number derived from daily changes in prices that indicates the rate of change of the stock market. While the number is rising these days, it has risen fast enough in the last week to merit a slow down. Coupled with this, the market is currently below its moving average, which means that it needs to rise at a slow rate in order to bring volatility down; because market prices tend to revert to a mean.
Another such number is the measure of correlation; or how a certain number moves with the other. Hubco is negatively correlated to quite a few actively punted stocks in the market – but every time a stock market crash approaches, this magically switches to a positive correlation with the market. Hence, a positive correlation in Hubco and the market in distressed times can be seen as a signal for selling and going away.
Data mining shows that unidirectional moves like continuous rises or falls tend to cancel each other out, are highly quantifiable, and follow a pattern. For instance, our market has fallen continuously for five days only two per cent of the time. One can thereby conclude that the market shouldn’t fall more with 98% probability, after a continuous five-day fall. This lets us gauge entry and exit points fairly accurately, and I can confidently state that every day, one can probabilistically guesstimate whether the market will be favourable the next day or not.
Pythagoras headed a cult of number worshippers who believed God was a mathematician. “All is number,” they would chant. While my data mining isn’t intended to create such a following, I feel there’s a plethora of trends that can be used to make a quick profit. And I haven’t even talked about the really interesting math yet. Most of it, I’m keeping to myself.
THE WRITER IS A FINANCIAL RISK MANAGER AND VICE PRESIDENT AT ARIF HABIB INVESTMENTS
Published in The Express Tribune, April 30th, 2012.