SPY (SPDR S&P 500 ETF) SMA(50)/SMA(200) crossover strategy

Backtest a SPY (SPDR S&P 500 ETF) crossover strategy: it buys when 50-day SMA crosses above 200-day SMA, it sells when 50-day SMA falls below 200-day SMA. No leverage applied. Uninvested cash earns 4.0% risk-free interest.

Backtest Assumptions and Key Details

  • If the strategy involves regular stock positions, we use the adjusted close price for backtesting. This reflects total return by incorporating dividends.
  • If the strategy uses call options to simulate leveraged exposure, we instead use the close price (not adjusted), because dividends are not received when holding options.
  • When using call options, we simulate time decay in a simplified way. You can specify a time decay rate (e.g., 3%), which means that if the stock price stays flat for one year, the strategy loses 3% of the current stock price per share of exposure due to decay.
  • If leverage is applied via margin borrowing, we enforce a 25% maintenance margin requirement (as set by FINRA). This places a hard cap at 4x leverage, beyond which a margin call is immediate. In practice, 3x leverage is the more realistic limit, since the risk of a margin call increases sharply beyond that.
  • All trades are assumed to execute at the closing price on the day a signal occurs.
  • The backtest includes realistic cash flow effects, such as interest earned on idle cash and borrowing costs incurred when using margin.

Performance Overview

Portfolio Value Trend (Normalized)

1993-01-29 - $10,000.00 2025-07-04 - $255,080.60

Over 32.43 years, portfolio value grew from $10,000.00 to $255,080.60.

Beginning with an initial investment of $10,000.00 on 1993-01-29, the portfolio value reached a value of $255,080.60 by 2025-07-04. This represents a 2,450.81% total gain over 32.43 years, equivalent to 10.50% annualized. This return is closely aligned with the typical long-term growth rates of diversified equity investments โ€” a realistic and respectable outcome for a passive strategy.

Drawdown and Risk

The maximum drawdown recorded during this period was 33.72%. This drawdown began after a peak portfolio value of $169,707.79 on 2020-02-19, and reached its lowest point on 2020-03-23 when the portfolio value fell to $112,486.98. The drawdown lasted for 33 days.

Maximum Drawdown

๐Ÿ“ˆ 2020-02-19 - $169,707.79 ๐Ÿ“‰ 2020-03-23 - $112,486.98

Max drawdown: 33.72% over 33 days.

The drawdown was moderate and aligns with the type of volatility observed in many broad market assets over extended periods. The maximum drawdown lasted over a month, which is fairly common during pullbacks or short-term volatility spikes.

The Calmar Ratio โ€” annualized return divided by maximum drawdown โ€” was 0.31, reflecting the tradeoff between return and volatility. A moderate return-to-risk profile. The strategy handled risk reasonably well while delivering decent returns.

What the Strategy Suggests Today

The 50-day SMA is $587.19, and the 200-day SMA is $582.67, for a difference of $4.53. The current stock price is $625.34, and 0.0% of that is $0.00. Since the difference is sufficient and exceeds the threshold, the buy signal is active.

The 50-day SMA is $587.19, and the 200-day SMA is $582.67, for a difference of $4.53. The current stock price is $625.34, and 0.0% of that is $0.00. Since the difference is insufficient and does not exceed the threshold, the sell signal is not active.

If you have been following this strategy, you are currently holding stocks or call options. No sell signal is active. The strategy suggests continuing to hold the current position.

Transaction Timeline

We began our backtest on 1993-01-29 with $10,000.00 starting capital.

On 1993-04-13, the 50-day SMA at $44.71 crossed above the 200-day SMA at $44.69, exceeding it by 0% of the stock price ($45.00). Since we can receive dividends, we use the adjusted close price($25.09) for calculation. We invested $10,079.78 โ€” which includes $79.78 in interest earned while holding cash for 74 days โ€” gaining exposure to 401.78 equivalent shares.

On 1993-04-26, the 50-day SMA at $44.65 fell below the 200-day SMA at $44.65 by 0% of the stock price ($43.41), triggering our exit. Since we can receive dividends, we use the adjusted close price($24.20) for calculation. After holding the position for 13 days, we exited leaving $9,722.78 in available cash.

