SPY daily data, 2016 to 2026: the 50-day EMA rule, long and short, lost 19.5% after costs over 191 trades, winning 31.4% of them, against +277.8% for holding SPY. Long only it made 91.1%. The best of 7 runs was 50-day EMA on SPY, long only: +91.1%, held-out survived. Every run, every trade and the script are on this page.
Answers here: Does trading the 200-day moving average work? · Which average is best? · What is the win rate? · Long only, or both ways?
SPY daily data, 4 January 2016 to 23 October 2026, long and short: 191 trades, lost 19.5% after costs, 31.4% of trades won, profit factor 1.01, worst drawdown 40.5%, 97% of the time in the market. Holding SPY returned +277.8% over the same period.
Held out on its own, the last third (16 March 2023 to 23 October 2026) made 17.1% on 62 trades: the rule survived its held-out period.
Long only, the same rule made 91.1% on 95 trades (45.3% won, profit factor 1.92, held-out survived): the short side cost 110.6 points of return in a period when SPY rose 277.8%.
Across all 7 runs on this page, 4 made money after costs, 5 survived the held-out third, and 0 beat holding the symbol (1 had too few trades to judge).
The best run was 50-day EMA on SPY, long only: +91.1% net on 95 trades, profit factor 1.92, worst drawdown 19.1%, held-out survived. The tester's verdict on it reads "real edge so far · check the test period".
Price / Moving Average Cross Strategy, from the strategy library.
Price crossing one moving average: goes long when the close crosses above the average and goes short when it crosses below; the opposite cross closes the trade, and a stop sits 2 ATR away. Four averages were run: the 50-day EMA, the 200-day SMA, the 20-day EMA, and long-only versions of the 200-day SMA and the 50-day EMA.
The indicator itself, with its Pine code drawn on real market data: Moving Average.
Net and holding the symbol are after costs over the same period. Held-out is the verdict on the last third of the history judged alone: survived, decayed, did not survive, or too few trades to judge.
| Symbol | Timeframe | Settings | Direction | Trades | Win rate | Net | Holding | Profit factor | Max drawdown | Held-out |
|---|---|---|---|---|---|---|---|---|---|---|
| SPY | daily | 50-day EMA | long and short | 191 | 31.4% | -19.5% | +277.8% | 1.01 | 40.5% | survived |
| SPY | daily | 200-day SMA | long and short | 58 | 25.9% | +4.4% | +277.8% | 1.37 | 42.2% | survived |
| QQQ | daily | 50-day EMA | long and short | 183 | 24.6% | -21.5% | +542.3% | 1.08 | 53.6% | survived |
| SPY | daily | 20-day EMA | long and short | 321 | 29.0% | -50.0% | +277.8% | 0.85 | 62.0% | did not survive |
| SPY | daily | 200-day SMA | long only | 29 | 31.0% | +91.0% | +277.8% | 3.10 | 23.2% | survived |
| QQQ | daily | 200-day SMA | long only | 17 | 35.3% | +235.8% | +542.3% | 6.63 | 23.3% | too few trades to judge |
| SPY | daily | 50-day EMA | long only | 95 | 45.3% | +91.1% | +277.8% | 1.92 | 19.1% | survived |
50-day EMA on SPY, long and short, the same rule long only, and SPY itself, each calendar year after costs. A partial first or last year counts the sessions it has.
| Year | 50-day EMA, long and short | 50-day EMA, long only | Holding SPY |
|---|---|---|---|
| 2016 | -7.8% | +0.4% | +11.2% |
| 2017 | +8.1% | +13.2% | +18.5% |
| 2018 | -20.4% | -13.0% | -6.9% |
| 2019 | -8.1% | +9.1% | +28.6% |
| 2020 | +4.1% | +14.6% | +15.1% |
| 2021 | +6.2% | +17.0% | +28.8% |
| 2022 | -13.3% | -15.0% | -19.9% |
| 2023 | +4.3% | +14.5% | +24.8% |
| 2024 | -3.6% | +9.8% | +24.0% |
| 2025 | +16.5% | +18.0% | +16.6% |
| 2026 | -3.9% | +3.6% | +11.2% |
The 191 trades of 50-day EMA on SPY, long and short, oldest first: side, entry and exit days, fill prices after slippage, and the return after both commissions. The other runs' trades open below.
| Side | In | Out | Entry | Exit | Return |
|---|---|---|---|---|---|
| short | 2016-05-20 | 2016-05-23 | 204.86 | 205.56 | -0.4% |
| long | 2016-05-23 | 2016-06-20 | 205.56 | 208.76 | +1.5% |
| short | 2016-06-20 | 2016-06-21 | 208.76 | 208.35 | +0.1% |
| long | 2016-06-21 | 2016-06-27 | 208.35 | 201.53 | -3.4% |
| short | 2016-06-27 | 2016-07-01 | 201.53 | 209.42 | -4.0% |
| long | 2016-07-01 | 2016-09-12 | 209.42 | 212.33 | +1.3% |
| short | 2016-09-12 | 2016-09-13 | 212.33 | 214.90 | -1.3% |
| long | 2016-09-13 | 2016-09-14 | 214.90 | 213.23 | -0.9% |
| short | 2016-09-14 | 2016-09-22 | 213.23 | 217.06 | -1.9% |
| long | 2016-09-22 | 2016-09-27 | 217.06 | 213.99 | -1.5% |
| short | 2016-09-27 | 2016-09-28 | 213.99 | 215.89 | -1.0% |
| long | 2016-09-28 | 2016-09-30 | 215.89 | 215.59 | -0.2% |
| short | 2016-09-30 | 2016-10-03 | 215.59 | 215.88 | -0.2% |
| long | 2016-10-03 | 2016-10-05 | 215.88 | 215.35 | -0.3% |
| short | 2016-10-05 | 2016-10-06 | 215.35 | 215.43 | -0.1% |
| long | 2016-10-06 | 2016-10-10 | 215.43 | 216.09 | +0.2% |
| short | 2016-10-10 | 2016-10-11 | 216.09 | 215.72 | +0.1% |
| long | 2016-10-11 | 2016-10-12 | 215.72 | 213.53 | -1.1% |
| short | 2016-10-12 | 2016-11-09 | 213.53 | 212.43 | +0.4% |
| long | 2016-11-09 | 2017-04-17 | 212.43 | 233.04 | +9.6% |
| short | 2017-04-17 | 2017-04-18 | 233.04 | 233.78 | -0.4% |
| long | 2017-04-18 | 2017-04-19 | 233.78 | 234.45 | +0.2% |
| short | 2017-04-19 | 2017-04-21 | 234.45 | 235.32 | -0.5% |
| long | 2017-04-21 | 2017-05-18 | 235.32 | 235.63 | +0.0% |
| short | 2017-05-18 | 2017-05-19 | 235.63 | 237.40 | -0.8% |
| long | 2017-05-19 | 2017-07-07 | 237.40 | 241.14 | +1.5% |
| short | 2017-07-07 | 2017-07-10 | 241.14 | 242.02 | -0.5% |
| long | 2017-07-10 | 2017-08-11 | 242.02 | 243.95 | +0.7% |
| short | 2017-08-11 | 2017-08-15 | 243.95 | 247.05 | -1.4% |
| long | 2017-08-15 | 2017-08-18 | 247.05 | 242.83 | -1.8% |
| short | 2017-08-18 | 2017-08-23 | 242.83 | 244.42 | -0.8% |
| long | 2017-08-23 | 2017-08-25 | 244.42 | 244.83 | +0.1% |
| short | 2017-08-25 | 2017-08-28 | 244.83 | 245.20 | -0.3% |
| long | 2017-08-28 | 2018-02-06 | 245.20 | 259.92 | +5.9% |
| short | 2018-02-06 | 2018-02-16 | 259.92 | 272.39 | -4.9% |
| long | 2018-02-16 | 2018-02-22 | 272.39 | 271.01 | -0.6% |
| short | 2018-02-22 | 2018-02-26 | 271.01 | 276.01 | -1.9% |
| long | 2018-02-26 | 2018-03-02 | 276.01 | 265.72 | -3.8% |
| short | 2018-03-02 | 2018-03-06 | 265.72 | 273.35 | -3.0% |
| long | 2018-03-06 | 2018-03-20 | 273.35 | 270.85 | -1.0% |
| short | 2018-03-20 | 2018-04-18 | 270.85 | 270.77 | -0.1% |
| long | 2018-04-18 | 2018-04-23 | 270.77 | 267.18 | -1.4% |
| short | 2018-04-23 | 2018-05-08 | 267.18 | 266.58 | +0.1% |
| long | 2018-05-08 | 2018-06-26 | 266.58 | 271.56 | +1.8% |
| short | 2018-06-26 | 2018-07-06 | 271.56 | 273.22 | -0.7% |
| long | 2018-07-06 | 2018-10-11 | 273.22 | 277.00 | +1.3% |
| short | 2018-10-11 | 2018-11-08 | 277.00 | 280.22 | -1.3% |
| long | 2018-11-08 | 2018-11-12 | 280.22 | 277.07 | -1.2% |
| short | 2018-11-12 | 2018-12-03 | 277.07 | 280.34 | -1.3% |
| long | 2018-12-03 | 2018-12-06 | 280.34 | 265.84 | -5.3% |
| short | 2018-12-06 | 2019-01-18 | 265.84 | 265.06 | +0.2% |
| long | 2019-01-18 | 2019-05-14 | 265.06 | 281.94 | +6.3% |
| short | 2019-05-14 | 2019-05-17 | 281.94 | 285.22 | -1.3% |
| long | 2019-05-17 | 2019-05-21 | 285.22 | 285.75 | +0.1% |
| short | 2019-05-21 | 2019-05-22 | 285.75 | 285.53 | 0.0% |
| long | 2019-05-22 | 2019-05-24 | 285.53 | 283.66 | -0.8% |
| short | 2019-05-24 | 2019-06-07 | 283.66 | 286.01 | -0.9% |
| long | 2019-06-07 | 2019-08-05 | 286.01 | 288.01 | +0.6% |
| short | 2019-08-05 | 2019-08-09 | 288.01 | 292.66 | -1.7% |
| long | 2019-08-09 | 2019-08-12 | 292.66 | 289.88 | -1.1% |
| short | 2019-08-12 | 2019-08-20 | 289.88 | 291.85 | -0.8% |
| long | 2019-08-20 | 2019-08-21 | 291.85 | 292.39 | +0.1% |
| short | 2019-08-21 | 2019-08-22 | 292.39 | 293.31 | -0.4% |
| long | 2019-08-22 | 2019-08-26 | 293.31 | 287.19 | -2.2% |
| short | 2019-08-26 | 2019-08-30 | 287.19 | 294.30 | -2.6% |
| long | 2019-08-30 | 2019-09-04 | 294.30 | 293.06 | -0.5% |
| short | 2019-09-04 | 2019-09-05 | 293.06 | 296.87 | -1.4% |
| long | 2019-09-05 | 2019-10-02 | 296.87 | 291.43 | -1.9% |
| short | 2019-10-02 | 2019-10-14 | 291.43 | 296.00 | -1.7% |
| long | 2019-10-14 | 2020-02-25 | 296.00 | 323.84 | +9.3% |
| short | 2020-02-25 | 2020-04-15 | 323.84 | 277.64 | +14.2% |
| long | 2020-04-15 | 2020-04-16 | 277.64 | 279.07 | +0.4% |
| short | 2020-04-16 | 2020-04-20 | 279.07 | 282.69 | -1.4% |
| long | 2020-04-20 | 2020-04-22 | 282.69 | 278.27 | -1.7% |
| short | 2020-04-22 | 2020-04-27 | 278.27 | 285.20 | -2.6% |
| long | 2020-04-27 | 2020-05-14 | 285.20 | 278.86 | -2.3% |
| short | 2020-05-14 | 2020-05-15 | 278.86 | 282.45 | -1.4% |
| long | 2020-05-15 | 2020-06-29 | 282.45 | 301.33 | +6.6% |
| short | 2020-06-29 | 2020-06-30 | 301.33 | 304.07 | -1.0% |
| long | 2020-06-30 | 2020-09-21 | 304.07 | 325.61 | +7.0% |
| short | 2020-09-21 | 2020-09-29 | 325.61 | 334.06 | -2.7% |
| long | 2020-09-29 | 2020-10-29 | 334.06 | 326.82 | -2.3% |
| short | 2020-10-29 | 2020-11-05 | 326.82 | 349.34 | -7.0% |
| long | 2020-11-05 | 2021-03-05 | 349.34 | 380.31 | +8.8% |
| short | 2021-03-05 | 2021-03-08 | 380.31 | 384.77 | -1.3% |
| long | 2021-03-08 | 2021-05-13 | 384.77 | 406.96 | +5.7% |
| short | 2021-05-13 | 2021-05-14 | 406.96 | 413.31 | -1.7% |
| long | 2021-05-14 | 2021-09-20 | 413.31 | 434.76 | +5.1% |
| short | 2021-09-20 | 2021-09-24 | 434.76 | 441.56 | -1.7% |
| long | 2021-09-24 | 2021-09-29 | 441.56 | 435.07 | -1.6% |
| short | 2021-09-29 | 2021-10-15 | 435.07 | 444.88 | -2.4% |
| long | 2021-10-15 | 2021-12-01 | 444.88 | 461.51 | +3.6% |
| short | 2021-12-01 | 2021-12-03 | 461.51 | 459.29 | +0.4% |
| long | 2021-12-03 | 2021-12-06 | 459.29 | 456.02 | -0.8% |
| short | 2021-12-06 | 2021-12-07 | 456.02 | 464.54 | -2.0% |
| long | 2021-12-07 | 2021-12-21 | 464.54 | 458.45 | -1.4% |
| short | 2021-12-21 | 2021-12-22 | 458.45 | 462.92 | -1.1% |
| long | 2021-12-22 | 2022-01-14 | 462.92 | 461.06 | -0.5% |
| short | 2022-01-14 | 2022-02-03 | 461.06 | 451.07 | +2.1% |
| long | 2022-02-03 | 2022-02-04 | 451.07 | 446.23 | -1.2% |
| short | 2022-02-04 | 2022-02-10 | 446.23 | 451.46 | -1.3% |
| long | 2022-02-10 | 2022-02-11 | 451.46 | 449.29 | -0.6% |
| short | 2022-02-11 | 2022-03-18 | 449.29 | 438.12 | +2.4% |
| long | 2022-03-18 | 2022-04-12 | 438.12 | 442.96 | +1.0% |
| short | 2022-04-12 | 2022-04-20 | 442.96 | 447.03 | -1.0% |
| long | 2022-04-20 | 2022-04-22 | 447.03 | 436.78 | -2.4% |
| short | 2022-04-22 | 2022-07-21 | 436.78 | 394.27 | +9.6% |
| long | 2022-07-21 | 2022-07-27 | 394.27 | 394.25 | -0.1% |
| short | 2022-07-27 | 2022-07-28 | 394.25 | 402.00 | -2.1% |
| long | 2022-07-28 | 2022-08-29 | 402.00 | 402.09 | -0.1% |
| short | 2022-08-29 | 2022-09-12 | 402.09 | 408.89 | -1.8% |
| long | 2022-09-12 | 2022-09-14 | 408.89 | 394.35 | -3.7% |
| short | 2022-09-14 | 2022-10-26 | 394.35 | 381.72 | +3.1% |
| long | 2022-10-26 | 2022-10-28 | 381.72 | 379.77 | -0.6% |
| short | 2022-10-28 | 2022-10-31 | 379.77 | 386.55 | -1.9% |
| long | 2022-10-31 | 2022-11-03 | 386.55 | 371.37 | -4.0% |
| short | 2022-11-03 | 2022-11-09 | 371.37 | 379.95 | -2.4% |
| long | 2022-11-09 | 2022-11-10 | 379.95 | 387.92 | +2.0% |
| short | 2022-11-10 | 2022-11-11 | 387.92 | 395.70 | -2.1% |
| long | 2022-11-11 | 2022-12-16 | 395.70 | 385.08 | -2.8% |
| short | 2022-12-16 | 2023-01-09 | 385.08 | 390.48 | -1.5% |
| long | 2023-01-09 | 2023-01-20 | 390.48 | 389.98 | -0.2% |
| short | 2023-01-20 | 2023-01-23 | 389.98 | 396.83 | -1.9% |
| long | 2023-01-23 | 2023-02-22 | 396.83 | 399.40 | +0.5% |
| short | 2023-02-22 | 2023-02-24 | 399.40 | 395.52 | +0.9% |
| long | 2023-02-24 | 2023-02-27 | 395.52 | 399.75 | +1.0% |
| short | 2023-02-27 | 2023-03-06 | 399.75 | 405.15 | -1.5% |
| long | 2023-03-06 | 2023-03-08 | 405.15 | 398.28 | -1.8% |
| short | 2023-03-08 | 2023-03-22 | 398.28 | 398.84 | -0.2% |
| long | 2023-03-22 | 2023-03-23 | 398.84 | 394.96 | -1.1% |
| short | 2023-03-23 | 2023-03-30 | 394.96 | 404.20 | -2.4% |
| long | 2023-03-30 | 2023-05-05 | 404.20 | 408.80 | +1.0% |
| short | 2023-05-05 | 2023-05-08 | 408.80 | 413.07 | -1.1% |
| long | 2023-05-08 | 2023-08-17 | 413.07 | 441.04 | +6.7% |
| short | 2023-08-17 | 2023-08-24 | 441.04 | 444.81 | -1.0% |
| long | 2023-08-24 | 2023-08-25 | 444.81 | 438.56 | -1.5% |
| short | 2023-08-25 | 2023-08-29 | 438.56 | 442.77 | -1.1% |
| long | 2023-08-29 | 2023-09-18 | 442.77 | 442.93 | -0.1% |
| short | 2023-09-18 | 2023-11-03 | 442.93 | 433.23 | +2.1% |
| long | 2023-11-03 | 2024-04-16 | 433.23 | 504.80 | +16.4% |
| short | 2024-04-16 | 2024-04-29 | 504.80 | 510.22 | -1.2% |
| long | 2024-04-29 | 2024-05-01 | 510.22 | 501.24 | -1.9% |
| short | 2024-05-01 | 2024-05-06 | 501.24 | 513.89 | -2.6% |
| long | 2024-05-06 | 2024-07-25 | 513.89 | 541.20 | +5.2% |
| short | 2024-07-25 | 2024-07-29 | 541.20 | 546.17 | -1.0% |
| long | 2024-07-29 | 2024-07-31 | 546.17 | 548.83 | +0.4% |
| short | 2024-07-31 | 2024-08-01 | 548.83 | 552.72 | -0.8% |
| long | 2024-08-01 | 2024-08-05 | 552.72 | 511.50 | -7.6% |
| short | 2024-08-05 | 2024-08-14 | 511.50 | 543.02 | -6.3% |
| long | 2024-08-14 | 2024-09-09 | 543.02 | 544.50 | +0.2% |
| short | 2024-09-09 | 2024-09-11 | 544.50 | 548.85 | -0.9% |
| long | 2024-09-11 | 2024-11-01 | 548.85 | 571.17 | +4.0% |
| short | 2024-11-01 | 2024-11-04 | 571.17 | 571.33 | -0.1% |
| long | 2024-11-04 | 2024-12-19 | 571.33 | 591.20 | +3.4% |
| short | 2024-12-19 | 2024-12-23 | 591.20 | 591.05 | -0.1% |
| long | 2024-12-23 | 2024-12-31 | 591.05 | 589.74 | -0.3% |
| short | 2024-12-31 | 2025-01-06 | 589.74 | 596.43 | -1.2% |
| long | 2025-01-06 | 2025-01-08 | 596.43 | 588.54 | -1.4% |
| short | 2025-01-08 | 2025-01-16 | 588.54 | 594.34 | -1.1% |
| long | 2025-01-16 | 2025-02-25 | 594.34 | 597.00 | +0.3% |
| short | 2025-02-25 | 2025-05-02 | 597.00 | 564.84 | +5.3% |
| long | 2025-05-02 | 2025-11-18 | 564.84 | 661.91 | +17.1% |
| short | 2025-11-18 | 2025-11-25 | 661.91 | 668.81 | -1.1% |
| long | 2025-11-25 | 2025-12-18 | 668.81 | 677.42 | +1.2% |
| short | 2025-12-18 | 2025-12-19 | 677.42 | 676.78 | 0.0% |
| long | 2025-12-19 | 2026-01-21 | 676.78 | 679.47 | +0.3% |
| short | 2026-01-21 | 2026-01-22 | 679.47 | 690.03 | -1.7% |
| long | 2026-01-22 | 2026-02-06 | 690.03 | 681.28 | -1.4% |
| short | 2026-02-06 | 2026-02-09 | 681.28 | 689.60 | -1.3% |
| long | 2026-02-09 | 2026-02-13 | 689.60 | 681.50 | -1.3% |
| short | 2026-02-13 | 2026-02-19 | 681.50 | 684.04 | -0.5% |
| long | 2026-02-19 | 2026-02-20 | 684.04 | 682.14 | -0.4% |
| short | 2026-02-20 | 2026-02-23 | 682.14 | 688.00 | -1.0% |
| long | 2026-02-23 | 2026-02-24 | 688.00 | 681.72 | -1.0% |
| short | 2026-02-24 | 2026-02-25 | 681.72 | 690.37 | -1.4% |
| long | 2026-02-25 | 2026-03-04 | 690.37 | 681.45 | -1.4% |
| short | 2026-03-04 | 2026-04-09 | 681.45 | 675.02 | +0.8% |
| long | 2026-04-09 | 2026-06-29 | 675.02 | 736.37 | +9.0% |
| short | 2026-06-29 | 2026-06-30 | 736.37 | 741.49 | -0.8% |
| long | 2026-06-30 | 2026-07-24 | 741.49 | 738.35 | -0.5% |
| short | 2026-07-24 | 2026-07-28 | 738.35 | 739.43 | -0.2% |
| long | 2026-07-28 | 2026-07-30 | 739.43 | 735.86 | -0.6% |
| short | 2026-07-30 | 2026-07-31 | 735.86 | 744.88 | -1.3% |
| long | 2026-07-31 | 2026-09-11 | 744.88 | 764.49 | +2.5% |
| short | 2026-09-11 | 2026-09-14 | 764.49 | 759.19 | +0.6% |
| long | 2026-09-14 | 2026-09-16 | 759.19 | 759.30 | -0.1% |
| short | 2026-09-16 | 2026-09-18 | 759.30 | 761.51 | -0.4% |
| long | 2026-09-18 | 2026-10-19 | 761.51 | 767.03 | +0.6% |
| short | 2026-10-19 | 2026-10-20 | 767.03 | 766.07 | +0.0% |
| long | 2026-10-20 | 2026-10-23 | 766.07 | 759.70 | -0.9% |
| short | 2026-10-23 | 2026-10-23 | 759.70 | 760.10 | -0.2% |
Pine v6, exactly as it ran for 50-day EMA on SPY, long and short. The variants change only the inputs listed in the table.
//@version=6
strategy("Price / MA Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, slippage=1, margin_long=0, margin_short=0)
src = input.source(close, "Source", group="Setup")
len = input.int(50, "MA length", minval=1, group="Setup")
maType = input.string("EMA", "MA type", options=["EMA", "SMA"], group="Setup")
useLong = input.bool(true, "Trade longs", group="Direction")
useShort = input.bool(true, "Trade shorts", group="Direction")
atrLen = input.int(14, "ATR length", minval=1, group="Risk")
stopMult = input.float(0, "Stop (ATR multiples, 0 = off)", minval=0, step=0.5, group="Risk")
// both averages computed every bar, the setting picks one
maE = ta.ema(src, len)
maS = ta.sma(src, len)
ma = maType == "EMA" ? maE : maS
atr = ta.atr(atrLen)
longSig = ta.crossover(close, ma) and barstate.isconfirmed
shortSig = ta.crossunder(close, ma) and barstate.isconfirmed
plot(ma, "Moving average", color=close > ma ? color.new(#16A56A, 0) : color.new(#E5484D, 0), linewidth=2)
if longSig
strategy.close("Short")
if useLong
strategy.entry("Long", strategy.long)
strategy.exit("Long stop", "Long", stop=stopMult > 0 ? close - stopMult * atr : na)
if shortSig
strategy.close("Long")
if useShort
strategy.entry("Short", strategy.short)
strategy.exit("Short stop", "Short", stop=stopMult > 0 ? close + stopMult * atr : na)
Alpaca daily data since 2016, 0.05% commission and 0.025% slippage on every fill, the last third of the history held out, textbook settings and nothing tuned. The engine, fills and what it does not model are written out once, in data and methodology.
Describe the rule in your own words or paste the script. The Free plan writes the Pine v6 script with the AI, runs it on any US stock or ETF with the same costs and the same held-out check, and shows every trade on the chart. No card.
Seventeen popular rules through the same engine, the same costs and the same held-out check, with every trade listed. Next: Golden cross strategy, EMA crossover strategy, Trailing stop strategy.
SPY, daily data, 2016 to 2026, long and short: 50-day EMA lost 19.5% after costs over 191 trades (31.4% won, profit factor 1.01) against +277.8% for holding SPY, and the held-out third survived. Long only it made 91.1%. Across all 7 runs on the page, 4 made money after costs, 5 survived their held-out third and 0 beat holding the stock.
From 24.6% to 45.3% across the 7 runs. The classic setting, 50-day EMA on SPY long and short, won 31.4% of 191 trades. The win rate alone does not decide the result: that run's profit factor was 1.01, so its winners outweighed its losers, and the net return was -19.5%.
Of the 3 settings tested, 50-day EMA on SPY (long only) did best: +91.1% net, profit factor 1.92, held-out survived. That is the best of 7 tries on 10.8 years of daily data of one symbol, which is already a fitted number. A setting that works on one symbol or one period only is a coincidence, not a setting; run it on your own symbol and timeframe before trusting it.
0 of the 7 runs did. SPY itself returned +277.8% between 4 January 2016 and 23 October 2026, so a rule that is out of the market part of the time has a lot to make up; what a timing rule usually gets you is a smaller drawdown, not a bigger return. The classic run's worst drawdown was 40.5% with 97% of the time in the market.
The last third of every run's history (16 March 2023 to 23 October 2026 for the lead run) was judged on its own, with no fitting on it: 5 of 7 runs survived, 0 decayed, 1 did not survive and 1 had too few trades there to judge. Survived means a positive Sharpe ratio on the held-out part at least half the fitted period's; it is a check on one later stretch, not a forecast.
With the free Alpha Charts tester's own engine: the Pine v6 scripts on this page, run on Alpaca daily data since 2016, split-adjusted and not dividend-adjusted, one position at a time with the whole account, fills at the next candle's open, a commission of 0.05% and slippage of 0.025% on every fill, the last third of the history held out. The settings are the textbook ones and every variant is stated; nothing was tuned to make the page look better.
Every number on this page is the output of the Alpha Charts backtest engine on 25 October 2026, on Alpaca market data; the scripts are the strategy library's templates, shown as they ran. Symbols are US-listed ETFs and stocks; results are price returns after the costs stated. Past results are not a forecast and nothing here is investment advice. TradingView and Pine Script belong to TradingView, Inc.; Alpha Charts is not affiliated with it.