200-Day SMA Regime Filter on Alpaca
Own the asset when price closes above its 200-day average; hold cash when it closes below. Deployed to your own Alpaca account — no code, your assets never leave the broker.
Setup on Alpaca
- Connect Alpaca with your API keys — paper and live accounts are both supported.
- Validate any strategy against Alpaca paper first: same rules, simulated money, live data.
- Promote to the live account when paper behavior matches the backtest.
- Each deployed strategy runs in its own sleeve with independent cash.
- Guardrails check every order: price bands, notional caps, and a global pause.
The strategy
- WHEN the market opens · IF not invested AND yesterday's close > SMA(200) · THEN buy with 98% of the sleeve
- WHEN the market opens · IF invested AND yesterday's close < SMA(200) · THEN sell the whole position
Good for: a first systematic strategy — it's simple enough to fully understand and audit every trade.
Watch out: price whips around the 200-day line during volatile bottoms, generating clusters of buy-sell pairs; some traders add a small buffer band to reduce churn.
Strongest backtests for this strategy
| ETF | CAGR | max DD | trades |
|---|---|---|---|
| SOXL | 31.6% | −63.6% | 19 |
| TQQQ | 23.6% | −36.6% | 13 |
| QLD | 19.6% | −28.8% | 12 |
| SOXX | 17.4% | −39.2% | 19 |
| XLK | 14.8% | −19.6% | 11 |
| ROM | 13.8% | −42.2% | 18 |
| IAU | 13.6% | −19.9% | 21 |
| SSO | 12.1% | −31.2% | 17 |
Top-8 by CAGR shown of 59 tested — hindsight selection; see the full table including the losers.
Build it from blocks (or type it in English), backtest it on 5.5 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
Frequently asked questions
How do I automate 200-day regime filter on Alpaca?
Connect Alpaca to DeployQuant (trade & read permissions only), pick the 200-Day SMA Regime Filter template or describe it in English, backtest it on your chosen ETF, allocate cash, and confirm live trading. The strategy then runs every session in its own sleeve inside your Alpaca account.
Why the 200-day average specifically?
Convention and evidence: it approximates a year of trading days and has been studied across decades of data. It isn't optimal everywhere — the per-ETF backtests here show where it helped and where it didn't.
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-07-17, $10,000 starting capital, no margin, fees and slippage not modeled) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.