On 1993-04-28, the 50-day SMA at $44.64 crossed above the 200-day SMA at $44.62, exceeding it by 0% of the stock price ($43.78). Since we can receive dividends, we use the adjusted close price($24.41) for calculation. We invested $9,724.87 โ€” which includes $2.09 in interest earned while holding cash for 2 days โ€” gaining exposure to 398.42 equivalent shares.

On 1993-05-25, the 50-day SMA at $44.59 fell below the 200-day SMA at $44.59 by 0% of the stock price ($45.03), triggering our exit. Since we can receive dividends, we use the adjusted close price($25.11) for calculation. After holding the position for 27 days, we exited leaving $10,002.53 in available cash.

On 1993-06-21, the 50-day SMA at $44.69 crossed above the 200-day SMA at $44.69, exceeding it by 0% of the stock price ($44.59). Since we can receive dividends, we use the adjusted close price($25.04) for calculation. We invested $10,031.57 โ€” which includes $29.04 in interest earned while holding cash for 27 days โ€” gaining exposure to 400.66 equivalent shares.

On 1993-06-22, the 50-day SMA at $44.68 fell below the 200-day SMA at $44.69 by 0% of the stock price ($44.63), triggering our exit. Since we can receive dividends, we use the adjusted close price($25.06) for calculation. After holding the position for 1 days, we exited leaving $10,038.60 in available cash.

On 1993-07-02, the 50-day SMA at $44.71 crossed above the 200-day SMA at $44.70, exceeding it by 0% of the stock price ($44.69). Since we can receive dividends, we use the adjusted close price($25.09) for calculation. We invested $10,049.39 โ€” which includes $10.79 in interest earned while holding cash for 10 days โ€” gaining exposure to 400.53 equivalent shares.

On 1994-04-19, the 50-day SMA at $46.23 fell below the 200-day SMA at $46.25 by 0% of the stock price ($44.36), triggering our exit. Since we can receive dividends, we use the adjusted close price($25.38) for calculation. After holding the position for 291 days, we exited leaving $10,164.77 in available cash.

On 1994-09-14, the 50-day SMA at $46.19 crossed above the 200-day SMA at $46.18, exceeding it by 0% of the stock price ($47.05). Since we can receive dividends, we use the adjusted close price($27.09) for calculation. We invested $10,327.60 โ€” which includes $162.84 in interest earned while holding cash for 148 days โ€” gaining exposure to 381.18 equivalent shares.

On 1998-09-29, the 50-day SMA at $106.69 fell below the 200-day SMA at $106.72 by 0% of the stock price ($104.94), triggering our exit. Since we can receive dividends, we use the adjusted close price($65.56) for calculation. After holding the position for 1476 days, we exited leaving $24,989.38 in available cash.

On 1998-12-08, the 50-day SMA at $109.69 crossed above the 200-day SMA at $109.60, exceeding it by 0% of the stock price ($118.41). Since we can receive dividends, we use the adjusted close price($73.97) for calculation. We invested $25,177.92 โ€” which includes $188.55 in interest earned while holding cash for 70 days โ€” gaining exposure to 340.37 equivalent shares.

On 1999-11-04, the 50-day SMA at $131.70 fell below the 200-day SMA at $131.73 by 0% of the stock price ($136.53), triggering our exit. Since we can receive dividends, we use the adjusted close price($86.29) for calculation. After holding the position for 331 days, we exited leaving $29,369.77 in available cash.

On 1999-11-11, the 50-day SMA at $132.08 crossed above the 200-day SMA at $132.06, exceeding it by 0% of the stock price ($138.50). Since we can receive dividends, we use the adjusted close price($87.53) for calculation. We invested $29,391.86 โ€” which includes $22.08 in interest earned while holding cash for 7 days โ€” gaining exposure to 335.78 equivalent shares.

On 2000-10-30, the 50-day SMA at $144.37 fell below the 200-day SMA at $144.45 by 0% of the stock price ($140.53), triggering our exit. Since we can receive dividends, we use the adjusted close price($89.70) for calculation. After holding the position for 354 days, we exited leaving $30,118.16 in available cash.

