QuantsappFaster in the app: live data, alerts, tradingOpen
Log inStart free
PositionalAXISBANK

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.
Trades AXISBANK against ICICIBANK futures when a 200-day price regression between them shows the gap at 2.5 standard errors, betting it narrows back towards normal.
Market viewFades moves (mean reversion)
TradesAXISBANK and ICICIBANK near-month futures, long one, short other
RiskOpen-ended (loss not capped by the structure)
CapitalFutures margin
SuitsAdvanced
Trades a month0
Typical hold
Profitable months0 of 12
Longest losing run0 trades
Made money inNo evidence: the rules never triggered in the year
Lost money inNo evidence: zero trades to split by condition
Default settings
Symbol
Symbol x
Adf max
Entry z
Target z
Stop z
Exec time
Roll time
Lots y
Backtest this strategy →Change any setting, pick your own period and run it in the Quantsapp web app. Backtesting is part of the Max plan. Pro+ members can use it now as a free trial.
1

How it trades

What it trades
Universe
AXISBANK Positional · 1 Oct 25 → 30 Sep 26
Enters
09:20 next session after the residual closes 2.5 standard errors from the line
Legs
BUY FUT · Near month (cheap leg of the pair) · Current month · 1 lotSELL FUT · Near month (rich leg, beta-sized lots) · Current month · 1 lot
Exits
target Residual back within 1 standard error; closed 09:20 next sessionstop Residual stretches to 3 standard errors; closed 09:20 next sessionroll Both legs closed 15:15 on monthly expiry, reopened next session at 09:20
Re-entry
Yes - a fresh signal once the previous pair trade has closed
Model
every session, from the last LOOKBACK_DAYS daily futures closes of both stocks, regress A on B and B on A (ordinary least squares on prices). Error ratio = standard error of the intercept / standard error of the residuals; the direction with the LOWER error ratio is "Y on X". Tradeable only if the residuals pass an ADF test (lag 0, constant) at ADF_MAX and beta > 0.
Signal
z = the latest residual / the residuals' standard error (as of the previous close).
Entry
z <= -ENTRY_Z -> long the pair: buy LOTS_Y lots of Y, sell beta x Y's units of X (whole lots); z >= +ENTRY_Z -> short the pair: sell Y, buy X. Placed at EXEC_TIME of the next session, both legs in ONE position (tagged long / short pair).
Exit
intercept, beta and standard error are FROZEN at entry; at each close target: long z >= -TARGET_Z, short z <= +TARGET_Z; stop : long z <= -STOP_Z, short z >= +STOP_Z; executed at EXEC_TIME of the next session.
Roll
futures cannot be held past their monthly expiry: on the expiry day both legs close at ROLL_TIME and the trade re-opens (same frozen model) at the next session's EXEC_TIME. No new entry while either stock is in the F&O ban (bt.ban, known before the open).
2

Results

PRE-BUILT · DEFAULTS
No trades in this periodThe rules never triggered with the default settings in the sample year.
3

Where 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.
4

About this strategy

  1. Each session, take the last 200 daily futures closes of AXISBANK and ICICIBANK and regress each price on the other.
  2. 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.
  3. Keep the pair only if the residuals pass the ADF test at 5% and the slope (beta) is positive.
  4. 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.
  5. 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).
  6. On monthly expiry both legs close at 15:15 and reopen in the next month at 09:20 the following session.
  7. 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.

Works best whenIn principle, when two stocks have a steady price relationship that passes the stationarity test and gaps of 2.5 standard errors appear and then close. This test produced no trades, so it offers no evidence on which conditions suit it.
Struggles whenWhen the relationship is not stable enough to pass the test, or when it passes but gaps never reach 2.5 standard errors, as happened with AXISBANK and ICICIBANK throughout this year. In a live trade, a lasting break in the link drives the spread to the stop.

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

Symbol xThe second stock of the pair. The error ratio decides each evening which of the two is treated as Y and which as X.Lookback daysHow many daily closes the regression uses. A shorter window adapts faster; a longer one is steadier but slower to notice a change in the link.Adf maxHow strict the stationarity test on the residuals is: 1%, 5% or 10%. Setting 10% lets more days qualify, loosening the gate that, together with the 2.5 entry, kept this run flat.Entry zHow many standard errors from the line the residual must be to open a trade. Lowering it towards 2.0 makes signals more frequent; it does not say whether they pay.Target zThe distance from the line, in standard errors, at which the trade takes profit. Zero waits for a full return to the line.Stop zCloses the pair if the residual keeps widening to this many standard errors.Exec timeThe time next morning at which entries, exits and post-roll re-entries are placed.Roll timeThe time on monthly expiry day at which both legs are closed before reopening in the next month.Lots yLots of the Y stock per trade; the X leg's lots scale with it through the fitted beta.

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.

5

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.

6

Before you rely on it

ADAPTED FOR TODAY'S NSE RULES- the source example pair (TATAMOTORS / TATAMTRDVR) no longer exists (DVR shares cancelled 2024); the default is a same-sector bank pair. Lots come from the exchange's lot table on the trade date, never the 2018 sizes. - ADF: fixed MacKinnon critical t-values (-3.43 / -2.86 / -2.57 for 1 / 5 / 10 %), lag 0 with a constant - the sandbox has no statsmodels for a p-value. One source tests the residuals with a plain ADF; the stricter Engle-Granger values would be about -3.9 / -3.34 / -3.04. - Entry 2.5 / target 1.0 / stop 3.0 standard errors (the author's own preference over the +-2 SD text); beta <= 0 pairs are skipped. - The source watches intraday; here the signal is the previous close and the fill the next morning, so no close is used before it is known. - The roll leaves the pair flat overnight on expiry day (no next-month price before the roll locally).
WATCH OUTone anecdotal live trade, no systematic backtest; whole-lot rounding breaks beta neutrality; STT and costs on four fills per round trip (plus rolls).
Backtests run on historical NSE data with fills at the last traded price. "Before costs" excludes brokerage, taxes and slippage. Quantsapp is not recommending any strategy; it is just a backtesting utility. Past results are not a promise of future returns.

Log in or sign up

Enter your mobile number. New to Quantsapp? The same OTP creates your free account.

+91

By continuing you agree to the Terms of Use and Privacy Policy.