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

MACDBollinger bands
Higher Sharpe than the other, default settings22 of 3917 of 39
Higher Sharpe than holding the stock2 of 392 of 39
Median Sharpe, default settings−0.14−0.24
Held up on years it never saw3 of 396 of 39
Median Sharpe on those years−0.52−0.41
Beat random timing (p < 0.05)17 of 3910 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.

The exact MACD rule

Mean reversion

Buys when the price falls below its lower band and shorts when it rises above the upper one: it fades extremes.

The exact Bollinger bands rule

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.

StockMACDBollinger bandsMACD, unseen yearsBollinger bands, unseen years
Apple0.35−0.03−0.53−1.13
Microsoft−0.750.59−0.680.77
Nvidia−0.070.30−0.48−0.72
Amazon−0.37−0.39−0.96−0.05
Alphabet−0.350.56−0.65−1.00
Meta Platforms−0.590.71−0.380.78
Tesla0.73−1.240.87−0.87
JPMorgan Chase−0.210.050.080.42
S&P 500 ETF (SPY)−0.180.38−0.83−1.00
Nasdaq-100 ETF (QQQ)−0.190.40−0.68−0.79
AMD0.11−0.43−0.260.73
Netflix−0.410.13−0.43−0.96
Berkshire Hathaway0.28−0.46−0.83−1.07
Visa−0.450.24−1.00−0.03
Bank of America0.17−0.71−0.19−1.76
Walmart−0.42−0.18−0.34−0.63
Coca-Cola−0.220.070.64−0.10
Johnson & Johnson−0.10−0.300.150.35
ExxonMobil0.11−0.14−0.850.30
Disney0.16−0.24−0.91−0.86
Dow Jones ETF (DIA)0.030.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 Services0.27−0.42−0.910.04
HDFC Bank−0.24−0.230.99−0.79
Infosys0.25−0.98−0.04−0.41
ICICI Bank−0.320.81−0.361.16
State Bank of India0.29−0.28−0.780.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.030.43
Hindustan Unilever0.46−0.59−0.85−0.39
Bajaj Finance0.43−0.180.42−0.33
Asian Paints−0.42−0.59−0.41−0.40
Maruti Suzuki−0.57−0.38−0.30−0.01
Wipro0.19−1.27−0.65−0.90
Nifty 50−0.27−0.71−0.590.00
Nifty Bank−0.02−0.920.170.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.