What are the theoretical justifications for the operation of trading algorithms based on technical analysis using different indicators such as rsi, stochastic, macd, etc.? or do they really not work?
The answer to your question about the theoretical justification for technical analysis depends on the price series being analyzed. There is some evidence for a few technical indicators to have predictive value. In general, though, there is little theory behind technical analysis apart from an appeal to psychology.
There are many indicators used by technical analysts. Often, indicators describe an envelope: a set of lines that define a region containing prices. Basic indicators include:
- resistance: lines suggesting prices have difficulty rising above a certain level;
- support: lines suggesting prices have difficulty falling below a certain level;
- trend: lines suggesting support and/or resistance where the level is increasing or decreasing;
- broadening: lines suggesting resistance/support or trends which get further apart in the future;
- pennants: lines suggesting resistance/support or trends which converge in the future;
- breakouts: the idea that maybe the price will cross the resistance/support line where pennant lines cross; and,
- head-and-shoulders: prices that rise and fall making three humps with the middle hump being the highest.
There are other indicators which look at moving averages, where moving averages cross, analysis of volume, etc. These have even less theory behind them.
I only know of two indicators which could claim some general theoretical support. The first is money flow, how much notional trades at the bid versus ask. This is related to measures of asymmetric information in some microstructure models such as Glosten and Milgrom (1985).
The second measure with theoretical support is cross-sectional momentum, aka the Carhart (1997) factor: long stocks which did relatively better and short stocks which did relatively poorer (aka WML="winners-minus-losers"). Sinha (2016) shows that cross-sectional momentum may be explained by diffusion of news sentiment (information).
For Which Prices Should Technical Analysis Work?
For commodities, commodity spreads, and foreign exchange rates, ideas of resistance and support are very sensible.
Commodities are physical goods which means they have physical infrastructure which is used in their extraction or creation, refining, and transport. Physical infrastructure like that changes very slowly, so the industry overall has a stable distribution of production costs. Furthermore, as prices rise, more expensive producers will enter the market. That increase in supply will bias prices downward. Similarly, falling prices induce some producers to cease production -- and the decrease in supply biases prices upward.
Commodity spreads may be similar. Refineries buy barrels of crude oil and refine them into RBOB gasoline, Diesel (and similar middle distillates like jet and kerosene), LPGs and petrochemicals, bunker (residual, heavy fuel oil), and asphalt. The difference between the sale value of those products and the cost of the inputs (crude oil) is the gross producer margin (GPM). GPMs tend to revert toward the long-term mean GPM for an industry.
Foreign exchange (FX) rates may revert to typical levels based on slowly-changing relationships (differences in purchasing power parities, mutual trade) and more quickly-changing relationships of interest rates. There is not a strong connection between prices and supply: high FX rates do not automatically lead to more creation fo the expensive currency. Therefore, FX rates may not be strongly-mean-reverting (or reverting at all). Therefore, ideas of resistance, support, and trends may not be sensible.
Stocks have no reason to revert to any level apart from some idea of (what a model says is) fair value. Similarly, real estate prices have no reason to revert to typical levels. (A "typical" level is even a difficult concept since no two properties are the same.)
Bonds may revert toward their face value, especially as they approach maturity. This is not, however, a novel concept nor is it information that is unlikely to be already impounded in the bond's price.
Empirical Academic Studies
I said I can only think of two indicators with general theoretical support. I also mentioned that there may be industry structural or trade-/PPP-based reasons why some technical analysis might work for commodities and FX. However, we might wonder how technical analysis performs empirically.
The most rigorous empirical study of technical analysis was done by Lo, Mamaysky, and Wang (2000). I recommend reading the paper because it reveals just how difficult it can be to study technical analysis rules.
In short, they created computer programs to do technical analysis; brought those results to technical analysts to see if the analysts agreed with the programs; and, continued doing this until the programs and analysts were in agreement.
Then, they used those calibrated programs to do technical analysis on 31 years of stock data. What they found was that a few indicators, head-and-shoulders and resistance, seemed to be statistically significant. The other indicators seemed to be like the mythical cologne in Anchorman: "60% of the time... it works every time." (In other words, randomly working = not significant.)
Kidd and Brorsen (2002) looked at technical analysis of commodity prices and found that the returns to trading based on technical analysis has declined.
Menkhoff and Taylor (2007), however, found that technical analysis is profitable for foreign exchange rates. They suggest that this is due to technical analysis uncovering "nonfundamental influences."
You also asked about more complicated indicators than those discussed above. There are many studies on using these indicators; however, most of these studies conclude the indicators are not significant or dubious. For example, Cohen and Cabiri (2015) found RSI predictive in 5 out of 6 years -- a level that does not rise to statistical significance. Perhaps the most hopeful studies are Chong and Ng (2008), which looked at the RSI and MACD and found it to perform better than buy-and-hold in some cases for London Stock Exchange stocks, and Chong, Ng, and Liew (2014) which finds the RSI and MACD to work well in Italian markets and the US Dow 30 stocks.
While the last works are hopeful, I would remember that there are many other studies which are not hopeful. Unfortunately, there is not a convincing argument for most technical indicators that is supported by a majority of studies.
Really great question. Having studied finance academically, in an academic setting, you will always be told that technical analysis is non-sense. In the world of pure academics, the efficient market hypothesis is still the preferred way of thinking. Furthermore, academics will point out that empirical data and historical back-tests thoroughly disprove technical analysis (and this is true over daily samples over long periods of time).
When I started trading, I had this mindset and completely ignored the technicals. Furthermore, there are many traders who are completely oblivious to technical analysis who are highly successful traders.
Nonetheless, I would say that for some asset classes, mainly spot FX, technical analysis can be useful when there are no fundamentals driving the markets. I noticed many times that on days when important macro figures come out (GDP, CPI, payrolls, etc), technical levels play no part whatsoever. But on some days when the markets are "dead", there is no news-flow and not much else is happening, the technical levels are watched by traders and algos and I have seen multiple times that on these mundane days, an FX pair would slowly drift towards (say) a 50-day MA, only to " bounce off" exactly of that level.
I know it sounds stupid. But based on my experience, I would nonetheless conclude with the following summary:
(i) In my view, markets normally function in three modes: (a) risk-on, (b) risk-off, (c) neutral
(ii) during risk-on or risk-off, technicals play little to no part and the markets are driven by fundamentals and news-flow (which translate into order flow)
(iii) during the neutral mode, you often see the major stock indexes (DAX, SPX etc) close within a few bps of where they opened (i.e. they hardly move at all when looking at daily close), but there is still an intraday volatility, sometimes even + / - 0.5%. I view that as complete noise and "trading for the sake of trading". I would say that in theory, on a day when there is no significant news and not much happening, instruments should hardly move at all: but they still do (scalpers still try to scalp, algos still try to snap inefficient quotes, etc). On such days, in my experience, moving averages on FX and major stocks seem to play a noticeable role.
EDIT: I also attach a chart depicting a "resistance" line on the SPX500, that stretches quite some years back: this resistance line is quite notorious in that it has been publicized quite a lot, for example by a top Bloomberg analyst Cormac Mullen a number of times. Therefore, many traders have become aware of it. The traders that do pay attention to it tend to sell the SPX futures when the levels reach the "resistance" line: and indeed, this shows how TA really works: if enough market participants pay attention to a particular level, it becomes a self-fulfilling prophecy, because the order-flow will become significant enough to affect the price action.
(PS: yes, miraculously, the resistance also "worked" in March 2020 as Covid kicked in and the SPX "bounced off" the resistance line very heavily: but that is of course a coincidence).
The theoretical justification for technical analysis (TA) is less about market (in)efficiency; and more about prices as a signal of sentiment and positioning biases, that are neither always neutral nor unbiased.
Anecdotes are cheap; but sometimes still helpful. In a past job, I was a traditional sell-side fundamental market strategist. But I was sat next to our local house "guru" chartist. Unlike me, he had done his internship at a central bank. And his "road to Damascus moment" came when his boss told him in advance what the inflation would be: how would the market react? My friend knew what the consensus on the print was; and textbook-answered that bonds would sell off on the news, the print being higher than the market. Except, of course, the opposite happened - bonds rallied... either the perception of the "expectation" was wrong, or the perception of a higher CPI figure was so widespread that everyone who wanted to sell had sold, so there were no new sellers into the news; and plenty of leveraged sellers, eager to get out of their leveraged positions if the market went the other way (irrespective of their "expectations").
To believe in TA, you have to believe that the market knows, and has priced, the relevant fundamentals. And then that the bulls and the bears on those fundamentals have decided to place differently-sized bets on their conviction on those bets. Then you can get indeed get asymmetric reactions to "new news". Which is exactly what the chartists are trying to find; and dowse.
The ultimate irony here is that TA and EMH are not actually inconsistent! Efficient markets just assume all knowable knowledge is in the price. They just take the next step for granted - that is, the confidence of the agents' behaviour setting that price is a constant function of their economic view; as opposed to this ALONGSIDE their current portfolio risk!
Relax this behavioural constraint; and it quickly becomes possible for "rational" economic agents to behave sub-optimally. Which is the POTENTIAL theoretical basis for TA skimming off the top of conflicted, and mis-positioned, fundamental types. In short, TA believes that the economically fundamentalist types will misbehave, dealing with their inevitable cock-ups!
Whether or not this is true, I honestly don't know... but it's the least-bad theory I've seen ;-) DEM
There's papers, etc. as others note.
But I think it may be informative to debate the theoretical justifications of EMH. Because a conversation on technical analysis never seems to convince anyone.
EMH can be generalized as (1) "the price is right" (2) "you can't beat the market".
"The price is right": The idea of EMH was formalized around 1970, when 10y treasury yield was ~7%. The WACC for any given company was 10%+. With such a large discount rate, the possible range of valuation is rather narrow.
The discount rate for the safest companies are now below 1%. How do you values companies, when nobody can predict 5 year, let alone 20 ? Any change in assumption should produce massive price swings. Yet, the past decade has been the least volatile.
Needless to say, I think this notion that it is EMH to debunk can be argued against.
"You can't beat the market" Plainly, I think a lot of people have beaten the market. It's pretty straight-forward, tech stocks only go up.
Now, addressing the theoretical justification for technical analysis directly, it should be noted that game theory is reason enough in many domains that are dynamic and can't "math it out", eg strategic combat.
The real world is a lot messier than theory.
- Funds want to minimize market impact (so their aggregate buying may take months)
- Options market makers do have to hedge, which means shorting/buying dynamically based on price. Their concern is not valuation.
- Options are typically concentrate towards levels, which again, has an impact on buying/selling from the market maker
- A significant share of the daily volume is trading, not investing.
- Volatility suppression a la carry trade
Price is the single factor that can be observed, without understanding all the hidden forces.
Anyways, this is not trading/investment advice. There's a lot of subjectivity and there should be a lot of skepticism with anyone selling "secrets".
My broader point is that (1) declining interest rates have paved way for other forces to outweigh EMH (2) trend sometimes (certainly not always) reflect a price/demand-related truth.
We saw many false breakouts with EM over the decade, with EM being a particularly crowded trade amongst trend-following hedge funds.
The problem with many domains is the contextual nature. It's why we consult with doctors and lawyers.
US tech stocks have been a crowded trade that have persist. I think it makes sense. Valuations have never been obscene in aggregate, but there has been near constant grind up reflecting the near constant bid.
I wouldn't doubt there's a true, universally generalizable/applicate justification of trend (or the various ebb and flow of price signals for that matter). But you probably won't find it written here or screamed on CNBC.
There are a number of investor classes that behave in patterns. An example are institutional investors, such as pension funds. A large portion of these investors religiously follow certain investment edicts, such as rebalancing and adhering to a benchmark with no active risk.
Some of these investors adopt a calendar based approach that regardless of how the economy is doing, they will rebalance to the benchmark weights at every quarter end. Others use a threshold approach where they will rebalance a portfolio when the actual portfolio weights are off by a certain percentage.
Other investors such as trend followers have such investment rules for entry and exiting trends in a name or certain asset class.
It is easy to see that with enough of these players adhering to certain rules, that a pattern emerges based on the performance of the certain assets. Technical analysts use the analysis to these trends to identify patterns resulting from such behavior to make market and investment calls.
In short, technical analysis works because 1) Investors behave in such patterns and 2) because enough Investors adopt them in their investment approach.
Then there is the knock on effect that if something is shown to work, it will develop a following and it becomes self-perpetuating.