Liquid US stocks and ETFs
Daily12 fast EMA, 26 slow EMA, 9 signal EMA, close source
Use this documented default as the control before testing any custom settings on SPY, QQQ, AAPL, or another liquid symbol.
Swing trading settings
Short answer
MACD 12, 26, 9 is the most defensible starting point for swing trading because it is the documented default, not because it is universally best. Test it against a faster 8, 21, 5 setup and a slower 19, 39, 9 setup on your own symbol, timeframe, and trading rules. Judge the full strategy after costs, not the indicator crossover by itself.
Treat each value as a starting point. A setting only becomes useful after you test it on the same market, timeframe, costs, and date range you plan to study.
| Parameter | Starting point | What it changes | Caution |
|---|---|---|---|
| Fast EMA length | 12 bars | A shorter value makes the MACD line react sooner to recent price changes. | Faster reaction usually creates more crossovers, including more noise in sideways markets. |
| Slow EMA length | 26 bars | This is the slower trend reference subtracted from the fast EMA. | Keep it longer than the fast length. Changing both lengths together makes the test harder to diagnose. |
| Signal EMA length | 9 bars | This smooths the MACD line and defines signal-line crossovers. | A shorter signal length responds sooner but can increase turnover and trading costs. |
| Price source | Close | The source supplies the price series used by both MACD averages. | Do not compare source changes and length changes in the same test run. |
| Signal confirmation | Confirmed bar close | The strategy waits until the current candle is complete before accepting a crossover. | A close-confirmed backtest will enter later than an intrabar alert and may produce different fills. |
12 fast EMA, 26 slow EMA, 9 signal EMA, close source
Use this documented default as the control before testing any custom settings on SPY, QQQ, AAPL, or another liquid symbol.
8 fast EMA, 21 slow EMA, 5 signal EMA, close source
Test as a faster alternative when the 12, 26, 9 control reacts too late for the written holding-period rule.
19 fast EMA, 39 slow EMA, 9 signal EMA, close source
Test when reducing turnover matters more than catching early momentum changes. Expect fewer, later signals.
These templates define a research process. They are not trade calls or evidence that a setup will make money.
Rule to test
Enter long when MACD 12, 26, 9 crosses above its signal line while the close is above the 200-bar SMA. Exit on the opposite MACD cross.
Compare with buy and hold, include realistic commission and slippage, and reserve the most recent 30 percent of data for an untouched out-of-sample test.
Rule to test
Compare 12, 26, 9 with 8, 21, 5 using the same long-only crossover rule, 50-bar EMA trend filter, and ATR-based stop.
Keep position sizing and exits fixed. Compare drawdown, profit factor, trade count, and average trade after costs rather than net profit alone.
Rule to test
Enter only after a positive MACD histogram bar closes and price is above a rising 50-bar SMA. Exit when the histogram closes below zero.
Walk the test forward across several market periods and reject settings whose result depends on a small group of exceptional trades.
Begin with 12, 26, 9 on a daily SPY chart so the first result is easy to reproduce. Record that baseline before changing one length at a time.
Treat faster combinations such as 8, 21, 5 as illustrative comparison settings on a four-hour QQQ chart. Expect more trades and false turns, and do not treat a higher trade count as evidence of a better system.
Use the completed bar for MACD signals. Acting before the bar closes can make a crossover appear and disappear while the candle is still forming.
Review trending and sideways samples separately. Fidelity notes that MACD can whipsaw in trading ranges, and a single blended result can hide that weakness.
Pineify can turn the MACD lengths, trend filter, entry rule, and exit rule into an editable Pine Script strategy. Run the same rules across several settings, include commission and slippage, and compare out-of-sample results before considering paper trading.
Build and test a MACD strategySources checked 2026-07-18
This page is an information and strategy-testing tool, not investment advice. MACD settings are test starting points, not trade recommendations or promises of profit. Backtests and paper trades are hypothetical, can omit real execution effects, and do not predict future performance. Trading can result in loss.