Backtest a trend following strategy
3/11/2026 03:57pm
I’ve run a concrete trend-following backtest for you and summarized the results and implications below.
---
## 1. What exactly was backtested?
Because your request was high level (“Backtest a trend following strategy”), I completed the missing parameters with standard, transparent assumptions:
**Market & instrument (auto-chosen)**
- Underlying: **SPY** (large-cap U.S. equity ETF)
- Direction: **Long-only**, fully in cash when not in a trend
**Trend rule (auto-chosen, classic trend-following)**
- Indicator: **200-day simple moving average (SMA)** on daily close
- **Entry (open long):** when SPY’s **daily close crosses above** its 200‑day SMA
- **Exit (go flat):** when SPY’s **daily close crosses below** its 200‑day SMA
**Backtest setup (auto-chosen defaults)**
- Data frequency: **Daily**
- Price used: **Close**
- Backtest window: **2010‑01‑01 to 2026‑03‑10**
- Position sizing: 100% of capital when in a long position, 0% otherwise
- Leverage: **None**
- Transaction costs, slippage, taxes: **Ignored** (can be added later if you wish)
- Risk controls beyond the trend rule: **None** (no explicit stop-loss / take-profit / max-holding-rule)
If you’d like, I can re-run the backtest with:
- Different lookback (e.g., 100-day, 50/200 crossover)
- A different asset (e.g., NASDAQ, single stock, crypto, FX)
- Explicit costs (e.g., 5–10 bps per trade)
- Stop-loss / take-profit overlays
---
## 2. Key performance statistics
Over **2010‑01‑01 to 2026‑03‑10**, this SPY 200-day SMA trend-following strategy achieved:
- **Total return:** **+231.99%**
- **Annualized return (CAGR):** **8.04%**
- **Max drawdown:** **22.43%**
- **Sharpe ratio:** **0.74**
Trade-level characteristics (aggregated):
- **Average return per trade:** **+3.14%**
- **Average gain on winning trades:** **+8.63%**
- **Average loss on losing trades:** **−2.11%**
So, on average, **winners were roughly 4× the size of losers**, which is typical for trend-following: the strategy cuts losing trades relatively quickly and rides winners.
Important caveats:
- These results **exclude** commissions, bid–ask spreads, and slippage.
- No borrowing costs or financing costs were applied (unlevered).
- No short-selling; the strategy is either **long** or **flat**.
---
## 3. Visual backtest summary
```jgy-json-canvas
{
"show_type": "jgyNewLowcode",
"config": {
"type": "iwcapp/stockBackTestTool",
"version": "0.0.3",
"url": "//cdn.ainvest.com/frontResources/s/foiegras/stockBackTestTool/0.0.3/stockBackTestTool@0.0.3index.js"
},
"data": {
"columns": [
{
"index_name": "strategy_basic_info",
"key": "strategy_basic_info",
"type": "Object"
},
{
"index_name": "backtest_condition",
"key": "backtest_condition",
"type": "Object"
},
{
"index_name": "backtest_result",
"key": "backtest_result",
"type": "STR"
}
],
"datas": [
{
"strategy_basic_info": {
"name": "SPY 200-day SMA Trend Following",
"description": "Long-only daily trend following strategy on SPY that buys when the close price crosses above its 200-day simple moving average and exits to cash when the close crosses below the 200-day simple moving average, using close prices with no leverage or transaction costs."
},
"backtest_condition": {
"object": {
"display_name": "Object",
"type": "ticker",
"ticker": [
"SPY"
]
},
"open_signal": {
"display_name": "Open Signal",
"type": "criteria",
"criteria": "Go long when SPY daily close price crosses above its 200-day simple moving average."
},
"sell_signal": {
"display_name": "Close Signal",
"type": "criteria",
"criteria": "Close the position when SPY daily close price crosses below its 200-day simple moving average."
}
},
"backtest_result": "https://cdn.ainvest.com/backtest/agent/session/784562/1800014825/424887cfa5b6ff0e20105949bb017405/spy_200dma_trend_backtest.json"
}
]
}
}
```
---
## 4. How to interpret these results
### 4.1 Return & growth profile
- A **total return of ~232%** over ~16 years means capital grew by roughly a factor of **3.3×**.
- An **annualized 8.0%** return is respectable and in line with long-run equity returns, but the key is **how** it achieves this: by **being out of the market in downtrends**.
This kind of strategy tends to:
- Participate in large, sustained bull markets (e.g., multi-year uptrends).
- Step aside during severe bear phases, potentially avoiding the deepest drawdowns.
### 4.2 Risk & drawdown behavior
- **Max drawdown 22.4%** is significantly milder than the kind of 40–50% drawdowns that broad equity markets have historically experienced in major crises.
- Trend-following is doing its job: **cutting risk when prices roll over**.
- However, 22% drawdown is still **material**; this is not a low-volatility or capital-preservation strategy. It's still an equity-like risk profile, just with **risk managed by the trend filter**.
### 4.3 Trade characteristics and edge
- **Average trade +3.1%** with winners around **+8.6%** and losers around **−2.1%** suggests:
- When the trend develops, the strategy can hold and accumulate meaningful profit.
- Losing trades are cut relatively quickly (small magnitude).
- For a trend follower, **payoff asymmetry** (big wins, small losses) is crucial; the statistics are consistent with that pattern.
What this doesn’t tell us (but is typically important) without further breakdown:
- **Win rate** (percentage of profitable trades). Trend followers often win **less than 50%** of the time but remain profitable because winners are much larger than losers.
- **Concentration of return**: Often a small number of “big trends” drive a large part of the P&L.
If you like, we can further decompose:
- P&L by year or by regime (bull vs bear periods)
- Distribution of trade returns
- Average holding period per trade
---
## 5. Investment implications
1. **Role in a portfolio**
- This strategy behaves like a **risk-managed equity exposure** rather than pure equity beta.
- It’s particularly attractive for investors who are comfortable being sometimes **out of the market** to reduce drawdowns, in exchange for occasionally missing part of sharp V-shaped recoveries.
2. **When it tends to work well**
- Strong, persistent trends (multi-month/multi-year bull markets).
- Extended bear markets where staying out of the market avoids large losses.
3. **When it tends to struggle**
- **Sideways or choppy markets** around the 200-day SMA, where repeated crosses generate **whipsaws** (small losses that add up).
- Abrupt crashes that happen faster than the moving average can react; some part of the crash is usually still taken.
4. **Practical considerations**
- Adding realistic **transaction costs** reduces performance, especially if the strategy trades frequently in choppy periods.
- Choice of lookback window (e.g., 100 vs 200 vs 50 days) can significantly alter trade frequency and sensitivity.
- Combining with other signals (e.g., volatility filters, breakout rules) can help reduce whipsaws.
---
## 6. Possible next steps
Tell me how you’d like to refine this, for example:
- **Different instrument:** e.g., QQQ, a single stock, sector ETF, BTC, FX pair.
- **Different trend rule:**
- Price vs 100‑day SMA
- 50/200-day SMA golden cross
- Donchian channel breakout (e.g., 55-day high/low)
- **Risk overlays:**
- Stop-loss (e.g., −10%)
- Take-profit (e.g., +30%)
- Max holding period (e.g., 250 trading days)
- **Portfolio-level version:** same rule applied to multiple assets (requires a more customized, multi-asset backtest).
If you tell me your **preferred market, time horizon, and risk tolerance**, I can tailor the trend-following strategy and re-run the backtest with parameters that match your investment profile.