The test I ran
I took the 160-day illustrative close series from Foundations and applied three rules. Rule A is buy and hold. Rule B is long the series when yesterday’s close is above yesterday’s 50-day SMA, else cash. Rule C is a 20 / 50 crossover: long when SMA-20 is above SMA-50. Fills are the next day, as described in Architecture. Cash earns nothing. I am showing this as a methods check, not as a live track record.
The idea is the same one Faber (2007) used on monthly index data with a 10-month average, and the same family Brock et al. (1992) studied on the Dow. My window is much shorter and the path is constructed, so the numbers are for the graphs on this page only.
Navy = long · Paper = cash · After day 50. Time in the market: 19% (21 of 111 days).
Day 50 → 160
Numbers from this path
Buy and hold (illustrative)
−6.5%
Max drop −10.4% · flips 1 · after 5 bp −6.5%
SMA-50 long/cash
−3.3%
Max drop −4.3% · flips 12 · after 5 bp −3.9%
SMA-20 / SMA-50 cross
−1.1%
Max drop −2.9% · flips 4 · after 5 bp −1.3%
| Rule | Total return | Max drop | Flips | After 5 bp |
|---|---|---|---|---|
| Buy and hold (illustrative) | −6.5% | −10.4% | 1 | −6.5% |
| SMA-50 long/cash | −3.3% | −4.3% | 12 | −3.9% |
| SMA-20 / SMA-50 cross | −1.1% | −2.9% | 4 | −1.3% |
Table 2. This path ends below its start, so sitting still lost money (−6.5%) and also took the worst peak-to-trough drop (−10.4%). The 50-day long/cash rule was long on 21 of 111 days after warmup (19% of the ready sample). It returned −3.3% and fell −4.3%. The 20 / 50 cross returned −1.1%, fell −2.9%, and flipped 4 times — fewer flips than price-versus-SMA-50, because two averages are smoother than price against one average.
I almost wrote the textbook sentence here: “the fast rule whipped more and did worse.” On this path that sentence is false. The crossover was calmer, and cash helped every rule that used it. A 5-basis-point haircut per flip does not reverse the ranking versus buy-and-hold. That is still not a reason to prefer any of these lines. It is a reason to read the table before writing the moral.
Walk one day
A table of totals hides the actual decision. The control below is the same rule as Table 2, one close at a time. If close is above SMA-50, the signal is long; otherwise cash. Tomorrow’s position is this signal. Drag the day through the mid-sample dip if you want to see the rule sell late, then buy a bounce, then get knocked out again.
Walk the tape
Day 96
Signal is computed at this close. The fill, if any, is the next open — the same delay used in the backtest.
CASH
Close
95.13
SMA-50
96.71
Close − SMA
−1.58
What went wrong on purpose
Around the middle of the sample the price drops, bounces, drops again. The 50-day average is still high, so the rule sells late. Then price pokes above the average and the rule buys, then the second dip knocks it back to cash. That extra round trip is a whipsaw. It is the standard failure mode of trend rules in a range (Quantpedia, 2023). A student looking only at the “sold before the crash” part of Figure 8 would miss this. The barcode above the table is the honest picture: long, cash, long, cash.
RSI told a similar story. During the drop, RSI-14 spent time under 30. If I had bought those oversold prints I would have been catching a falling series, not fading a finished move. That is why I did not combine “RSI under 30 means buy” with a downtrend filter in this first pass. Mean-reversion and trend-following fight each other unless you say when each one is allowed to speak.
How this sits next to published work
Faber’s 10-month SMA overlay is famous because, in his long sample, it reduced drawdowns in equity indexes while keeping most of the upside (Faber, 2007). Siegel’s discussion of a 200-day rule on the Dow is in the same family (cited in Quantpedia, 2023). My table is not a replication of those papers. I do not have 1886–2006 of the Dow on this site. I only wanted to see the same shape — a filter that sits out, a cost for being late, some extra trades — show up in a tiny example I fully control.
Brock, Lakonishok, and LeBaron (1992) is the citation I keep coming back to for the crossover itself. They were asking whether simple rules had statistical content, not whether a computer-engineering student should trade them with rent money. I am asking the smaller question: can I implement the rule without cheating on time, and does the picture look like the story in those papers? The slow rule did sit out part of the drop. The impatient story I had in my head about the crossover did not survive contact with this path.
Conclusion
The research question was not “does SMA beat the market.” It was: how does a trading program take in data and decide to act, and can I show that path without hiding the mistakes? Three answers survived this pass.
I
The clock is the design
A window of closes, a comparison, and a one-day wait. Same-close fills made the pictures prettier and the study false.
II
Cash did real work here
The sample ends down. Buy-and-hold lost −6.5%. Any rule that sat out part of the dip lost less. That is this path, not a ranking of averages.
III
RSI is a thermometer
It described the drop. It was not a buy button. Trend and mean-reversion need a rule for who speaks.
First, the decision is not a feeling. It is a function of a window of closes, a comparison, and a clock. If the clock is wrong — if I trade on the same close I just used to compute the average — the whole study is fiction. Fixing that delay taught me more than changing n from 50 to 40.
Second, on this constructed path a long/cash filter did the boring thing the papers describe: it sat out part of the drop and it gave up part of the bounce. Because the sample finishes lower than it starts, cash also cut the total loss. The 20 / 50 crossover flipped less than price-versus-SMA-50, which is the opposite of the story I expected. I am leaving that in the table. A beginner study that edits the moral until the numbers agree with a blog post is not a study.
Third, I cannot claim an edge. I can claim I now know what a beginner pipeline has to contain: a file of bars, a formula that only looks backward, a one-day wait, a cost line, and a chart of both return and damage. That is the whole machine, drawn small.
A slow average did not make me clever. It made the lag visible. Seeing the lag, and refusing to trade through it, is the actual finding.
What I can defend in one minute
If I had to say this out loud: I built a program that reads daily closes, waits until it has fifty of them, compares close to that average, and waits until the next open to act. On a made-up path that dips and does not fully recover, sitting in cash some of the time hurt less than sitting through the whole dip. Buy-and-hold returned −6.5% and fell −10.4%. The 50-day rule returned −3.3%, fell −4.3%, and was long 19% of the ready days. Twelve flips at five basis points is about 0.6 of a percentage point — not enough to reverse that comparison, enough to notice.
I will not take any of that as a reason to trade. I will take it as a reason to keep the clock honest, to print drawdown next to return, and to write down what would count as failure before I touch a real ticker. That last habit is the one I did not have when I started this notebook.
What I would do next
If this were a second semester I would point the same code at a real ticker (SPY or the S&P total-return series), park cash in a T-bill proxy, keep the 5-basis-point cost, and split the sample: choose n on one decade, report the next decade untouched. I would not add a fourth indicator until that walk-forward was honest.
I would also write down, before seeing the hold-out, what would count as failure: if the slow rule does not cut drawdown relative to buy-and-hold after costs, I would stop, not retune n until it does. That is the opposite of how I started this notebook, and it is the habit I want to keep.
| Claim I might want | What this notebook can actually say |
|---|---|
| SMA timing has an edge | Not shown. One constructed path, no hold-out. |
| Slow filters reduce pain | On this path, yes: −4.3% versus −10.4% for buy-and-hold. |
| Faster crossovers whip more | On this path, no: 4 flips versus 12 for price vs SMA-50. |
| RSI < 30 is a buy | Rejected. It marked the drop, not the bottom. |
| The pipeline is honest | Yes, if fills stay at t + 1 and the first n days stay blank. |
Until a walk-forward on real prices exists, this website is a public notebook of how the algorithm processes data — not a reason to put money on these lines.
Limits
- One constructed series. No other tickers, no other decades.
- No dividends, no T-bill rate when in cash, one small cost number.
- No walk-forward, no hold-out year, no statistical test of edge.
- Charts on this website are for teaching the pipeline.
None of this is investment advice. It is a write-up of a beginner study on how a trading program processes data and decides to act.