On 2003-05-15, the 50-day SMA at $88.85 crossed above the 200-day SMA at $88.68, exceeding it by 0% of the stock price ($95.11). Since we can receive dividends, we use the adjusted close price($62.90) for calculation. We invested $33,270.53 โ€” which includes $3,152.37 in interest earned while holding cash for 927 days โ€” gaining exposure to 528.94 equivalent shares.

On 2004-08-18, the 50-day SMA at $111.31 fell below the 200-day SMA at $111.39 by 0% of the stock price ($110.03), triggering our exit. Since we can receive dividends, we use the adjusted close price($74.18) for calculation. After holding the position for 461 days, we exited leaving $39,239.53 in available cash.

On 2004-11-05, the 50-day SMA at $112.46 crossed above the 200-day SMA at $112.40, exceeding it by 0% of the stock price ($117.28). Since we can receive dividends, we use the adjusted close price($79.40) for calculation. We invested $39,573.83 โ€” which includes $334.29 in interest earned while holding cash for 79 days โ€” gaining exposure to 498.40 equivalent shares.

On 2006-07-19, the 50-day SMA at $126.41 fell below the 200-day SMA at $126.53 by 0% of the stock price ($125.69), triggering our exit. Since we can receive dividends, we use the adjusted close price($88.00) for calculation. After holding the position for 621 days, we exited leaving $43,857.96 in available cash.

On 2006-09-11, the 50-day SMA at $127.98 crossed above the 200-day SMA at $127.96, exceeding it by 0% of the stock price ($130.41). Since we can receive dividends, we use the adjusted close price($91.30) for calculation. We invested $44,113.01 โ€” which includes $255.06 in interest earned while holding cash for 54 days โ€” gaining exposure to 483.15 equivalent shares.

On 2007-12-21, the 50-day SMA at $148.84 fell below the 200-day SMA at $148.91 by 0% of the stock price ($148.13), triggering our exit. Since we can receive dividends, we use the adjusted close price($106.68) for calculation. After holding the position for 466 days, we exited leaving $51,541.73 in available cash.

On 2009-06-23, the 50-day SMA at $90.18 crossed above the 200-day SMA at $90.08, exceeding it by 0% of the stock price ($89.35). Since we can receive dividends, we use the adjusted close price($66.74) for calculation. We invested $54,677.50 โ€” which includes $3,135.77 in interest earned while holding cash for 550 days โ€” gaining exposure to 819.24 equivalent shares.

On 2010-07-06, the 50-day SMA at $111.05 fell below the 200-day SMA at $111.35 by 0% of the stock price ($102.87), triggering our exit. Since we can receive dividends, we use the adjusted close price($78.31) for calculation. After holding the position for 378 days, we exited leaving $64,157.09 in available cash.

On 2010-10-22, the 50-day SMA at $112.47 crossed above the 200-day SMA at $112.37, exceeding it by 0% of the stock price ($118.35). Since we can receive dividends, we use the adjusted close price($90.58) for calculation. We invested $64,905.48 โ€” which includes $748.38 in interest earned while holding cash for 108 days โ€” gaining exposure to 716.55 equivalent shares.

On 2011-08-12, the 50-day SMA at $128.47 fell below the 200-day SMA at $128.73 by 0% of the stock price ($118.12), triggering our exit. Since we can receive dividends, we use the adjusted close price($91.73) for calculation. After holding the position for 294 days, we exited leaving $65,727.16 in available cash.

On 2012-01-31, the 50-day SMA at $125.93 crossed above the 200-day SMA at $125.89, exceeding it by 0% of the stock price ($131.32). Since we can receive dividends, we use the adjusted close price($103.16) for calculation. We invested $66,952.41 โ€” which includes $1,225.25 in interest earned while holding cash for 172 days โ€” gaining exposure to 649.04 equivalent shares.

On 2015-08-28, the 50-day SMA at $207.46 fell below the 200-day SMA at $207.62 by 0% of the stock price ($199.28), triggering our exit. Since we can receive dividends, we use the adjusted close price($167.99) for calculation. After holding the position for 1305 days, we exited leaving $109,031.65 in available cash.

