SMA 200 on SPY self-test, 2026-10-21T09:35:49.051Z 1. Hand-worked series A. daily rule, 3-day average: closes 10 10 10 13 14 9 8 8 8 8; day 2 equals its average (no signal); day 3 above (11) -> buy at the open of day 4 (12); day 5 below (12) -> sell at the open of day 6 (8.5); dividend 0.50 ex day 5 and 0.30 ex day 6 [ok] targets after each close: -1 -1 -1 1 1 0 0 0 -1 -1 [ok] one trade, bought day 4, sold day 6, gross -22.5926% (hand -22.5926%), net minus 0.04 [ok] reference identical [ok] strategy equity 0.77446110 (hand 0.77446110): cash interest by calendar days, c/o on the entry day, (o+d)/c on the exit day, half the cost per fill [ok] buy-and-hold total return 0.87611111 (hand 0.87611111) B. daily rule: a buy at the open of the last day is held to the end (closed at the last close); a signal on the last close is not executed [ok] one open trade from day 6 at 25 to the last close 30: gross 20.0000% [ok] a buy signal on the last close is not executed [ok] reference identical C. monthly rule, 2-month average: month-ends 31 Jan (10), 28 Feb (12) -> above (11), buy at the open of 2 Mar (12.5); 31 Mar (9) -> below (10.5), sell at the open of 1 Apr (9.2); 2 Apr is the last day, not a month-end [ok] targets: -1 -1 -1 1 -1 0 -1 -1 (signals only at month-ends from the second one) [ok] one trade 2 Mar -> 1 Apr, gross -26.4000% (hand -26.4000%) [ok] reference identical D. control: an offset that pushes a trade past the last day drops it; offset 0 returns the same trades [ok] offset 0: same trade; offset 7: dropped (days 11 -> 13, beyond the data); offset 3: days 7 -> 9; offset 9: wraps to days 1 -> 3 2. Real data: engine against the independent reference 8489 days 1993-01-29 .. 2026-10-20; dividends 136; T-bill rate from 2.9% to 4.1% [ok] SMA-D200: 112 trades, reference 112, identical [ok] SMA-M10: 25 trades, reference 25, identical 3. Control at offset 0 [ok] SMA-D200: 111 control trades = the 111 closed real trades [ok] SMA-M10: 24 control trades = the 24 closed real trades PASSED