AgPa #26: Trading on Price Charts

(Re-)Imag(in)ing Price Trends (2022)
Jingwen Jiang, Bryan T. Kelly, Dacheng Xiu
The Journal of Finance, Forthcoming, URL

The interesting thing is that even some of the most highly respected Wall Street firms employ at least a few of these prescientific technical analysts, despite the fact that there’s little evidence they’re doing anything more useful than astrology.

David E. Shaw in Jack D. Schwager’s “Stock Market Wizards”

This quote is from 2003 and unmistakably shows David E. Shaw’s1David E. Shaw is the founder of the very successful hedge fund D. E. Shaw & Co. skepticism about technical analysis. I apologize to everyone who feels offended by that, but to be honest, I also never believed in conventional technical analysis. By “conventional”, I mean drawing a lot of lines on price charts and imagining somewhat arbitrary patterns like head-and-shoulders, double-tops or whatsoever.

Note that this is different from saying that it’s worthless to examine charts at all. Well-researched trading strategies like the momentum factor, short-term reversal, or trend-following are all solely based on historic prices. So when I offend technical analysis, I really mean the non-scientific stuff.


This week’s AGNOSTIC Paper is definitely scientific and introduces a new and fairly innovative approach to technical analysis. The authors borrow methodology from image recognition and train a machine learning model to detect predictive patterns in price charts (Yes, the machine receives the price chart as picture, not the underlying numbers!). The results are very interesting and suggest that there are indeed profitable patterns in charts. But before the conventional chartists get too excited, you won’t find them by reading books on technical analysis…

Everything that follows is only my summary of the original paper. So unless indicated otherwise, all tables and charts belong to the authors of the paper and I am just quoting them. The authors deserve full credit for creating this material, so please always cite the original source.

Setup and Idea

Technical analysis, according to the CFA Institute, “[…] is a form of security analysis that uses price data and volume data, typically displayed graphically in charts. The charts are analyzed using various indicators in order to make investment recommendations.”

For most people, the defining feature of technical analysis is thus that it only considers historic prices and trading volumes to determine investment decisions. The idea is that all information is somehow embedded into prices (so you don’t need to look at something else) and that investors behave systematically such that future prices are somewhat predictable from historic patterns. This is of course an attack on the idea of weak-form market efficiency which says that past prices shouldn’t predict future returns.

By itself, this is not a weakness of technical analysis. As I mentioned in the introduction, well-researched strategies like the momentum factor are also solely price-based and challenge weak-form market efficiency accordingly. The key problem most critics have with technical analysis is that many of its “rules” and patterns are somewhat arbitrary and lack thorough empirical tests. But this isn’t the case for the novel approach from this week’s authors…

Data and Methodology

The heart of the paper is the machine learning model to identify profitable signals from historic price charts. For this purpose, the authors use a convolutional neural network. According to them, this is a state-of-the-art approach within image recognition. I am not an expert in machine learning so I have to trust them with the methodology. The authors are among the most respected researchers in financial machine learning and the paper is forthcoming in the Journal of Finance. So as several times before, we will just free-ride on the peer-review from the scientific community.

The inputs to the model are simple price (daily open, close, high, low) and volume charts over the last 5, 20 or 60 days. The charts also include the respective moving averages. Funny enough, the authors mention that their model actually performs better with visual price charts than with the underlying data. Just like for humans, it is easier for the algorithm to detect patterns from charts than from a spreadsheet of data. I think examples like this show impressively what machine learning can do nowadays. The following figure shows an example for an input-chart.

Figure 2 of Jiang et al. (2022).

The authors train and test their model on US stock returns from CRSP, the standard database for US equities. The sample ranges from 1993 to 2019 and includes all tradable US stocks. The first eight years from 1993 to 2000 serve as training- and validation-data for the model.2Specifically, the authors randomly select 70% of all images during this period for training and the remaining 30% for validation. The remaining 19 years from 2001 to 2019 are the out-of-sample test-data.

