MACD vs Bollinger bands, on 39 stocks.
The same 39 US and Indian stocks and indices, 2019–2024. At default settings MACD had the higher Sharpe ratio on 22, Bollinger bands on 17. Tuned on the first 70% of the period and scored on the rest, MACD held up on 3 and Bollinger bands on 6.
The scoreboard
| MACD | Bollinger bands | |
|---|---|---|
| Higher Sharpe than the other, default settings | 22 of 39 | 17 of 39 |
| Higher Sharpe than holding the stock | 2 of 39 | 2 of 39 |
| Median Sharpe, default settings | −0.14 | −0.24 |
| Held up on years it never saw | 3 of 39 | 6 of 39 |
| Median Sharpe on those years | −0.52 | −0.41 |
| Beat random timing (p < 0.05) | 17 of 39 | 10 of 39 |
Beating random timing and holding up are different questions. The permutation test asks whether a rule's timing beat chance over the whole period; the walk-forward split asks whether the setting picked on the early years kept working after. A rule can pass the first and fail the second.
The two rules
Trend following
Long while the MACD line is above its signal line, short while it is below: a smoothed trend signal.
Mean reversion
Buys when the price falls below its lower band and shorts when it rises above the upper one: it fades extremes.
Stock by stock
Sharpe ratio at default settings over the whole period, then the Sharpe on the years after the split of the setting tuned on the years before. The higher of each pair is in bold.
| Stock | MACD | Bollinger bands | MACD, unseen years | Bollinger bands, unseen years |
|---|---|---|---|---|
| Apple | 0.35 | −0.03 | −0.53 | −1.13 |
| Microsoft | −0.75 | 0.59 | −0.68 | 0.77 |
| Nvidia | −0.07 | 0.30 | −0.48 | −0.72 |
| Amazon | −0.37 | −0.39 | −0.96 | −0.05 |
| Alphabet | −0.35 | 0.56 | −0.65 | −1.00 |
| Meta Platforms | −0.59 | 0.71 | −0.38 | 0.78 |
| Tesla | 0.73 | −1.24 | 0.87 | −0.87 |
| JPMorgan Chase | −0.21 | 0.05 | 0.08 | 0.42 |
| S&P 500 ETF (SPY) | −0.18 | 0.38 | −0.83 | −1.00 |
| Nasdaq-100 ETF (QQQ) | −0.19 | 0.40 | −0.68 | −0.79 |
| AMD | 0.11 | −0.43 | −0.26 | 0.73 |
| Netflix | −0.41 | 0.13 | −0.43 | −0.96 |
| Berkshire Hathaway | 0.28 | −0.46 | −0.83 | −1.07 |
| Visa | −0.45 | 0.24 | −1.00 | −0.03 |
| Bank of America | 0.17 | −0.71 | −0.19 | −1.76 |
| Walmart | −0.42 | −0.18 | −0.34 | −0.63 |
| Coca-Cola | −0.22 | 0.07 | 0.64 | −0.10 |
| Johnson & Johnson | −0.10 | −0.30 | 0.15 | 0.35 |
| ExxonMobil | 0.11 | −0.14 | −0.85 | 0.30 |
| Disney | 0.16 | −0.24 | −0.91 | −0.86 |
| Dow Jones ETF (DIA) | 0.03 | 0.07 | −0.52 | −0.63 |
| Russell 2000 ETF (IWM) | −0.10 | −0.38 | −0.87 | −0.76 |
| Reliance Industries | −0.38 | −0.13 | −0.27 | −0.43 |
| Tata Consultancy Services | 0.27 | −0.42 | −0.91 | 0.04 |
| HDFC Bank | −0.24 | −0.23 | 0.99 | −0.79 |
| Infosys | 0.25 | −0.98 | −0.04 | −0.41 |
| ICICI Bank | −0.32 | 0.81 | −0.36 | 1.16 |
| State Bank of India | 0.29 | −0.28 | −0.78 | 0.17 |
| ITC | −0.12 | −0.56 | −0.61 | −0.80 |
| Bharti Airtel | −0.57 | −0.18 | −0.72 | −1.36 |
| Larsen & Toubro | −0.14 | −0.30 | −1.03 | 0.43 |
| Hindustan Unilever | 0.46 | −0.59 | −0.85 | −0.39 |
| Bajaj Finance | 0.43 | −0.18 | 0.42 | −0.33 |
| Asian Paints | −0.42 | −0.59 | −0.41 | −0.40 |
| Maruti Suzuki | −0.57 | −0.38 | −0.30 | −0.01 |
| Wipro | 0.19 | −1.27 | −0.65 | −0.90 |
| Nifty 50 | −0.27 | −0.71 | −0.59 | 0.00 |
| Nifty Bank | −0.02 | −0.92 | 0.17 | 0.01 |
| BSE Sensex | −0.16 | −0.53 | −0.28 | −1.01 |
Hypothetical results on past data, from a script in the repository that re-runs every figure. Not a recommendation to buy, sell or trade anything.