I think it would be useful to have a chart that shows how much a specific share out- or under-performs the composite index, e.g. Apple compared to the Nasdaq-100. I think (though I may be naive about this) that this would allow me to see how much of the share price movement is due to the particular share, and how much is due to market conditions.

Is there a website or software that does this? On Google Finance, for example, I can compare Apple to Nasdaq, and this gives me two curves that move more or less in tandem at the moment. What I would like is to basically subtract them from each other, and only see an Apple curve moving around a horizontal line.

Does such software exist? Is this even remotely useful?

  • Be careful here as Apple is a member of multiple indices including the S & P 500 and Russell 1000 that could also be considered "the stock market" while still focusing on large US companies. Other indices would include total market indices and thus I'd suggest doing more research to determine what parts of the market are you wanting as well as what time frame are you wanting to consider here.
    – JB King
    Commented May 8, 2013 at 14:17
  • If you have never written a line of code, even this simple one liner will require work. (Close(APPL)-Close(QQQ)). And it really isn't that simple anyway if you are trying to make a strategy to profit...
    – BAR
    Commented Feb 6, 2015 at 21:37
  • @BAR Uh... I think you would at least need to normalize prices otherwise you're probably going to end up with negative prices at some point.
    – user12515
    Commented Dec 16, 2019 at 23:40

4 Answers 4


The portion of a stock movement not correlated with stocks in general is called Alpha. I don't know of any online tools to graph alpha.

Keep in mind that a company like Apple is so huge right now that any properly weighted index will have to correlate with it to some degree.

  • Can you elaborate more on why alpha refers to correlation? For example, a CEF using leverage investments in an equity fund could achieve returns above that of the S&P500 (high alpha) but could still be highly correlated with the index. The terms are certainly related, but I'm not sure they're synonymous. I think the OP is really asking two questions, one of which relates to alpha, the other of which relates to correlation and detrending. Commented May 25, 2013 at 15:44
  • You're probably right; I'm just a hobbyist at security analysis. Fortunately this stuff is mostly offtopic for personal finance.
    – jldugger
    Commented May 28, 2013 at 18:03


As others have pointed out, the value of Apple's stock and the NASDAQ are most likely highly correlated for a number of reasons, not least among them the fact that Apple is part of the NASDAQ. However, because numerous factors affect the entire market, or at least a significant subset of it, it makes sense to develop a strategy to remove all of these factors without resorting to use of an index. Using an index to remove the effect of these factors might be a good idea, but you run the risk of potentially introducing other factors that affect the index, but not Apple. I don't know what those would be, but it's a valid theoretical concern.

In your question, you said you wanted to

subtract them from each other, and only see an Apple curve moving around a horizontal line.

The basic strategy I plan to use is similar but even simpler. Instead of graphing Apple's stock price, we can plot the difference between its stock price on business day t and business day t-1, which gives us this graph, which is essentially what you're looking for:

daily change in closing price

While this is only the preliminaries, it should give you a basic idea of one procedure that's used extensively to do just what you're asking. I don't know of a website that will automatically give you such a metric, but you could download the price data and use Excel, Stata, etc. to analyze this.

Technical background

The reasoning behind this methodology builds heavily on time series econometrics, which for the sake of simplicity I won't go into in great detail, but I'll provide a brief explanation to satisfy the curious. In simple econometrics, most time series are approximated by a mathematical process comprised of several components:

  1. Trend - the trend component is the overall pattern in the series. Inflation is the standard example of this, which implies that in the absence of other effects or components, stock prices will move up on average.
  2. seasonal - the cyclical component of the series. As the name implies, this component includes effects that occur at roughly the same time each year, period, etc. The (controversial) January effect is an example of this.
  3. Irregular - this component is loosely defined to include patterns that aren't necessarily part of a larger trend (the trend component) or a seasonal/cyclical pattern, but are nevertheless indicative of approximate mathematical relations. One example of this is momentum, or the idea that "rising prices continue to rise."
  4. Random - this is essentially the component that you're asking for in the question, since it's the portion of the stock price that isn't affected by market movements, systemic risk, inflation, the seasonal temperature outside the exchange building, etc. Ideally, this component would simply be a white noise process with a normal distribution, since those properties are both well understood and easy to work with.

