Swing trading settings

Best Moving Average for Swing Trading

Short answer

A 20-period EMA is one research baseline to test for swing entries, while a 50-period SMA can serve as a separate trend filter. A 200-period SMA can be tested as a long-term regime filter. None is universally best. The right choice depends on the holding period, symbol, timeframe, entry rule, exit rule, and trading costs, so compare them with the same complete strategy.

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
Average typeEMA for entries, SMA for regime filtersEMA gives recent prices more weight. SMA gives each value in the lookback equal weight.EMA usually follows price more closely, but Fidelity notes that this sensitivity can also create more short-term changes.
Fast length20 barsA 20-bar average can track pullbacks and shorter trend changes within a swing horizon.The number means bars, not always days. A 20-bar average on a four-hour chart differs from a 20-day average.
Intermediate length50 barsA 50-bar SMA smooths more price movement and is commonly used as an intermediate trend gauge.More smoothing adds lag, so entries and exits may occur well after price turns.
Long-term length200 barsA 200-bar SMA is a common long-term trend proxy and can act as a regime filter.It needs enough history to initialize and can be too slow to serve as a swing entry trigger.
Price sourceCloseThe source determines which price from each bar enters the average.Keep the source fixed while comparing types or lengths so the result has one clear cause.
Signal confirmationConfirmed bar closeThe rule accepts a cross only after the chart candle has completed.Intrabar alerts can fire earlier and may not match close-confirmed historical results.

Presets to test, not copy blindly

Liquid US stocks and ETFs

Daily

20 EMA entry reference with 50 SMA trend filter

Test for pullback entries that last several days to a few weeks. Define the actual entry and exit instead of treating a touch as a trade.

US index ETFs

Daily

50 SMA intermediate trend with 200 SMA long-term regime filter

Test slower trend rules where fewer signals and a broad market filter are intentional.

Liquid forex pairs or index futures

4-hour

20 EMA fast average with 50 EMA slow average

Test only with market-specific session, spread, commission, and slippage assumptions. The lengths refer to four-hour bars.

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 price closes back above the 20 EMA while the 50 SMA is rising. Exit on a close below the 20 EMA or an ATR-based stop.

Compare the 20 EMA with a 20 SMA while every other rule stays fixed. Include costs and reserve recent history for out-of-sample testing.

QQQ

1D

Rule to test

Enter long when the 20 SMA closes above the 50 SMA and price is above the 200 SMA. Exit when the 20 SMA closes below the 50 SMA.

Compare against buy and hold. Review drawdown, average trade, exposure, and trade count across bullish, bearish, and sideways periods.

AAPL

4H

Rule to test

Enter after a completed close above the 20 EMA when the 50 EMA slope is positive. Use the same ATR stop and fixed risk per trade in every run.

Walk the setup forward and model commission and slippage. Reject a parameter if small length changes cause the result to collapse.

Checks to run before trusting the result

Use the 20-period EMA as a research baseline for daily SPY pullbacks and the 50-period SMA as a separate trend filter. Test both rather than treating either value as a recommendation.

When comparing SMA and EMA on AAPL, hold the length and every trade rule constant. Otherwise weighting and a second change cannot be separated.

Wait for the bar to close before accepting a price cross. AAPL can move above and below a moving average several times before the daily candle is final.

Inspect the number of trades as well as return. A fast EMA may look responsive on QQQ, but extra turnover can erase an apparent advantage once costs and slippage are included.

Turn the idea into an inspectable rule

Pineify can turn a moving-average idea into an editable Pine Script strategy with selectable SMA or EMA type, lengths, bar-close confirmation, risk rules, commission, and slippage. This makes side-by-side tests repeatable instead of relying on chart impressions.

Build and test a moving-average strategy

Frequently asked questions

Sources and limits

Sources checked 2026-07-18

  • Simple Moving Average (Fidelity, checked 2026-07-18). Defines SMA, discusses the lag added by longer periods, and identifies 50-bar and 200-bar averages as common intermediate and long-term trend gauges.
  • Exponential Moving Average (Fidelity, checked 2026-07-18). Explains why EMA follows price more closely than the same-length SMA and why that sensitivity can produce more short-term changes.
  • How to pick stocks using fundamental and technical analysis (Charles Schwab, checked 2026-07-18). Uses 20 days as a moving-average starting point and gives 50-day and 200-day periods as alternatives based on trading style.
  • Moving Averages (TradingView, checked 2026-07-18). Documents SMA and EMA calculations, moving-average crosses, configurable inputs, and the lagging nature of moving averages.
  • Strategy publishing rules (TradingView, checked 2026-07-18). Requires realistic parameters, costs, adequate samples, and clear explanations when presenting strategy tests.

This page is an information and strategy-testing tool, not investment advice. Moving-average parameters 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.