Price above 200-day SMA: backtest results
The simplest trend filter there is: own the stock while it closes above its 200-day moving average, step aside when it closes below. We ran it on real daily data for 4 stocks. It beat simply buying and holding on 1 of 4 stocks.
Results by stock
| Stock | Period | Strategy | Buy & hold | Beat it? | Worst drop | Trades | Win rate | Caution |
|---|---|---|---|---|---|---|---|---|
| Apple (AAPL) | 2016 → 2025 | +270.8% | +1038.8% | no | -30.6% | 24 | 37.5% | includes a position still open at the end |
| Amazon (AMZN) | 2016 → 2025 | +18.9% | +613.2% | no | -36.3% | 40 | 22.5% | includes a position still open at the end |
| Robinhood (HOOD) | 2021 → 2025 | +748.3% | +223.5% | yes | -47.6% | 8 | 25.0% | only 8 closed trades; includes a position still open at the end; fell 48% at its worst |
| Tesla (TSLA) | 2016 → 2025 | +460.6% | +2877.2% | no | -65.4% | 51 | 17.6% | includes a position still open at the end; fell 65% at its worst |
Best: Robinhood on +748.3%. One set of rules, fixed in advance, run on every stock: no tuning to make the numbers look better. A strategy with few trades or a big drop deserves less trust than its return suggests.
The exact rules
Buy Apple when the close crosses above the 200 day SMA. Sell when the close crosses below the 200 day SMA.
Paste those words into Extractor and it runs the same test, shows every trade on the chart with entry, stop loss and take profit, and compares it with buy & hold. Change a number and run it again in seconds.
Run these rules now, freeFree TradingView indicator (Pine Script v5)
Copy this into TradingView's Pine Editor and click Add to chart. It marks the buy and sell signals and draws the levels.
//@version=5
// Indicator generated by Extractor from your rules.
// Built for AAPL on the daily (1D) chart.
// Buy when: close crosses above sma(200)
// Sell when: close crosses below sma(200)
// Marks where your rules say buy and sell, and adds alerts you can turn on in TradingView.
indicator("Price above 200-day SMA signals", overlay=true)
sma200 = ta.sma(close, 200)
cross1 = ta.crossover(close, sma200)
cross2 = ta.crossunder(close, sma200)
entrySignal = cross1
exitSignal = cross2
// Track whether the rules are in a trade, so signals don't repeat while already long.
var bool inTrade = false
var float entryPrice = na
stopHit = false
targetHit = false
buy = not inTrade and entrySignal
sell = inTrade and (exitSignal or stopHit or targetHit)
if sell
inTrade := false
entryPrice := na
else if buy
inTrade := true
entryPrice := close
// Levels stay drawn through the bar where the trade closes.
wasInTrade = inTrade or sell
levelBase = sell ? entryPrice[1] : entryPrice
plot(sma200, "SMA 200", color.orange)
plotshape(buy, "Buy", shape.labelup, location.belowbar, color.new(color.teal, 0), text="BUY", textcolor=color.white, size=size.small)
plotshape(sell, "Sell", shape.labeldown, location.abovebar, color.new(color.red, 0), text="SELL", textcolor=color.white, size=size.small)
alertcondition(buy, "Buy signal", "Price above 200-day SMA: buy signal on {{ticker}} at {{close}}")
alertcondition(sell, "Sell signal", "Price above 200-day SMA: sell signal on {{ticker}} at {{close}}")
Test your own version
- Different stock, crypto or forex pair? Change the ticker in the description.
- Add a stop loss or take profit and see if it helps.
- Saw a strategy on YouTube? Paste the link and get the rules, the backtest and the indicator.