Historical Price Relationship Tool

Free Market Correlation Matrix Calculator

Build a color-coded correlation heatmap for your portfolio. Calculate Pearson correlations from common-date price returns for supported stocks and ETFs. Compare historical relationships; this is not portfolio optimization.

Up to 12 Assets
Color-Coded Heatmap
100% Free
Quick Add Sector ETFs:
Popular Stocks:

Build Your Correlation Matrix in 3 Steps

1

Add Your Assets

Enter up to 12 stocks, ETFs, or sectors

2

Select Timeframe

Choose 3 months to 3 years

3

View Heatmap

Analyze color-coded correlations

Compare linear price relationships

Add 2 to 12 supported stock or ETF symbols, select 3 months, 6 months, 1 year or 3 years, then generate the matrix. Sector buttons select ETF tickers; they do not aggregate every company in a sector. Coverage depends on the FMP history response.

From prices to correlations

The tool intersects the dates available for every selected symbol and sorts them chronologically. It computes rᵢ = Pᵢ / Pᵢ₋₁ − 1 on successive common dates, then Pearson correlation for each pair. If a session is missing for one symbol, a return interval may span multiple sessions for all symbols. At least 20 common prices are required.

ρ = Σ[(x − x̄)(y − ȳ)] / √(Σ(x − x̄)² Σ(y − ȳ)²)

Both return series must vary: a constant series has zero variance and an undefined correlation. The calculator reports an error for that case rather than converting it to zero. Values near +1 or −1 describe strong linear association in this sample; zero does not rule out a nonlinear relationship.

Read the heatmap with its sample

Red shades indicate positive correlation and blue shades negative correlation. Neutral shading covers −0.3 through +0.3. These display bands are conventions, not statistical significance tests. The matrix diagonal is 1 for valid varying series. Highest, lowest and average summaries use off-diagonal pairs once each.

Results show the actual common-date span and interval count. A longer request does not ensure a stable relationship. Prices are used as returned; this tool does not verify dividend or split adjustment, normalize currencies or calculate total returns.

What this cannot establish

A low correlation does not make an asset a suitable investment or guarantee downside protection. Portfolio variance also depends on weights and volatility, while liquidity and nonlinear losses require separate analysis. This calculator has no optimizer, allocation recommendation or calibrated diversification score.

Formula reference: SciPy Pearson correlation definition and constant-input limitation. Data endpoint: FMP historical price light documentation.

Frequently Asked Questions

What does this matrix measure?

Pearson linear correlation of percentage price changes over dates common to all selected symbols. Zero correlation does not establish independence. Positive or negative correlation does not specify the size of an asset’s move.

Where do prices come from?

The page requests FMP historical-price-light data for the selected window. Coverage may be shorter than requested. Corporate-action and dividend adjustments are not verified by this page, so the result must not be described as total-return correlation.

How much data is required?

At least 20 common price dates, giving at least 19 return intervals, for 2 to 12 symbols. This minimum is a tool rule, not a claim of statistical reliability. Invalid prices, duplicate dates or constant return series stop the calculation instead of being shown as zero correlation.

Does a low correlation mean my portfolio is safe?

No. The calculation omits position weights, volatility, currency conversion, liquidity, tail dependence and expected returns. Historical correlations change. The average gives each asset pair equal weight; it is not portfolio variance or a recommended allocation.

What happens when I change symbols or the period?

The previous result is cleared. Generate a new matrix to request data for the new selection. The displayed sample dates and interval count describe the successful request; provider availability and errors can limit results.

Explore Correlation Ideas in Pine Script

Use Pineify to draft a Pine Script research indicator, then review and test it in TradingView. This matrix does not rebalance a portfolio, send broker orders or transfer its historical dataset into a script.