The model transforms the information from price charts into probabilities that the return over the next 5, 20, or 60 days after the image will be positive.3So the authors model the return-prediction as classification-problem. The authors estimate nine of these models. For each prediction horizon, they use charts of all lengths as input (5, 20, and 60 days). For example, I5/R20 refers to the model that predicts the probability for a positive return over the next 20 days based on 5-day charts.

Finally, the authors use the predicted probabilities to sort stocks into equal- and value-weighted decile portfolios. The rebalancing frequency is similar to the forecast horizon of the respective model. For example, the I5/R5-High portfolio contains the stocks with the highest probability for a 5-day positive return and gets rebalanced every 5 days.

Important Results and Takeaways

The model identifies very profitable short-term signals

The following tables show various performance statistics of the decile-portfolios. The authors also compare the machine learning signals to “traditional” price-based return predictors.4Momentum (MOM), 1-month short-term reversal (STR), 1-week short-term reversal (WSTR), and a combination different price trends (TREND). As the first table shows, the model identifies extremely profitable signals over short-term horizons that are way beyond the traditional strategies.

Table 1 of Jiang et al. (2022).

For all specifications of the short term predictions (I5/R5, I20/R5, I60/R5), the hypothetical trading strategy earns substantial risk-adjusted returns. Equal-weighted portfolios that are long (short) the stocks with the highest (lowest) probability for positive 5-day returns earn Sharpe ratios between 4.89 and 7.15. These numbers are of course insanely high but ignore trading costs. Since the portfolios rebalance every 5 days, the turnover is with 619% to 690% per year also very high. Net returns after trading costs are therefore probably much lower. In addition to that, the capacity of such short-term strategies is certainly also limited. Nonetheless, it’s a long way from a Sharpe ratio of 7 to “non-profitable” and there is certainly some money to be made from these strategies.

Value-weighted portfolios generate considerably smaller Share ratios between 1.44 to 1.79. These are still outstanding numbers, but they also indicate that a lot of the strong performance comes from smaller companies. Finally, it is worth mentioning that the machine-learning-chart signals outperform all of the traditional signals. So the model seems to identify patterns that researchers haven’t found before.

The signals are also profitable over longer horizons

Table 2 of Jiang et al. (2022).

To address the extremely high turnover and limited capacity, the authors present the same performance statistics for equal-weighted portfolios that only rebalance every 20 or 60 days (IX/R20 and IX/R60, respectively). Sharpe ratios and returns decrease with slower rebalancing but remain strong and some are still better than for the traditional strategies. The authors also mention that most of the longer-term performance comes from the High-portfolios which makes implementation again easier.5Generally speaking, shorting is more difficult and more costly than buying. Therefore, long-only strategies are easier to implement. Overall, the results suggest that the signals not only “work” over the very short-term but also over the more practical monthly and quarterly horizons.


The bottom line of the results so far: charts of historical prices, volumes, and moving averages seem to actually contain valuable information about future returns. While the capabilities of the machine learning model are truly impressive, this general result is not new and other price-based strategies like momentum exist for years. On the other hand, the machine learning model definitely adds value compared to those traditional approaches. The results also survive various robustness tests. For example, the authors find similar performance patterns when restricting the universe to liquid large caps. They also validate their model in an out-of-sample test with data on international stock markets.

Some of the machine-learning-signals are explainable

An open question, of course, is what the machine learning model actually learns? What kind of patterns does it detect? Are there specific rules which are understandable for human investors? Unfortunately, this question is not so easy to answer because convolutional neural networks are fairly hard to interpret. So the authors work backwards and try to find patterns in the characteristics of stocks for which the model predicts a high probability for positive returns. This section of the paper is quite funny to read because the authors try to make sense about what they did in the first part.

