sma200.trade
For informational and educational use only. Not investment advice. Past performance does not predict future returns. Read full disclaimer →

Why Your TradingView SMA Doesn't Match Your Backtest

· 7 min read · by Christian

A visitor emailed me a while back to tell me this site was broken. His TradingView chart had SPY sitting above its 200-day moving average. My page said it was below. Same ticker, same day, same rule. Two different answers.

The site wasn't broken. His chart wasn't broken either. They were computing the 200-day average on two different price series, and near a crossover, that gap is enough to flip the signal. This is the single most common "your numbers are wrong" message I get, so it's worth writing down once, properly.

Two closes, two averages

Here's the thing almost nobody tells you: "the closing price" is not one number. There are at least two conventions in wide use, and they diverge over time on any dividend-paying security.

  • Split-adjusted close. This is the price you actually saw on the tape, corrected only for stock splits so a 4-for-1 split doesn't leave a fake cliff in the chart. This is what TradingView, Yahoo Finance, Finviz, and your broker's chart show by default.
  • Total-return (dividend-adjusted) close. This takes the split-adjusted series and back-adjusts every older bar downward by the cumulative dividends paid since. It answers a different question: "what would a dollar invested here be worth if I'd reinvested every distribution?" This is what yfinance gives you with auto_adjust=True, and it's the standard input for an honest backtest.

Run a 200-day simple moving average on each and you get two different lines. Not wildly different. Just different enough.

Why dividends move the average

A dividend doesn't change the price you see on the chart. It changes the adjusted history behind it.

When a fund pays a distribution, the total-return convention marks down all the older bars to reflect that a holder was compounding those payouts. So the total-return series sits slightly below the split-adjusted series in the past, and the gap grows every time another dividend lands inside your lookback window.

A 200-day window on a quarterly payer contains roughly three dividend payments. On SPY or QQQ, that worked out to a gap of about $2 to $3 on the SMA itself. That sounds tiny. It is tiny, until the price is within a couple dollars of the line, which is exactly the moment you care about the signal. That's when a $2 difference in the average is the difference between "above" and "below."

The effect scales with yield. On a low-yield growth name the two lines are nearly on top of each other. On a high-distribution instrument like TLT, the 20+ year Treasury ETF, the dividend drag is a much larger share of total return, so the two conventions pull apart faster. If you're going to get bitten by this, you'll get bitten on the income-heavy tickers first. (TLT's recent extended run below its line is a good case study in how much bonds trip this filter.)

Which one does this site use, and why

sma200.trade computes its moving average on split-adjusted, not dividend-adjusted closes. Plainly: it matches your chart on purpose.

That was a deliberate call, and it's arguably the "less pure" one. When the average diverged from what visitors saw on TradingView, they didn't file it as an interesting methodological nuance. They filed it as "this tool is wrong" and closed the tab. Matching the screen people already trust beats being mathematically cleaner in a vacuum. This is a product you glance at to check a regime, not a quant research terminal. So it shows the same line your broker shows.

Which one your backtest uses, and why

Now flip to the research side of the same repo. Every backtest here runs on total-return closes (auto_adjust=True). That's not inconsistency. It's the right tool for a different job.

A backtest is trying to answer "what would this strategy have actually returned," and returns without reinvested dividends are a lie by omission on any income-paying asset. If you backtest a buy-and-hold on price-only closes, you silently throw away years of distributions and understate the result. The per-fund inception study that sits behind a lot of the numbers on this site runs on total-return series for exactly this reason. When it reports SOXL turning $10k into roughly $2.7M buy-and-hold versus about $577k for the filtered version, those figures only mean anything because dividends are compounded in on both sides.

So the same codebase uses opposite conventions in two places, on purpose:

  • The live signal matches your chart, because its whole value is that you trust it at a glance.
  • The backtest compounds dividends, because its whole value is that the CAGR is honest.

Neither is "correct" in the abstract. They're correct for their jobs.

What to actually do about it

You don't need to pick a camp. You need to stop comparing across conventions without noticing.

  1. Know which line you're looking at. TradingView default, broker chart, Finviz: split-adjusted. yfinance with auto_adjust=True, most tutorial backtests, "adjusted close" in a CSV: total-return. If you never check, you'll eventually diff two of them and conclude something is broken.
  2. Pick one and be consistent within a job. Generate signals and backtest signals on the same series. Mixing them is how you build a backtest you can't actually execute: the entry dates won't line up with the chart you trade off of.
  3. Expect the biggest divergence on high-yield names near a cross. That's the danger zone. A dividend payer sitting within a percent or two of its 200-day line is precisely where the two conventions disagree on the signal.
  4. For a quick regime check, use the chart convention. For "what did this actually earn," use total return. If you keep those two questions separate in your head, the whole confusion evaporates.

The broker angle

There's a practical corner of this that matters if you trade the signal rather than just read it. The convention you can actually fill on is the price convention. Your broker doesn't let you buy the dividend-adjusted phantom price from 2019. So if you're structuring longer-dated exposure, say LEAPS to pull leverage into the option instead of holding a decaying 3x ETF, the entry you get is anchored to real quoted price, and the platform you execute on matters more than the one you read signals on. tastytrade is the one I'd look at for an options-led version of this workflow, mostly for the per-leg commission cap. The full broker shortlist has the honest tradeoffs.

Caveats worth naming

  • Splits still matter to both conventions. Everything above is about dividend adjustment. Both series correct for splits; if you ever see a raw un-split-adjusted feed, that's a third, worse problem.
  • The gap is time-varying. It's near zero right after an ex-dividend date rolls out of the window and largest right before the next one rolls off. Don't treat "$2 to $3 on SPY" as a constant; it's a ballpark for a 200-day window with three payouts in it.
  • Data vendors disagree at the edges. Even two total-return feeds can differ by a few cents from rounding or timing of the ex-date adjustment. If you're chasing a one-cent discrepancy, that's the vendor, not the convention.
  • This is not advice on which line to trade. It's an explanation of why they differ. Which convention fits your process is your call.

Source research

  • LETF Inception Backtest: the total-return methodology behind the site's backtest figures, including the explicit note that it differs from the chart convention shown on ticker pages
  • sma200-bt open-source release: more on dividend handling in deep-history synthetic backtests

Check the current chart-convention SMA200 status on any name: SPY, QQQ, TLT, TQQQ.


Want today's SMA200 status for any US stock? Type a ticker on the homepage →

sma200.trade may earn a commission when you open an account through links in this article. This doesn't change the price you pay or our editorial recommendations.