All guides

How to Backtest RSI, MACD, Moving Averages, Bollinger Bands and ATR

9 min read · Updated October 2026

Every indicator answers a different question. Moving averages describe trend, RSI describes momentum stretch, MACD describes momentum change, Bollinger Bands describe how far price is from normal, and ATR describes volatility. A good backtest uses each one for the job it does well. The recipes below are starting points to test, not recommendations to trade.

Before you start: three rules for every indicator test

  • Test one idea at a time. Start with the bare signal, then add a filter only if you can explain why it should help.
  • Always include a stop. An indicator strategy without a stop can look fine for years and then give everything back in one move.
  • Compare with buy-and-hold on the same symbol and period. If your rules don't beat it on return or on drawdown, they aren't adding anything.

Moving average crossovers (SMA / EMA)

Best for: trending markets and long holding periods. Example: enter when the 50-day SMA crosses above the 200-day SMA; exit when it crosses back below; stop at 2× ATR below entry.

What to watch: crossovers lag, so expect to give back part of every move, and they get chopped up in sideways markets. Test across at least one choppy year. EMAs react faster than SMAs but produce more false signals; compare both rather than assuming one is better.

RSI (Relative Strength Index)

Best for: buying pullbacks inside an uptrend. Example: enter when RSI(14) crosses above 30 while price is above the 200-day SMA; exit when RSI(14) rises above 70 or price closes below the 50-day SMA; stop at 1.5× ATR.

What to watch: "RSI below 30 means buy" on its own often fails, because strong downtrends stay oversold for a long time. The trend filter is what usually makes RSI strategies work. Also test whether a shorter RSI (2 to 5 periods) suits the symbol better.

MACD

Best for: catching shifts in momentum. Example: enter when the MACD line crosses above the signal line while the MACD histogram is below zero (an early turn); exit when MACD crosses below the signal line; target 2R.

What to watch: MACD crosses happen often, so trade counts climb quickly. Check that the average win is meaningfully larger than the average loss, and that results survive in more than one market regime.

Bollinger Bands

Two opposite ways to use them, so test both. Mean reversion: enter when price closes below the lower band while above the 200-day SMA, exit at the middle band. Breakout: enter when price closes above the upper band with volume above its 20-day average, exit when price closes below the middle band.

What to watch: mean reversion tends to win often but lose big when a move keeps going, so a stop matters most here. Breakouts win less often and rely on a few large trends.

ATR for stops and targets

ATR is not an entry signal, but it is one of the most useful tools in a backtest. Setting stops at a multiple of ATR (commonly 1.5× to 3×) adapts them to each symbol's volatility, so a quiet utility stock and a fast-moving tech stock are both given sensible room. Pair it with a target in R multiples (e.g. 2R or 3R) so every trade has a defined risk-to-reward.

Volume as confirmation

Requiring volume to be above its 20-day average on the signal bar is a simple, explainable filter for breakouts and crossovers: it asks whether real participation is behind the move. Test the strategy with and without it; if the filter removes most trades without improving results, drop it.

Testing indicator settings without overfitting

Once a rule works, nudge each number up and down (for example RSI 12, 14 and 16, or a 45/190 and 55/210 crossover). A real edge survives small changes; a curve-fit one collapses. Then test the same rules on a few different symbols. Finally, deploy it as a paper agent and compare live results with the backtest in your Track Record.

Try these in the Strategy Builder

You can type any recipe above straight into NightShift Trader's Strategy Builder. It supports price, SMA, EMA, RSI, MACD (line, signal and histogram), Bollinger Bands, ATR, volume and average volume, with greater-than, less-than and cross-above / cross-below conditions.

Test your own strategy for free

Describe it in plain English, backtest it on real data, then paper-trade it. No card required.

Start free