On 2015-12-17, the 50-day SMA at $206.41 crossed above the 200-day SMA at $206.33, exceeding it by 0% of the stock price ($204.86). Since we can receive dividends, we use the adjusted close price($173.59) for calculation. We invested $110,339.03 โ€” which includes $1,307.38 in interest earned while holding cash for 111 days โ€” gaining exposure to 635.63 equivalent shares.

On 2016-01-11, the 50-day SMA at $205.73 fell below the 200-day SMA at $205.85 by 0% of the stock price ($192.11), triggering our exit. Since we can receive dividends, we use the adjusted close price($163.75) for calculation. After holding the position for 25 days, we exited leaving $104,087.58 in available cash.

On 2016-04-25, the 50-day SMA at $201.80 crossed above the 200-day SMA at $201.55, exceeding it by 0% of the stock price ($208.61). Since we can receive dividends, we use the adjusted close price($178.74) for calculation. We invested $105,267.83 โ€” which includes $1,180.25 in interest earned while holding cash for 105 days โ€” gaining exposure to 588.96 equivalent shares.

On 2018-12-07, the 50-day SMA at $275.48 fell below the 200-day SMA at $275.92 by 0% of the stock price ($263.57), triggering our exit. Since we can receive dividends, we use the adjusted close price($237.01) for calculation. After holding the position for 956 days, we exited leaving $139,590.27 in available cash.

On 2019-04-01, the 50-day SMA at $275.65 crossed above the 200-day SMA at $275.37, exceeding it by 0% of the stock price ($285.83). Since we can receive dividends, we use the adjusted close price($259.67) for calculation. We invested $141,324.76 โ€” which includes $1,734.49 in interest earned while holding cash for 115 days โ€” gaining exposure to 544.25 equivalent shares.

On 2020-03-30, the 50-day SMA at $301.39 fell below the 200-day SMA at $302.42 by 0% of the stock price ($261.65), triggering our exit. Since we can receive dividends, we use the adjusted close price($242.56) for calculation. After holding the position for 364 days, we exited leaving $132,012.64 in available cash.

On 2020-07-09, the 50-day SMA at $302.49 crossed above the 200-day SMA at $302.13, exceeding it by 0% of the stock price ($314.38). Since we can receive dividends, we use the adjusted close price($292.72) for calculation. We invested $133,452.19 โ€” which includes $1,439.56 in interest earned while holding cash for 101 days โ€” gaining exposure to 455.90 equivalent shares.

On 2022-03-14, the 50-day SMA at $445.23 fell below the 200-day SMA at $445.62 by 0% of the stock price ($417.00), triggering our exit. Since we can receive dividends, we use the adjusted close price($396.71) for calculation. After holding the position for 613 days, we exited leaving $180,858.96 in available cash.

On 2023-02-02, the 50-day SMA at $394.35 crossed above the 200-day SMA at $394.25, exceeding it by 0% of the stock price ($416.78). Since we can receive dividends, we use the adjusted close price($402.93) for calculation. We invested $187,282.26 โ€” which includes $6,423.30 in interest earned while holding cash for 325 days โ€” gaining exposure to 464.80 equivalent shares.

On 2025-04-14, the 50-day SMA at $573.31 fell below the 200-day SMA at $573.83 by 0% of the stock price ($539.12), triggering our exit. Since we can receive dividends, we use the adjusted close price($537.53) for calculation. After holding the position for 802 days, we exited leaving $249,842.37 in available cash.

On 2025-07-01, the 50-day SMA at $583.10 crossed above the 200-day SMA at $582.04, exceeding it by 0% of the stock price ($617.65). Since we can receive dividends, we use the adjusted close price($617.65) for calculation. We invested $251,943.80 โ€” which includes $2,101.43 in interest earned while holding cash for 78 days โ€” gaining exposure to 407.91 equivalent shares.

As of 2025-07-04, we hold 407.91 shares without leverage. The net liquidation value of $255,080.60 reflects proceeds after repaying all borrowed funds and interest.