TradeTech Analytics

Daily bars · long-only mean reversion in an uptrend · v1.0.0 · closed 2026-10-19

Quiet Harbour NO EDGE

Buying statistical dips inside a regression uptrend (owner-supplied code). The supplied backtester was reproduced exactly, then run with next-open entries, gap-aware exits and Indian costs on the index and on a stock portfolio.

Verdict

No edge

As supplied the rule earns almost nothing: 0.2% a year on the Nifty 50 index and about 0% a year on a Nifty 500 stock portfolio before stress. At 2x costs the stock portfolio loses 7% a year. No variant of 144 clears 8% a year with drawdown under 20% in both periods.

  • Replication. The code was reproduced line for line (vectorised regression over the previous 100 closes, ATR 14, z-score 20, entry at the signal bar's close, stop checked before target, fills at the stop or target price, risk 0.5%, one position, no costs). On the Nifty 50 index from 2008 to 2022 it made 52 trades, +2.8% in total (0.19% a year), worst drop 3.1%, Sharpe 0.18, because the 2-ATR stop sizing holds only a fifth of the account for a few days at a time.
  • Realistic version on the index (signal at close, next-open entry, gap-aware exits, futures costs and carry): +2.1% in total at 1x costs, -0.3% at 2x and -1.6% at 3x.
  • Stock portfolio (liquid Nifty 500 members, up to 8 positions sharing ₹5 lakh, 0.5% risk each, 2014 to 2025-09, delivery costs and 0.2% slippage a side): 1,204 trades, win rate 44%, average +0.6% a trade before charges. 1x costs: 0.0% a year, worst drop 43% (train 2014 to 2019: -2.9%, 36%; validation 2020 to 2025-09: +3.2%, 22%). 2x: -7.2% a year, worst drop 60%. 3x: -14.0%, worst drop 82%.
  • Robustness grid of 144 combinations (z-score limit -1.0 to -2.5, R-squared 0.2 to 0.6, regression window 60 to 150 bars, four stop and target pairs). Positive in both periods: 21% at 1x costs and 6% at 2x. None reached 8% a year with drawdown under 20% in both periods, even at 1x. The best (z -2, stop 3 ATR, target 4.5 ATR) made 1% to 5% a year at 2x costs. Wider stops and targets help; tight ones lose most.
  • Why it fails. Dips inside regression uptrends are common, but gaps through the 2-ATR stop (19% of trades lost more than 8%) and about 0.5% round-trip charges plus slippage consume the small average gain. In market sell-offs the oversold names fall together, which drove the large drawdowns in 2016, 2018 and 2020.
  • What the supplied code overstates: it enters at the same close that generates the signal, fills stops at the stop price even after gaps, and charges no costs. Each of those flatters results.

Promotion gates

FAIL
Positive after costs in both periods
As supplied: -2.9% (train) and +3.2% (validation) at 1x; negative at 2x.
FAIL
Drawdown under 20%
43% at 1x on the stock portfolio.
FAIL
Robust across parameters
6% of 144 combinations positive in both periods at 2x.
PENDING
Hold-out
Not opened; development gates failed.

Explain the strategy

The idea is to buy a good stock on a temporary dip. On paper this earned about nothing, and after fees and the habit of stocks to gap past the stop-loss it lost money.

Report

Ten best of 144 combinations by train CAGR at 2x costs (stock portfolio)

z limitR-squared minregression barsstop (ATR)target (ATR)train CAGR 2xtrain max DDvalidation CAGR 2xvalidation max DDtrades
-2.00.2603.04.51.2%17%3.1%17%585
-2.00.351003.04.51.1%16%3.0%14%522
-1.50.2603.04.50.7%12%4.1%14%617
-2.00.6603.04.50.6%17%5.1%11%547
-2.00.35603.04.50.5%14%4.9%13%544
-2.50.6603.04.50.4%14%5.2%11%470
-2.00.21503.04.50.4%16%2.1%13%518
-1.50.21503.04.50.3%12%2.4%12%513
-1.00.21503.04.50.0%12%2.9%14%521
-1.50.35603.04.5-0.1%16%2.9%13%589

Rules and parameters

Rules

  1. Signal: 100-bar linear regression of the previous closes has positive slope and R-squared of at least 0.35; 20-bar z-score of the close at or below -1.5; close above the prior close minus 2.5 ATR(14).
  2. Entry: as supplied at the signal close; realistic version at the next open plus slippage.
  3. Exit: stop at entry minus 2 ATR, target at entry plus 3 ATR, whichever is hit first (stop first inside a bar); gap-aware fills in the realistic version.
  4. Sizing: 0.5% of equity at risk per trade, capped at 15% of equity per stock; stock portfolio holds up to 8 positions, most oversold first.
  5. Costs: delivery brokerage, STT, stamp, exchange, DP charge and 0.2% slippage a side for stocks; futures costs and carry for the index; stress 2x and 3x.

Parameters

capital
₹5,00,000 (stocks), ₹10,00,000 (index, as supplied)
index window
2008 to 2022
stock window
2014 to 2025-09
train/validation
2014-2019 / 2020-2025-09
hold-out
2025-10 onward and 2023 onward (index), not loaded
code
research/meanrev/

Instrument

Nifty 50 index and liquid Nifty 500 stocks · capital ₹500,000

Known limitations

Logs and raw data

Downloads appear once a data window is loaded.

Files are plain CSV so results can be re-computed independently. Trade dates are IST sessions; returns are net of modelled costs and slippage.