PnLLiquidationBreak-evenTarget ExitPosition SizerFunding CostAverage EntryScenarioMax LeverageFunding ArbHedge RatioCompound FundingCrypto ProfitCrypto DCAAverage Buy PriceTarget Sell PricePresent ValueFuture ValueNPVIRRCAGRAPY / APRBond PricePre-Trade CheckRisk / RewardPortfolio RiskCarry TradeDCA EntryAverage Down?Scale-OutFunding BreakevenRug Pull CheckerSwap Price ImpactBonding CurveMarket Cap CalculatorWallet CheckerImpermanent Loss CalculatorProbability CalculatorMarket-Implied OddsKelly CalculatorUp/Down Fair ValueSpread CheckerArbitrage CheckerBlack-Scholes CalculatorOptions Payoff CalculatorStraddle & Strangle CalculatorCovered Call & Protective Put CalculatorImplied Volatility CalculatorSpread & Iron Condor CalculatorBarrier Touch CalculatorAmerican Option CalculatorOption Greeks CalculatorOptions Profit CalculatorOptions Strategy PickerMax Pain CalculatorCash-Secured Put CalculatorPip Value CalculatorMargin Level CalculatorBreakeven CalculatorPnL CalculatorRisk/Reward CalculatorScenario CalculatorAverage Entry CalculatorMargin Required CalculatorCurrency ConverterPosition Size CalculatorSwap / Rollover CalculatorCorrelation CalculatorFibonacci Retracement CalculatorOpen AnalysisSession StructureValue MigrationBreakout AcceptanceVaR / CVaR CalculatorSharpe Ratio CalculatorHurst Exponent CalculatorCointegration TestPortfolio TearsheetGARCH Volatility CalculatorRisk Parity CalculatorDeflated Sharpe Ratio CalculatorKelly Growth-Security FrontierReturn Unsmoothing CalculatorEVT Tail Risk CalculatorMonte Carlo Simulation CalculatorEvent Study CalculatorOrder-Book Impact CalculatorDocs

Cointegration Test Calculator

RISK/STATS · COINTEGRATION · ADVANCED

Engle-Granger two-step cointegration test for a pair of price series: the standard pairs-trading signal, with the hedge ratio from the cointegrating regression.

30 values

Comma, space, or newline separated. No thousand separators (write 43250.50, not 43,250.50).

30 values

Comma, space, or newline separated. No thousand separators (write 43250.50, not 43,250.50).

Engle-Granger two-step test: OLS regression Y = alpha + beta*X, then an Augmented Dickey-Fuller test on the residuals. A significantly negative t-statistic (below the critical value) means the residual spread is stationary: Y and X are cointegrated.

Enter two equal-length price series (≥20 values each)

The formula

Engle-Granger two-step procedure:

  • Step 1: OLS regression Y = α + βX, giving the hedge ratio β
  • Step 2: ADF test on the residuals: delta(e_t) = gamma × e_(t-1) + u_t
  • t-stat = γ / SE(γ), compared against critical values at 1%/5%/10%

Reading the result

A t-statistic more negative than the critical value rejects the unit-root null: the residual spread is stationary, meaning Y and X are cointegrated at that significance level. The hedge ratio (β) is how many units of X to hold per unit of Y to build the spread.

Where to go next

Cointegration is a relationship between two series. For memory structure within a single series, see the Hurst exponent calculator, size a position against tail risk with the VaR / CVaR calculator, or, once you've found a real relationship, weight a multi-asset book so each asset contributes equal risk with the risk parity calculator.

Use via API or MCP

This calculation is available as a deterministic API call for bots and AI agents.

EMBED ON YOUR SITE

<!-- TradingCalc widget: please keep the link below exactly as given (address and words) -->
<div class="tradingcalc-widget" data-widget="cointegration-calculator"><a href="https://tradingcalc.io/cointegration-calculator?utm_source=embed&amp;utm_medium=backlink&amp;utm_campaign=cointegration-calculator">Cointegration Test Calculator by TradingCalc.io</a></div>
<script async src="https://tradingcalc.io/embed.js"></script>

Free, no signup. Keep the text link in the code exactly as given, with its address and its words: it is the attribution and it points visitors to the full calculator. Change colors, size and start values or read the installation guide and FAQ.

FAQ
Q.01

What assumptions and edge cases does this calculator use?

Both series need at least 20 values and the same length, one observation per date. Give price levels, not returns. If the regression residuals are constant the test is undefined and you get an error. It is the Engle-Granger test with y regressed on x, so swapping the two can change the result. Not covered: more than two series, structural breaks, a time trend, the half-life of the spread, transaction costs, and any promise that the relation will hold.

Q.02

What does "cointegrated" mean for a pair of assets?

Two price series are cointegrated if a specific linear combination of them is stationary (mean-reverting) even though each series individually is not (each may wander like a random walk). This is the statistical basis for pairs trading: if the spread reverts to its mean, deviations from that mean are a tradeable signal.

Q.03

How does the Engle-Granger test work?

Two steps: (1) an OLS regression of one price series on the other, Y = alpha + beta*X, giving the hedge ratio beta; (2) an Augmented Dickey-Fuller test on that regression's residuals, testing whether the residual spread has a unit root (non-stationary, not cointegrated) or is stationary (cointegrated).

Q.04

What does the hedge ratio (beta) mean in practice?

It's how many units of X to hold per unit of Y to construct the cointegrating spread (Y - beta*X). A pairs trade typically goes long the undervalued side and short beta units of the other when the spread deviates from its historical mean.

Q.05

Why are the critical values different from a standard ADF test?

Testing the RESIDUALS of a prior regression (rather than testing a raw series directly) changes the test statistic's distribution: these are the MacKinnon critical values specific to the two-step Engle-Granger procedure, not the plain Dickey-Fuller table.

Q.06

Correlation vs cointegration: aren't these the same thing?

No. Two series can be highly correlated in their day-to-day moves while drifting apart over the long run (not cointegrated), and two series can be weakly correlated day-to-day while still sharing a stable long-run relationship (cointegrated). Pairs trading specifically needs cointegration, not just correlation.