Back to blog
methodology

How to chart relative strength against the S&P 500

18 November 2026 6 min read

Quick answer

To chart relative strength against the S&P 500, divide the stock's close by the S&P 500's close on the same day, rebase the ratio to 100 on your start date, and plot it on a log scale. A rising line means it is outperforming the index. Because both are usually price series, the ratio understates high-dividend names by roughly their yield gap each year, so label it as a price ratio or use total return data.

To chart relative strength against the S&P 500, divide the stock's (or index's) closing price by the S&P 500's close on the same day, rebase the result to 100 on your start date, and plot it on a log scale. A rising line means it is beating the index; a falling line means it is lagging, even if its own price is going up. Two things the usual guides skip will change what the chart says: the log axis, and the dividends a price ratio leaves out.

What the line is

The relative strength line, which StockCharts calls the price relative, is just a ratio: price of A divided by price of B, day by day. It says nothing about whether A went up. It says whether A went up more than B.

That makes it easy to confuse with the RSI, which shares the name and nothing else. Wilder's Relative Strength Index is a momentum oscillator computed from one series' own gains and losses, bounded between 0 and 100. The comparative line here has no bounds and needs two series. If a screen labels something "RS" without saying which, check before you read it. (If it is the RSI and your number disagrees with someone else's, that post covers why.)

The raw ratio's level means nothing on its own. A stock at $40 against an index at 7,340 gives 0.0054, which nobody can read. Divide the whole series by its first value and multiply by 100, and the line starts at 100 and reads directly: 135 means A has outperformed by 35% since the start date.

Why the axis has to be logarithmic

A ratio is a multiplicative thing, so equal percentage moves should take up equal height on the chart. On a linear axis they do not, and the eye gets the story wrong.

The Nasdaq Composite against the S&P 500 shows it. From 16 December 1975 to 10 June 1983 the ratio rose 129%, from 0.845 to 1.938. From 12 February 2021 to 28 December 2022 it fell 24.6%, from 3.582 to 2.700. On a linear axis those two moves are drawn at almost the same height (1.09 against 0.88), so a more-than-doubling from 1975 to 1983 looks no bigger than a quarter lost in the 2020s. On a log axis the 1975 to 1983 rise is nearly three times as tall, which is what it was.

The log axis also keeps the arithmetic of losses honest. The ratio fell 60.9% from its March 2000 peak to October 2002 and has since risen 134.4%, yet on 17 November 2026 it was still 8.4% below the peak, because undoing a 61% loss takes a gain of about 156%. Use the log scale and say so in the axis label.

A worked example: Nasdaq Composite against the S&P 500, 1975 to 2026

Data: daily closes of the Nasdaq Composite from FRED (series NASDAQCOM) and of the S&P 500 from Cboe's SPX history file, joined on the 13,078 days both have, 2 January 1975 to 17 November 2026. (FRED's own S&P 500 series now only goes back a year, which the S&P 500 data post explains.)

The ratio started at 0.864 (60.70 against 70.23). Its all-time high is the dot-com peak, 3.619 on 10 March 2000, with the Nasdaq at 5,048.62 and the S&P 500 at 1,395.07. The low after the bust was 1.414 on 8 October 2002. The closest it has come since is 3.582 on 12 February 2021, and on 17 November 2026 it stood at 3.314 (24,328.38 against 7,340.53).

So the Nasdaq has never regained its 2000 high relative to the S&P 500, in more than twenty-six years, although its price is nearly five times its 2000 peak. That is exactly the kind of finding a price chart hides and a ratio chart shows.

Shorter windows tell their own stories. Over the ten years to 17 November 2026 the Nasdaq rose 356.1% and the S&P 500 235.6%, so the ratio rose 35.9%; rebased to 100 on 17 November 2016, the line ends at 135.9. Over the last year it went the other way: Nasdaq up 7.14%, S&P 500 up 10.01%, ratio down 2.62%, and a line rebased a year ago ends at about 97 even though both indexes rose.

import pandas as pd

spx = pd.read_csv(
    "https://cdn.cboe.com/api/global/us_indices/daily_prices/SPX_History.csv",
    parse_dates=["DATE"], date_format="%m/%d/%Y",
).set_index("DATE")["SPX"]
nasdaq = pd.read_csv(
    "https://fred.stlouisfed.org/graph/fredgraph.csv?id=NASDAQCOM",
    parse_dates=["observation_date"], na_values=".",
).set_index("observation_date")["NASDAQCOM"]

both = pd.concat([nasdaq, spx], axis=1, join="inner").dropna()
ratio = both["NASDAQCOM"] / both["SPX"]
rebased = 100 * ratio / ratio.iloc[0]  # 100 = the start date

print(ratio.idxmax().date(), round(ratio.max(), 3), round(ratio.iloc[-1], 3))
# 2000-03-10 3.619 3.314
ax = rebased.plot(logy=True, title="Nasdaq Composite / S&P 500, rebased to 100")

The inner join matters. If one series has a holiday the other does not, a forward fill would invent a ratio for a day one market was shut.

The dividend problem in a price ratio

Both series above are price indexes, and so is almost every free stock price feed. A price ratio therefore compares price returns, not what a holder earned, and it penalizes whichever side pays the bigger dividend.

The bias is roughly the difference in yields, every year. Take a stock yielding 4% against an index yielding about 1.1% (the S&P 500's yield was 1.07% in September 2026, from Shiller's data). If the two earn identical total returns, the stock's price has to lag by close to 2.9 points a year, because that much is being paid out instead of left in the price. Over ten years that compounds to a price ratio about a quarter lower, for two investments that did exactly as well as each other. The numbers here are illustrative arithmetic, not a measured case, but the direction is not in doubt.

For low-yield growth names against the index, the bias is small and usually ignorable. For utilities, banks, REITs or anything income-heavy, it is not. Either use total return series on both sides (adjusted closes, if your source's adjustment method is documented) or label the chart "price ratio" so nobody reads it as performance.

Choosing what to divide by

The S&P 500 is the default benchmark, not always the right one. A small-cap stock against a large-cap index mixes the stock's story with the size factor. A sector ETF against the index tells you about the sector, and a stock against its own sector ETF tells you about the stock. Pick the benchmark that answers the question you are asking, and put its name in the chart title.

Use the same closing time on both sides. An index close and a stock's official close line up; a US stock divided by a European index's close does not, because the European close is hours earlier. And when the chart compares many names against one benchmark, rebase them all on the same date. The rolling beta and rolling correlation posts use the same discipline for the same reason.

Where Quadesto fits

The worked example above is two free files and one ratio. Quadesto takes data like that, from a CSV upload or a connected source such as FRED, to a chart you can publish as a live embed, and on Creator and Pro a scheduled refresh keeps the line current without anyone rerunning a script. Start free.

Ready to try Quadesto?

Connect your data. AI builds the charts. Embed anywhere.

Get Started Free
relative strengthratio charts&p 500nasdaqpython