In the simplest case, the equations for a time series containing one or more of the above components are of the form that taking the first difference (the procedure I used above) will leave only the random component. However, if you want to pursue this rigorously, you would first perform a set of tests to determine if these components exist and if differencing is the best procedure to remove those that are present.

Once you've reduced the series to its random component, you can use that component to examine how the process underlying the stock price has changed over the years. In my example, I highlighted Steve Jobs' death on the chart because it's one factor that may have led to the increased standard deviation/volatility of Apple's stock price. Although charts are somewhat subjective, it appears that the volatility was already increasing before his death, which could reflect other factors or the increasing expectation that he wouldn't be running the company in the near future, for whatever reason.


My discussion of time series decomposition and the definitions of various components relies heavily on Walter Ender's text Applied Econometric Time Series. If you're interested, simple mathematical representations and a few relevant graphs are found on pages 1-3.

Another related procedure would be to take the logarithm of the quotient of the current day's price and the previous day's price. In Apple's case, doing so yields this graph:

log of daily change in closing price

This reduces the overall magnitude of the values and allows you to see potential outliers more clearly. This produces a similar effect to the difference taken above because the log of a quotient is the same as the difference of the logs

The significant drop depicted during the year 2000 occurred between September 28th and September 29th, where the stock price dropped from 26.36 to 12.69. Apart from the general environment of the dot-com bubble bursting, I'm not sure why this occurred.

Another excellent resource for time series econometrics is James Hamilton's book, Time Series Analysis. It's considered a classic in the field of econometrics, although similar to Enders' book, it's fairly advanced for most investors.


I used Stata to generate the graphs above with data from Yahoo! Finance:

copy "http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=08&b=7&c=1984&d=03&e=8&f=2013&g=d&ignore=.csv" aapl.csv, replace
insheet using aapl.csv, comma clear
gen int d = date(date, "YMD")
drop date
rename d date
tsset date, daily

tsline D.adjclose if year(date) > 1994, ///
    title("Daily {&Delta} in Apple's closing stock price", size(small)) ///
    caption("money.stackexchange.com", size(vsmall) pos(5)) ///
    tlabel(01jan1995 01jan2000 01jan2005 01jan2010, labsize(vsmall)) ///
    ylabel(, labsize(vsmall)) ///
    xlabel(, labsize(vsmall)) ///
    xline(`=d(05oct2011)') ///
    ttick(`=d(05oct2011)', tpos(in)) ///
    ttext(-55 `=d(05oct2011)' "Jobs' death", orient(vert) size(small))

graph export aapl_first_diff.png, replace

gen logdiff = log(adjclose / L.adjclose)
tsline logdiff if year(date) > 1994, ///
    title("log(Daily {&Delta}) in Apple's closing stock price", size(small)) ///
    caption("money.stackexchange.com", size(vsmall) pos(5)) ///
    tlabel(01jan1995 01jan2000 01jan2005 01jan2010, labsize(vsmall)) ///
    ylabel(, labsize(vsmall)) ///
    xlabel(, labsize(vsmall)) ///
    xline(`=d(05oct2011)') ///
    ttick(`=d(05oct2011)', tpos(in)) ///
    ttext(-0.65 `=d(05oct2011)' "Jobs' death", orient(vert) size(small))

graph export aapl_logdiff.png, replace

keep logdiff date adjclose
save aapl, replace

There are a couple of nuances in this code related to how I defined the time series and the presence of weekends, but they don't affect the overall concept. For a robust analysis, I would make a few quick tweaks that would make the graphs less appealing without more work, but would allow for more accurate econometrics.


I use StockCharts for spread charting. To take your question as an example, here is the chart of Apple against Nasdaq.


You run the regression R_{i,t} = a + bR_{m,t} + e_t, then a + e_t is the variation that isn't shared with the market's variation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .