Error-ratio pair trade
The error-ratio pair trade is a regression-based way to trade two related stocks against each other. It fits a straight line between the daily futures prices of AXISBANK and ICICIBANK over 200 sessions, lets a simple statistic decide which stock goes on which side of the equation, and trades only when today's gap from that line is extreme and the leftover gap passes a stationarity test.How it trades
Results
PRE-BUILT · DEFAULTSWhere it made and lost money
There is no evidence to split here. With default settings the strategy took no trades from 1 Oct 2025 to 30 Sep 2026, so nothing can be said about how it behaved against the NIFTY market backdrop, whether by India VIX, session type or trend. The cause is the entry bar: the code needs the pair's regression to pass the ADF stationarity test and, on the same evening, the latest residual to sit 2.5 standard errors from the fitted line. AXISBANK and ICICIBANK never met both conditions together in this year.
The same trades, split by the market conditions around each entry, before costs.About this strategy
- Each session, take the last 200 daily futures closes of AXISBANK and ICICIBANK and regress each price on the other.
- Compute the error ratio (standard error of the intercept divided by the standard error of the residuals) for both directions; the lower one decides which stock is Y and which is X.
- Keep the pair only if the residuals pass the ADF test at 5% and the slope (beta) is positive.
- If the latest residual is 2.5 standard errors below the line, buy 1 lot of Y and sell beta times Y's units of X in whole lots at 09:20 the next session; if 2.5 above, do the reverse. Both legs sit in one position.
- The model is frozen at entry. Close at 09:20 after the residual comes back within 1 standard error (target) or stretches to 3 (stop).
- On monthly expiry both legs close at 15:15 and reopen in the next month at 09:20 the following session.
- No new pair is opened while either stock is in the F&O ban.
Why traders use it
Two private banks of similar size respond to the same rate, credit and liquidity news, so their prices tend to move together. A regression line turns that link into a number, and the residual shows how far one has run from the other. The error ratio is a quick rule of thumb for which way round to set up the regression, and many Indian traders learn pair trading through this exact method because it needs only a spreadsheet and two price series.
The year in plain words
On default settings from 1 Oct 2025 to 30 Sep 2026 the error-ratio pair trade on AXISBANK and ICICIBANK made no trades, so there is no profit or loss before or after costs. The code re-fits every session but needs two things at once: residuals that pass the 5% ADF test with a positive slope, and a latest residual at least 2.5 standard errors from the line. In this year the pair never satisfied both. The fair reading is that this rule set went untested on this pair over the year, not that it succeeded or failed.
What the settings do
Risks
- A residual at 2.5 standard errors can keep widening if the two banks' fortunes diverge, so the trade relies on the 3 standard error stop.
- The X leg is sized from beta in shares and rounded to whole lots, so the pair is never exactly balanced and carries some market exposure.
- There is no time stop: a trade that drifts between the target and the stop can stay open for weeks, rolling at each expiry.
- Every round trip is four futures orders, plus four more at each monthly roll, so costs mount quickly.
Who it suits
Traders curious about regression-based pair trading who have margin for two stock futures positions at once and are comfortable with a rule set that may stay flat for a whole year.
Questions traders ask
Is the error-ratio pair trade profitable?
This backtest cannot answer that. On AXISBANK and ICICIBANK with default settings it made zero trades between 1 Oct 2025 and 30 Sep 2026, so there was no profit or loss before or after costs. A looser test level or a lower entry threshold may create trades, but past results, or their absence, do not guarantee anything about future ones.
What is the error ratio in pair trading?
It is the standard error of the regression's intercept divided by the standard error of its residuals. The pair is regressed both ways round, and the direction with the lower ratio is used, on the view that its fit is more reliable. It decides which stock is treated as Y and which as X.
Why did this pair trade never trigger?
Two filters must pass on the same evening: the residuals must look stationary under the 5% ADF test, and the latest residual must be 2.5 standard errors from the line. Either alone happens; together they did not occur for AXISBANK and ICICIBANK in this year. Moving the test to 10% or the entry towards 2.0 loosens the gate.
How are the lots of the two futures decided?
The Y stock trades the chosen number of lots. The X leg is beta times Y's share quantity, converted to X's lot size and rounded to whole lots, with at least one lot. Both legs sit in one position, so the trade's P&L is the combined result.