+1 (307) 227-6611

Free risk tools

Cointegration test

Do two markets stay tied together, or only look alike? The Engle-Granger test on your two price lists, before you trade the spread.

Free, no sign-up On sale: Desk and Desk + Signals. See the plans

  • Free
  • No sign-up
  • Nothing you type is stored

The two markets

Closes of the first market, oldest first; gold in the example.
Closes of the second market on the same days; silver in the example.

The test

Not cointegrated: the test statistic -1.48 is above -3.41, the 5% line for 80 days. The spread between the two has wandered like a random walk, so a pair trade on it has nothing that pulls it back.

Hedge ratio
1.100: the spread is the second's log price minus 1.100 times the first's, so a 1% move in the first has gone with about 1.10% in the second.
Critical values
-4.04 at 1%, -3.41 at 5% and -3.10 at 10% for 80 days. They are stricter than a plain Dickey-Fuller test because the hedge ratio was fitted to the same prices.
Correlation is not enough
The prices are 0.55 correlated, yet not cointegrated: trending the same way does not tie them together over time.
Spread now
+2.00 standard deviations from its average. About 9.3 days for a gap in the spread to halve, though that pull did not pass the test.
Read it with care
A pair can be cointegrated for years and then break apart. Check the test on several stretches, as in the table, and keep a stop on the spread.

The same test on the most recent days only: the hedge ratio, the statistic and whether it passes at 10% or better.

DaysHedge ratioStatisticCointegrated
Last 400.755-1.10No
Last 600.426-0.59No
All 801.100-1.48No

Education only, not investment advice. The answer comes from the numbers you typed in, not from your account or the market. Simulated results are hypothetical and have limits: real trading has slippage, gaps, changing results and emotions. Trading leveraged products can lose money quickly, including all of it. Risk warning

Want this check on every trade?

Educational only, not financial advice; trading involves risk.

Correlated is not the same as tied together

Two markets can rise and fall on the same days and still drift apart for years. A pair trade, long one and short the other, only works when something pulls the gap back. Robert Engle and Clive Granger's test, which shared a Nobel prize in 2003, checks exactly that: it fits the hedge ratio, then asks whether the spread behaves like a random walk or keeps returning to its average.

Size the two legs with the pair trading calculator, see how fast the spread closes with the mean reversion half-life calculator, compare day-to-day moves with the correlation calculator, and size the trade with the position size calculator.

Not advice. A test on the prices you type; a pair that held together can break apart.

Next tools

All free tools

Pricing

Three ways in. Pick yours.

Baroq never holds your money and never trades for you. Educational only, not financial advice; trading involves risk.

Test your trading idea free

No spam. Unsubscribe anytime.

Educational only, not financial advice; trading involves risk.

or join us on Telegram