Coca-Cola and Pepsi have moved together for decades—until one day they don't. That temporary divergence is your opportunity. Here's how AI turns correlation analysis and spread tracking from a 6-hour Excel project into a 30-second conversation.
Andrew Grosser
February 16, 2026 • 14 min read
November 2023: For the past six months, AMD and NVIDIA have traded with an 0.84 correlation. When NVIDIA rallies 3%, AMD typically follows with 2.5%. When NVIDIA drops 4%, AMD drops 3.2%. The relationship isn't perfect, but it's consistent enough that the price ratio between them—AMD at $142 divided by NVIDIA at $265, giving a ratio of 0.536—oscillates in a predictable range between 0.48 and 0.58.
Then NVIDIA announces a major data center partnership. The stock jumps 8% in one day while AMD barely moves, up just 1.2%. Suddenly the ratio is 0.496—well outside the normal range. That's a 2.7 standard deviation event. Two highly correlated stocks just decoupled, and history suggests they'll revert to their mean relationship. You go long AMD (relatively cheap) and short NVIDIA (relatively expensive), betting $100,000 that the ratio will normalize over the next two weeks sign up free.
Sourcetable's AI trading analyst includes built-in correlation analysis and spread tracking for all pairs. Try it free.
Understanding pairs trading takes five minutes. Executing it properly takes six hours of Excel work—and that's before you've entered a single trade. You need rolling correlation calculations, spread normalization, z-score tracking, cointegration tests, and continuous monitoring across dozens of potential pairs.
Let's say you want to trade the AMD-NVIDIA pair. In Excel, you start by importing daily closing prices for both stocks over the past year. That's 252 trading days × 2 stocks = 504 data points to organize. Now calculate the 60-day rolling correlation using CORREL functions with offset ranges—but Excel doesn't have a rolling correlation function, so you're writing array formulas that reference sliding windows of data.
Next, you calculate the price ratio (AMD/NVIDIA) for each day. Easy enough. But now you need the mean of that ratio over 60 days, the standard deviation, and the current z-score (how many standard deviations from mean). That's three more formula columns with AVERAGE, STDEV, and custom z-score calculations. And these need to update dynamically as you add new price data.
You're not done. To properly evaluate this pair, you need:
That's for one pair. Professional pairs traders monitor 20-50 pairs simultaneously, scanning for statistical divergences. In Excel, that means 20 separate spreadsheets or one massive workbook with thousands of formulas that breaks every time you add new data. Change your correlation window from 60 days to 90 days? Rebuild everything.
Pairs trading is built on mean reversion—the statistical principle that correlated securities tend to return to their historical relationship after temporary divergences. The strategy has four core components:
Not all pairs work. You need securities with strong, stable correlations—typically above 0.75 over meaningful time periods. The best pairs come from related businesses: competitors in the same industry (Coca-Cola vs. Pepsi), similar ETFs (SPY vs. IVV), or commodities with economic linkages (crude oil vs. gasoline). Upload price data for 50 stocks and you have 1,225 possible pairs (50 choose 2). Excel chokes. Sourcetable doesn't.
Ask Sourcetable: "Which technology stocks have 90-day correlations above 0.80?"
It scans all combinations and returns: AMD-NVIDIA (0.84), Intel-AMD (0.79), Broadcom-NVIDIA (0.82), Micron-Western Digital (0.81). Four qualified candidates in two seconds. No formulas, no pivot tables, no CORREL arrays.
The spread is the relationship between the two securities—usually expressed as a price ratio (Stock A / Stock B) or a dollar difference (Stock A - Stock B). For AMD trading at $142 and NVIDIA at $265, the ratio is 0.536. Over the past 90 days, this ratio has averaged 0.525 with a standard deviation of 0.015. When the ratio hits 0.496, that's 1.93 standard deviations below mean—a significant divergence.
In Excel, tracking spreads across multiple pairs means maintaining separate sheets with columns for date, Price A, Price B, ratio, mean, standard deviation, and z-score. Every new day requires copying formulas down. Sourcetable just asks: "What's the current z-score for AMD-NVIDIA?" → -1.93. Done.
Most pairs traders use z-score thresholds to trigger entries. A z-score of +2.0 means the spread is 2 standard deviations above mean—Stock A is expensive relative to Stock B. Go short A, long B. A z-score of -2.0 means A is cheap relative to B—go long A, short B. The threshold varies by pair and trader risk tolerance, typically ranging from 1.5 to 2.5 standard deviations.
Sourcetable monitors this continuously: "Alert me when any of my tracked pairs exceed 2.0 standard deviations." When the AMD-NVIDIA ratio hits -2.1, you get flagged. The AI also notes: "This pair has exceeded 2 SD eight times in the past year, with mean reversion occurring within an average of 7.3 trading days. Historical win rate: 87.5%." That's the context you need to size the position confidently.
Exits typically occur when the spread reverts to mean (z-score returns to 0) or crosses to the opposite extreme. Some traders exit at 50% reversion (z-score reaches -1.0 if entered at -2.0), others wait for full mean reversion. Time-based stops are also common—if the spread hasn't reverted within 15-30 days, close the position to free capital for other opportunities.
Ask Sourcetable: "What's my current P&L on the AMD-NVIDIA position if I entered at a -2.1 z-score and it's now at -0.8?" The AI calculates: spread moved from 0.496 to 0.518 (toward mean), position is up $4,200 on $100,000 deployed. It also notes you're 62% of the way to mean reversion, suggesting you might hold for full convergence or take profit now depending on your exit rules.
Pairs trading is supposed to be market-neutral—your long and short positions offset each other so you're not exposed to overall market moves. But "neutral" has two meanings, and Excel makes both difficult to achieve.
The simplest approach: invest equal dollar amounts in the long and short sides. For a $100,000 pairs trade with AMD at $142 and NVIDIA at $265, you buy $50,000 of AMD (352 shares) and short $50,000 of NVIDIA (189 shares). If the market rallies 5%, both positions increase proportionally—your long gains roughly offset your short losses. The spread movement is what matters, not market direction.
Ask Sourcetable: "How do I structure a $150,000 dollar-neutral pairs trade on AMD at $142 and NVIDIA at $265?"
It returns: 528 shares AMD ($74,976 long) and 283 shares NVIDIA ($75,095 short). The AI accounts for whole shares and gets you as close to perfect neutrality as possible. It also notes: "Net market exposure: $119 (0.08% of total position)—effectively neutral."
More sophisticated traders adjust for beta—how much each stock moves relative to the market. If AMD has a beta of 1.5 (moves 1.5× the market) and NVIDIA has a beta of 1.3, equal dollar positions aren't truly neutral. A 5% market move would cause AMD to gain/lose 7.5% while NVIDIA moves 6.5%—creating unintended directional exposure.
Beta-neutral sizing adjusts positions so the beta-weighted exposure equals zero. In Excel, this requires pulling betas from external sources, calculating hedge ratios, and solving for position sizes algebraically. Sourcetable asks: "Calculate beta-neutral position sizes for AMD (beta 1.5) and NVIDIA (beta 1.3) with $150,000 total capital."
The AI returns: 460 shares AMD ($65,320 long, beta-weighted exposure $97,980) and 315 shares NVIDIA ($83,475 short, beta-weighted exposure $108,518). It explains: "Position sizes adjusted for beta differences. Net beta exposure: $10,538 (7% of capital)—near-neutral with slight long bias." Professional-grade risk management without the algebra.
Correlation is easy to calculate but insufficient for pairs trading. Two stocks can show 0.85 correlation over 90 days yet have no stable long-term relationship—their movement together might be coincidental or driven by temporary factors. Cointegration is the statistical test that separates real pairs from false correlations.
Cointegration means the spread between two securities is mean-reverting—it wanders away from equilibrium but reliably returns. Mathematically, this requires testing whether the spread is stationary (has constant mean and variance over time). The standard test is the Augmented Dickey-Fuller (ADF) test, which Excel cannot perform without add-ins or VBA macros.
Sourcetable understands the difference. Ask: "Test cointegration between JPMorgan and Bank of America using 2 years of daily data."
The AI runs the ADF test and returns: p-value: 0.018 (cointegrated at 5% significance level). It explains: "The spread between JPM and BAC is statistically mean-reverting. Over 504 trading days, the spread reverted to mean 15 times after exceeding 1.5 SD, with average reversion time of 9.2 days. This pair shows stable long-term relationship suitable for pairs trading."
Compare this to "Test cointegration between Apple and Exxon." → p-value: 0.43 (not cointegrated). The AI warns: "These stocks show occasional correlation but no stable mean-reverting relationship. Divergences may persist indefinitely. Not recommended for pairs trading." This intelligence—automatic, conversational, statistically rigorous—is what separates amateur correlation trading from professional statistical arbitrage.
Pairs trading isn't always profitable. The strategy thrives in certain conditions and collapses in others. Understanding the difference keeps you solvent.
Range-Bound Markets: When the overall market is choppy without clear direction, individual stock correlations remain stable. Spreads oscillate within normal ranges, providing frequent mean reversion opportunities. The best pairs trading years often occur during sideways markets where directional strategies struggle.
High Liquidity: You need to enter and exit both legs simultaneously without moving prices. Stick to large-cap stocks, major ETFs, or liquid futures contracts with tight bid-ask spreads. Illiquid securities create execution risk—you might nail the entry on the long side but miss the short side by 0.5%, destroying your edge.
Stable Correlations: The relationship between securities should persist across different market regimes. Check that correlation remains above 0.70 during both rising and falling markets over multiple years. Pairs that only correlate during bull markets will betray you when conditions change.
Mean-Reverting Spreads: Historical data should show that divergences consistently revert within reasonable timeframes (5-20 days typically). If spreads frequently exceed 2 SD and stay there for months, you're not trading mean reversion—you're catching falling knives.
Structural Changes: When one company announces a buyout, spins off a division, or fundamentally changes its business model, historical correlations become irrelevant. The pair decouples permanently. You entered at -2.0 SD expecting mean reversion, but the spread moves to -4.0 SD and stays there. Your "market-neutral" position loses money on both sides.
Sector Rotations: During aggressive sector rotations, seemingly stable pairs within different sectors can diverge violently. Tech stocks might rally 15% while energy drops 10%, creating massive divergences in cross-sector pairs that may not revert for months.
Correlation Breakdown: The 2008 financial crisis destroyed countless pairs trades when correlations collapsed. Banks that had traded together for decades decoupled as some failed while others survived. Pairs traders who assumed historical relationships would hold lost fortunes. The lesson: position size assuming correlations can break, not that they definitely won't.
Transaction Costs: Pairs trading captures small spreads—often 2-5% moves over 1-2 weeks. Commission costs, short borrow fees, and slippage can consume 0.5-1% of your capital per round trip. On a $100,000 pairs trade, you might pay $500-1000 in costs. If your spread target is only $2,000, costs represent 25-50% of expected profit. Factor these in rigorously.
Sourcetable helps you avoid these traps. Ask: "Show me correlation stability for the Micron-Western Digital pair across the last 3 years, broken down by bull and bear markets." The AI might reveal that correlation is 0.85 during market rallies but drops to 0.45 during selloffs—a dangerous pair that only looks good in aggregate. Or request: "Calculate historical win rate and average profit for the XOM-CVX pair including 0.2% round-trip costs." The AI accounts for transaction costs in its analysis, showing realistic profitability.
One pair is a trade. Ten pairs is a strategy. Twenty pairs is a portfolio. Professional statistical arbitrage funds run 50-200 pairs simultaneously, diversifying across sectors, geographies, and timeframes to create smooth uncorrelated returns. Managing this in Excel is organizationally impossible.
Sourcetable makes multi-pair management conversational. Upload price data for 100 stocks and say: "Find the 20 best pairs with correlation above 0.80, cointegration p-value below 0.05, and current z-score above 1.5."
The AI scans 4,950 possible combinations, runs statistical tests on qualified pairs, and returns 20 actionable opportunities ranked by z-score magnitude and reversion probability. Each result includes current spread, historical mean reversion time, and suggested position sizes for $50,000 per pair ($1 million total portfolio).
With multiple pairs, you need aggregate exposure monitoring. You might have 15 pairs that individually appear market-neutral but collectively create unintended sector concentration. If 8 of your 15 pairs involve technology stocks, you're not really market-neutral—you're effectively long tech with extra steps.
Ask Sourcetable: "Show me sector exposure across all my active pairs positions."
It aggregates your longs and shorts by sector and returns: Technology: +$185,000 net long, Financials: +$42,000 net long, Energy: -$73,000 net short, Healthcare: +$8,000 net long, Consumer: -$15,000 net short. The analysis reveals you're running a significant tech overweight despite thinking you're market-neutral. The AI suggests: "Consider adding tech-negative pairs or reducing position sizes on NVDA-AMD, AAPL-MSFT, and AVGO-QCOM to improve sector neutrality."
Not all pairs perform equally. Some consistently revert quickly with high win rates. Others generate frequent false signals or take too long to converge. You need to track performance by pair to identify which relationships actually work.
Request: "Show me win rate, average profit, and average holding period for each pair I've traded this year."
Sourcetable analyzes your complete trading history and returns a ranked table: JPM-BAC: 11 trades, 82% win rate, $1,850 avg profit, 6.2 days avg hold. XOM-CVX: 15 trades, 73% win rate, $1,240 avg profit, 8.8 days avg hold. AAPL-MSFT: 9 trades, 56% win rate, $680 avg profit, 14.3 days avg hold. The data is clear: JPM-BAC is your best pair (high win rate, high profit, quick reversion), while AAPL-MSFT is marginal (lower win rate, slow reversion). Allocate more capital to proven winners.
Let's walk through a complete pairs trade from identification to exit. You're analyzing major financial stocks, looking for opportunities in the banking sector. You upload 2 years of daily price data for 10 large banks and ask Sourcetable to identify correlated pairs.
The AI returns JPMorgan (JPM) and Bank of America (BAC) with a 90-day correlation of 0.87 and cointegration p-value of 0.012—statistically strong. You request: "Chart the JPM-BAC price ratio over the past year with mean and standard deviation bands."
The visualization shows the ratio (JPM price / BAC price) fluctuating between 3.8 and 4.4 over the past year, with a mean of 4.1 and standard deviation of 0.15. Currently, the ratio is sitting at 4.52—a 2.8 standard deviation event. BAC just reported strong earnings, rallying 6% in two days while JPM only gained 1%. The spread has diverged significantly.
You ask: "How many times has the JPM-BAC ratio exceeded 2.5 SD in the past year, and what was the average reversion time?"
Sourcetable scans the historical data: 6 times exceeded 2.5 SD, average reversion time to 1.0 SD: 7.3 days, average time to mean: 11.8 days. Win rate: 100% (all six divergences reverted within 20 days). The statistics are compelling. You decide to enter.
Request position sizing: "Calculate beta-neutral position sizes for a $200,000 pairs trade on JPM at $151 and BAC at $33.50, with JPM beta 1.15 and BAC beta 1.28."
The AI returns: Long 866 shares JPM ($130,766, beta-weighted $150,381), Short 3,050 shares BAC ($102,175, beta-weighted $130,784). Net beta exposure: $19,597 (8.4% of capital). The position is nearly beta-neutral but slightly long-biased, acceptable given BAC's higher beta makes exact neutrality difficult with whole shares.
You enter the trade. Over the next 9 days, you monitor the position by asking: "What's the current z-score and unrealized P&L on my JPM-BAC position?"
On day 9, with the spread at 0.53 standard deviations—near mean reversion—you decide to exit. You ask: "Calculate my final P&L on the JPM-BAC trade including $150 in commissions and $280 in short borrow costs."
Sourcetable returns: Gross profit: $7,650. Commissions: -$150. Short borrow: -$280. Net profit: $7,220. Return on capital: 3.11% in 9 days (126% annualized). The AI also notes: "This represents your 4th profitable JPM-BAC trade this year. Combined performance: 4 trades, 100% win rate, $24,100 total profit, 7.8 days average holding period."
That's statistical arbitrage executed professionally—without building a single Excel formula.
Pairs trading captures mean reversion in correlated securities by going long the underperformer and short the overperformer when spreads diverge. The strategy is market-neutral—profiting from the relationship converging regardless of overall market direction.
Traditional Excel analysis requires building complex rolling correlation formulas, z-score calculations, cointegration tests, and spread tracking across dozens of potential pairs—a 6-hour setup process that breaks every time you add new data or change parameters.
Sourcetable turns statistical arbitrage into natural language: "Which tech stocks have correlation above 0.80?" → Instant results. "What's the current z-score for AMD-NVIDIA?" → -1.93. "Calculate beta-neutral position sizes for $150,000." → Exact share quantities accounting for beta differences.
Successful pairs trading requires cointegration testing (not just correlation), proper position sizing (dollar-neutral or beta-neutral), and understanding when the strategy works (range-bound markets with stable correlations) versus when it fails (structural changes or correlation breakdowns).
Professional pairs traders run 20-50 positions simultaneously, diversifying across sectors and monitoring portfolio-level exposure. Sourcetable manages this complexity conversationally, providing aggregate risk analysis, performance tracking by pair, and real-time opportunity scanning that's impossible in Excel without extensive VBA programming.
If your question is not covered here, you can contact our team.
Contact Us