Swing trading settings

Best MACD Settings for Swing Trading

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.

Parameters and what they change

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.

Swing trading parameter comparison
ParameterStarting pointWhat it changesCaution
Fast EMA length12 barsA 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 length26 barsThis 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 length9 barsThis smooths the MACD line and defines signal-line crossovers.A shorter signal length responds sooner but can increase turnover and trading costs.
Price sourceCloseThe source supplies the price series used by both MACD averages.Do not compare source changes and length changes in the same test run.
Signal confirmationConfirmed bar closeThe 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.

Presets to test, not copy blindly

Liquid US stocks and ETFs

Daily

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.

Liquid US stocks and ETFs

4-hour

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.

Index ETFs with slower swing rules

Daily or weekly

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.

Test templates you can audit

These templates define a research process. They are not trade calls or evidence that a setup will make money.

SPY

1D

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.

QQQ

4H

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.

AAPL

1D

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.

Checks to run before trusting the result

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.

Turn the idea into an inspectable rule

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 strategy

Frequently asked questions

Sources and limits

Sources checked 2026-07-18

  • MACD technical indicator guide (Fidelity, checked 2026-07-18). Documents the 12-period EMA minus 26-period EMA calculation, the 9-period signal EMA, and the risk of whipsaws in trading ranges.
  • Moving Average Convergence Divergence indicator (TradingView, checked 2026-07-18). Explains the MACD line, signal line, histogram, configurable average types, lengths, source, and timeframe behavior.
  • MACD Strategy (TradingView, checked 2026-07-18). Confirms 12, 26, and 9 as the built-in MACD strategy defaults and describes its histogram sign-change rule.
  • Strategy publishing rules (TradingView, checked 2026-07-18). Calls for realistic parameters, commissions, sufficient samples, and performance claims that do not mislead traders.

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.