The short-term models (IX/R5) tend to capitalize on a weekly short-term reversal pattern which is also well-established in the “traditional” finance literature. Over longer horizons (20 or 60 days), the forecasts of the model are somewhat correlated to momentum, which is is also well-documented in the “traditional” literature.

So overall, the machine learning model identifies price-patterns that are mostly consistent with years-long work of researchers. But it also adds some novel signals on top of that. In my opinion, these insights are very satisfying. On the one hand, they show that machine learning can add value to existing ideas in finance. But on the other hand, the fact that the machine capitalizes on existing ideas also suggests that the “traditional” ideas weren’t so bad in the first place.

The model disagrees with conventional technical analysis

My personal favorite of the paper is the part where the authors use their model to test “conventional” technical analysis.6You may have recognized from the introduction that I don’t believe conventional technical analysis is very useful. The following results support my view. So I may disclose a potential bias at this point… The idea is simple. We have this model and we know that it generated substantial risk-adjusted performance in empirical tests. So we can present charts patterns from conventional technical analysis (head-and-shoulders, double-tops, and whatsoever) to the model and see if it “agrees” with them.

With this idea, the authors examine 23 popular chart patterns from books on conventional technical analysis. Following the rules, they simulate exact charts of the patterns and present them to the model. For 13 of the 23 patterns, the model indeed finds significant relations to future returns. But there is a catch. Of the 13 statistically significant relations, 8 go in the opposite direction than claimed by the publishers. The authors thus conclude that the “rules” of conventional technical analysis are as good as random.710 out of 23 rules are not related to future returns at all, and from the 13 that show some correlation more than half go in the opposite direction than claimed. Not very promising… And if a trading rule is as good as random it’s basically worthless because you can skip the effort and just throw a coin.

Conclusions and Further Ideas

In my opinion, there are several important conclusions from the paper. First, it is amazing what machine learning can do nowadays. Without much preprocessing, you just present charts to an algorithm and it identifies profitable patterns that are consistent with decade-long research all by itself. This is very impressive.

Second, historic prices and volumes do contain important information about future returns. While this still violates weak-form market efficiency, we just can’t deny it in light of momentum, short-term reversal and now this chart-based model.

Third, and this is probably the most important one. The paper is generally positive on technical analysis, but it also shows that it’s very hard to do it properly. The authors use a sophisticated machine learning model and test it empirically with thousands of stocks over almost 20 years. This has nothing to do with imagining head-and-shoulder patterns for single securities or drawing wild lines on charts. In fact, the successful model mostly disagrees with the “rules” and patterns of conventional technical analysis. David E. Shaw apparently already knew this back in 2003. Maybe this is one of the reasons he became a billionaire with his quantitative hedge fund.



This content is for educational and informational purposes only and no substitute for professional or financial advice. The use of any information on this website is solely on your own risk and I do not take responsibility or liability for any damages that may occur. The views expressed on this website are solely my own and do not necessarily reflect the views of any organisation I am associated with. Income- or benefit-generating links are marked with a star (*). All content that is not my intellectual property is marked as such. If you own the intellectual property displayed on this website and do not agree with my use of it, please send me an e-mail and I will remedy the situation immediately. Please also read the Disclaimer.

Endnotes

Endnotes
1 David E. Shaw is the founder of the very successful hedge fund D. E. Shaw & Co.
2 Specifically, the authors randomly select 70% of all images during this period for training and the remaining 30% for validation.
3 So the authors model the return-prediction as classification-problem.
4 Momentum (MOM), 1-month short-term reversal (STR), 1-week short-term reversal (WSTR), and a combination different price trends (TREND).
5 Generally speaking, shorting is more difficult and more costly than buying. Therefore, long-only strategies are easier to implement.
6 You may have recognized from the introduction that I don’t believe conventional technical analysis is very useful. The following results support my view. So I may disclose a potential bias at this point…
7 10 out of 23 rules are not related to future returns at all, and from the 13 that show some correlation more than half go in the opposite direction than claimed. Not very promising…