PyInvesting

Start with a trend rule tested since 2005.

The 200-day moving average strategy holds up to 20 large US stocks while each trades above its long-term average, and keeps the rest in cash. Inspect the recorded result, then copy the rule into your account and change any setting. No coding needed.

Free Starter access. No payment method required. Each run uses one of your three free backtests and is saved to your account with every date and assumption recorded.

200 Day Moving Average in Stocks

Recorded from to in USD, against SPY.

Return per year
15.7%
SPY 11.2%
Total return
2,110.4%
SPY 847.4%
Deepest decline
-56.3%
SPY -55.2%
Loading performance chart…
Cumulative change from the start of the selected period. Simulated with adjusted prices and recorded trading costs. The 116-stock list was fixed in 2026 after removing stocks with incomplete histories, which favors companies that survived. Past results do not predict future returns.

How the rule works

Read the return alongside volatility and the deepest decline before comparing it with anything else.

The rule

Universe
A fixed list of 116 large US stocks.
Signal
Each week, stocks trading above their 200-day simple moving average qualify. Stocks already held get priority.
Sizing
Up to 20 positions at 5% of the portfolio each, with a 2% rebalance band. Unused allocation stays in cash.
Costs
Commission, spread and slippage are applied to every simulated trade.

Return and risk

Return and risk statistics
MetricRecorded exampleSPY
Total Returns2,110.4%847.4%
Annualized Returns15.7%11.2%
Volatility20.5%19.1%
Max Drawdown-56.3%-55.2%

Model holdings on

The first ten positions are shown. These are model positions. PyInvesting does not connect to a brokerage or place orders.

See every position and trade
Model holdings at the latest recorded evaluation
AssetWeight
ADP4.9%
AMD5.4%
AMGN5.1%
BDX4.8%
BMY4.7%
CRM4.6%
CSCO5.3%
CSX5.3%
HUM6.8%
INTC4.5%
Cash0%

What to check in your result

Dates and coverage
Read the actual calculation dates and how much price history was available for each instrument.
Return against risk
Compare returns with the benchmark, then look at the deepest decline. A higher return often comes with deeper falls along the way.
Selection and costs
A list of stocks chosen today can favor past winners. Taxes, spreads and your own execution can change the outcome.

These are educational examples, not recommendations or forecasts. A backtest does not prove future profitability.