Deep DiveEducational

Inside the Engine: Advanced NSE Backtesting with Sequential Filtering, Z-Score Scoring & 14 Parameters

A complete breakdown of how BacktestIndia's backtesting engine works — from basic strategy selection through multi-layer sequential filtering, Z-score composite scoring, automatic LTCG/STCG tax calculations, and 18+ years of survivorship-bias-corrected EODHD NSE data.

|18 min read|Last Updated: March 5, 2026
🔬

T. Desai

Trained and guided by Mayank Joshipura, PhD — Vice Dean-Research & Professor of Finance, NMIMS University | Editor-in-Chief, NMIMS Management Review

Systematic investing researcher and co-founder of BacktestIndia, specializing in factor investing, quantitative strategies, and Indian equity markets with 10+ years of financial research experience. About the author →

▲ Full walkthrough: Low Volatility strategy built live on BacktestIndia. Watch the engine in action.

Contents

  1. Why Science Beats Noise
  2. Basic Engine Flow
  3. Sequential Multi-Layer Filtering
  4. Z-Score Composite Scoring
  5. All 14 Tunable Parameters
  6. Tax & Real-World Costs
  7. Results Deep Dive
  8. Low Volatility Walkthrough
  9. Customization Demo
  10. SEBI Disclaimer
  11. FAQ (12 Questions)
01

In a Market Full of Noise, Choose Clarity Backed by Science

Why systematic backtesting matters for Indian retail investors

BacktestIndia's factor investing research series' advanced backtesting engine lets you test factor-based investment strategies on 18+ years of NSE data (December 2006 through December 2025) using sequential multi-layer filtering, Z-score composite scoring, and 14 tunable parameters — with automatic LTCG/STCG tax calculations applied at every rebalance. The engine covers 1,000+ stocks, includes delisted companies for survivorship bias correction, and produces gross CAGR, net (post-tax) CAGR, Sharpe ratio, max drawdown, recovery time, rolling 3-year performance, and factor correlation matrices.

Most backtesting tools available to Indian retail investors are either too simplistic (single-factor screeners with no tax modeling) or too expensive (institutional platforms costing lakhs per year). BacktestIndia fills this gap with a DIY educational tool that puts you in control — you define the factors, you set the weights, you choose the rebalancing frequency. No recommendations. No advisory. Just data and computation.

💡What you'll learn in this guide: The exact mechanics of sequential filtering, how Z-score composite scoring works, all 14 parameters explained, the tax engine's logic, and how to interpret every result metric — illustrated with the low volatility strategy from our video walkthrough.
🚀 Try the Engine Free — No Signup Required
02

Basic Engine Flow: From Template to Results

The five-step pipeline every backtest follows

Every backtest on BacktestIndia follows the same five-step pipeline, whether you use a pre-built template or create a fully custom strategy. Here is the flow:

1

Choose Strategy Template

Select from pre-built templates (Low Volatility, Multi-Factor Blend, Momentum) or start custom. Pre-built templates run instantly with no signup.

2

Set Universe & Time Period

Define market cap rank range (e.g., top 100 by market cap on date of portfolio formation). Choose backtest period within December 2006–December 2025.

3

Configure Filters

Layer 1: Ratio conditions (PE > 0). Layer 2: Composite Z-score scoring (30 lowest volatility). Unlimited sequential layers supported.

4

Tune 14 Parameters

Rebalancing frequency, transaction costs, slippage, weighting method, lookback period, number of stocks per filter, and more.

5

Run & Analyze

Engine computes gross returns, applies LTCG (12.5%) and STCG (20%) taxes, reports CAGR, Sharpe, drawdown, recovery, rolling CAGR, regime analysis, and factor correlations.

🎯Pro tip: Start with a pre-built template to see results instantly, then customize one parameter at a time to understand how each change affects performance. This is the fastest way to build intuition about factor investing in Indian markets.
03

Sequential Multi-Layer Filtering

Apply filters in stages — each layer's output feeds the next

Sequential filtering is the backbone of BacktestIndia's stock selection engine. Unlike simple screeners that apply all conditions simultaneously, sequential filtering processes criteria in ordered layers. Each layer's output becomes the next layer's input, creating progressively refined stock universes.

Example: Low Volatility Strategy Pipeline

Full NSE Universe

1,000+

Top 100 Market Cap

100

PE > 0 (Profitable)

~85

30 Lowest Volatility

30

Each arrow represents a filter layer. The engine applies Layer 1 (market cap), then Layer 2 (PE ratio), then Layer 3 (composite volatility score) — sequentially.

Why sequential matters: Applying PE > 0 before the volatility sort ensures you only rank profitable companies by volatility. This exact defensive-first sequence is what powers our Multi-Factor strategy's 14.61% CAGR with market-level drawdowns. If you applied both simultaneously, a loss-making company with artificially low recent volatility (because it crashed and stopped moving) could sneak into your portfolio. Sequence is strategy.

Advanced Example: Dual-Factor Sequential

You can chain more complex filters. For example, to combine low volatility with high momentum:

// Sequential filtering: Low Vol + Momentum
Layer 0: Market Cap Rank 1–100 → 100 stocks
Layer 1: PE > 0 (profitable only) → ~85 stocks
Layer 2: Composite Score: 60 lowest volatility → 60 stocks
Layer 3: Composite Score: 30 highest momentum → 30 stocks // Final portfolio

This gives you the 30 stocks that are both low-volatility and high-momentum — a powerful intersection that academic research (Blitz & van Vliet, 2007) suggests may outperform either factor alone. Our pure momentum backtest delivered 14.01% CAGR as the baseline this combination improves upon. The key insight: the order of filters affects the final portfolio. Low-vol first, then momentum, produces a different set than momentum first, then low-vol.

04

Z-Score Composite Scoring

Blend multiple factors with custom weights into a single ranking

Z-score composite scoring standardizes each factor to a common scale (mean = 0, standard deviation = 1), then combines them with user-defined weights. This is inspired by multi-factor models like the Carhart four-factor model, adapted for practical use on Indian equities.

How it works

  1. For each factor (PE, momentum, ROE, volatility, etc.), compute the Z-score across all stocks in the universe: Z = (value − mean) / std_dev
  2. Flip the sign for factors where lower is better (e.g., volatility: multiply Z by −1).
  3. Multiply each Z-score by its user-defined weight (e.g., 40% momentum, 30% PE, 30% ROE).
  4. Sum the weighted Z-scores to get a composite score for each stock.
  5. Rank stocks by composite score and select the top N.
FactorWeightDirectionStock A ZStock B ZStock C Z
Momentum40%Higher ↑+1.2+0.5−0.8
PE (value)30%Lower ↓−0.4+0.9+1.5
ROE30%Higher ↑+0.8−0.3+0.6
Composite Score0.840.380.31

Stock A: (0.4×1.2) + (0.3×0.4) + (0.3×0.8) = 0.48 + 0.12 + 0.24 = 0.84. PE Z-score is flipped (lower PE = higher score).

The key advantage of Z-score scoring over simple screening: it handles contradictory factors gracefully. A stock with mediocre momentum but excellent value and ROE can still rank highly if those factors compensate. Simple cutoffs would reject it entirely. The momentum + anti-speculation variant of this approach is what our Quality-Momentum strategy uses to deliver 17.95% CAGR — the highest of all strategies tested.

🎯When to use which: Use ratio filtering for hard exclusions (PE > 0 removes loss-makers). Use Z-score scoring for nuanced multi-factor ranking. Best practice: combine both in sequential layers — ratio filters first to clean the universe, then Z-score scoring to rank survivors.
05

All 14 Tunable Parameters

Every knob you can turn in the BacktestIndia engine

BacktestIndia exposes 14+ parameters that control every aspect of strategy construction and execution. Parameter 14 — scaled turnover — is explained in depth in our liquidity premium and scaled turnover analysis. Here is the complete reference:

#ParameterDefaultRangeImpact
1Market Cap Rank Start11–500Defines universe floor
2Market Cap Rank End1001–500Defines universe ceiling
3Rebalance Frequency12 months1M–3YTax impact, turnover
4Transaction Cost0.16%0–1%Brokerage + STT + stamp duty
5Slippage Factor0.05%0–2%Market impact for illiquid stocks
6Weighting MethodEqualEqual / ScoreConcentration risk
7Lookback Period12 months1–36MFactor calculation window
8Number of Stocks305–100Diversification level
9PE RatioAny floatValue / growth filter
10P/B RatioAny floatBook value screen
11ROEAny %Quality / profitability
12Momentum1–36MPrice trend strength
13VolatilityAnyRisk level (lower = defensive)
14EPS Growth, Div Yield, Turnover, BetaVariousAdditional factor controls
💡Free vs Premium: Free users can run pre-built templates with date range changes. Premium users (₹399/month) unlock all 14 parameters for full customization. Both tiers get gross and net CAGR with automatic tax calculations.
06

Tax Engine & Real-World Cost Modeling

LTCG, STCG, slippage — the gap between theory and reality

The most deceptive part of any backtest is ignoring taxes and trading costs. A strategy showing 15% gross CAGR might deliver only 11% net after STCG if rebalanced monthly. BacktestIndia's tax engine models this precisely.

How the Tax Engine Works

LTCG (Long-Term)

12.5%

Holdings sold after 12 months

₹1.25L annual exemption

STCG (Short-Term)

20%

Holdings sold before 12 months

No exemption threshold

Transaction Costs

0.16%

Applied per trade (buy + sell)

Brokerage + STT + stamp + GST

Slippage

0.05%

Market impact on execution

Higher for illiquid stocks

As shown in the video walkthrough: the low volatility strategy withannual rebalancing produced 12.85% gross CAGR and 12.38% net CAGR — a gap of only 0.47 percentage points. This narrow gap is directly because annual rebalancing keeps most positions in LTCG territory. Monthly rebalancing on the same strategy widens this gap significantly because nearly all exits trigger the 20% STCG rate.

⚠️Tax caveat: The engine models taxes at the position level per rebalance. It does not model advance tax payments, indexation benefits, or grandfathering provisions from pre-2018 holdings. Tax laws change frequently — always verify with a chartered accountant before implementing.
🔬 Build Your Own Tax-Aware Strategy
07

Results Deep Dive: Every Metric Explained

CAGR, Sharpe, drawdown, recovery, rolling CAGR, regime analysis, and factor correlations

After every backtest, BacktestIndia produces a comprehensive results dashboard. Here is what each metric means and how to interpret it:

MetricLow Vol Strategy (Gross)Low Vol Strategy (Net)Nifty 50 Benchmark
CAGR12.85%12.38%10.42%
Max Drawdown−44%−44%−55%
Recovery Time7 months7 months60 months
₹50L → (18.5 years)₹4.68 Cr₹4.32 Cr₹3.33 Cr
Annualized VolatilityLowerLowerBaseline

Data: Dec 2006 – Jun 2025 historical backtest. Hypothetical simulation only. Past performance does not guarantee future results. Source: BacktestIndia using EODHD NSE data. For passive index comparison, see our Nifty 50 vs Next 50 26-year analysis — factor strategies outperform the best passive index by 28%+ CAGR.

Additional Result Panels

Rolling 3-Year CAGR

Shows consistency. A strategy with great 18-year CAGR but 5 consecutive years of negative <a href="/blog/india-lost-decade-rolling-returns-analysis">rolling returns</a> may be hard to stick with.

Market Regime Analysis

Breaks performance across 2008 GFC, 2013 taper, 2020 COVID, bull runs. Did the strategy only work in one regime?

Factor Correlation Matrix

Shows how PE, momentum, ROE, and volatility correlate in YOUR portfolio (not the market). High correlation = redundant filters.

Top Performers & Losers

Which stocks contributed most to returns vs. dragged performance. Premium users with custom strategies see full stock names.

08

Full Walkthrough: Low Volatility Strategy

Step-by-step recreation of the video demo

Here is the exact configuration from our video walkthrough, reproduced as a reference you can replicate on BacktestIndia.com:

Low Volatility Configuration

Market Cap Range

Rank 1–100

Rebalance Frequency

12 months

Transaction Cost

0.11%

Slippage

0.05%

Filter 1 (Ratio)

PE > 0

Filter 2 (Composite)

30 lowest volatility

Weighting

Equal weight

Period

Dec 2006 – Jun 2025

Key insight from the video: The PE > 0 filter is critical — it removes loss-making companies whose low recent volatility might be an artifact of a price crash followed by stagnation. The 12-month rebalance frequency ensures most exits qualify for the lower 12.5% LTCG rate, keeping the gross-to-net gap minimal.

As the video shows, this low volatility portfolio held bigger companies with higher PE ratios and higher dividend yields compared to the overall market universe — essentially paying a premium for quality defensive stocks that delivered lower drawdowns and faster recovery. Your ₹50 lakh would have grown to approximately ₹4.32 crore net (after all taxes), versus ₹3.33 crore in Nifty — a gap of nearly ₹1 crore over 18.5 years.

For a fundamentals-based alternative that also recovered from 2008 in just 7 months, see our Value-Quality strategy delivering 11.38% CAGR with faster crisis recovery →

For a deeper analysis of the low volatility anomaly in Indian markets, see our dedicated post: Low Volatility Anomaly in India: 18-Year Backtest Results →

09

Customization Demo: What You Can Change

From the video: 'I can put my PB ratio greater than 5, 10, anything'

As demonstrated in the video, once you understand the basic flow, the real power emerges from customization. Every parameter is a lever you can pull. Here are some combinations to try:

Momentum + Value

Z-score: 50% momentum (higher) + 50% PE (lower). 30 stocks from top 200. Quarterly rebalance.

Quality + Low Vol

Sequential: PE > 0 → ROE top 60 → 30 lowest volatility. Annual rebalance for tax efficiency.

Multi-Factor Blend

Z-score: 30% momentum + 25% PE + 25% ROE + 20% low volatility. 40 stocks, top 150 market cap.

🎯 Build Your Custom Multi-Factor Strategy

Related Reading

Factor Investing in India: Complete Guide

The foundational hub page covering all factor strategies

Low Volatility Anomaly: 18-Year Backtest

Deep dive into the specific low-vol strategy from this video

Financial Glossary

Definitions for CAGR, Sharpe ratio, Z-score, LTCG, and more

⚠️ Important SEBI Disclaimer

BacktestIndia.com is a DIY educational backtesting tool. It is NOT a SEBI-registered Investment Adviser (IA), Research Analyst (RA), or Portfolio Management Service (PMS). We are classified as exempt under SEBI (Investment Advisers) Regulations 2013, Regulation 3(1)(d) — self-service analytical tools.

All backtest results shown on this page are hypothetical historical simulations. They are NOT real trading results. Past performance does NOT predict or guarantee future returns. Markets are subject to risk, and you may lose some or all of your invested capital.

We do not provide: personalized investment recommendations, suitability assessments, portfolio management services, or buy/sell/hold advice on any security. All strategies shown are 100% user-defined.

Before making any investment decision: verify all data independently, consult a SEBI-registered Investment Adviser who can assess your personal financial situation, risk tolerance, and investment goals.

Data limitations: EODHD NSE data (Dec 2006 – Dec 2025). May contain errors, gaps, or approximations. Returns are price-only (ex-dividend). Corporate actions adjusted but not guaranteed. Delisted companies included but coverage may be incomplete.

Tax disclaimer: LTCG/STCG calculations are approximate models. Tax laws change frequently. Consult a chartered accountant for actual tax implications.

10

Frequently Asked Questions

12 common questions about the BacktestIndia engine

Q1What is sequential filtering in backtesting?
Sequential filtering applies stock selection criteria in ordered layers. Each layer's output becomes the next layer's input. For example: Layer 1 picks top 100 by market cap → Layer 2 removes stocks with PE ≤ 0 → Layer 3 selects 30 lowest volatility from survivors. This creates progressively refined universes and the order matters — different sequences produce different portfolios.
Q2How does Z-score composite scoring work for Indian stocks?
Z-score scoring standardizes each factor (PE, momentum, ROE, volatility) to a common scale (mean=0, std=1), flips the sign for 'lower is better' factors, multiplies by user-defined weights, and sums to get a composite score per stock. Top N scorers form the portfolio. This is inspired by the Carhart four-factor model adapted for practical use on NSE equities.
Q3What parameters can I tune?
14+ parameters: market cap rank range, rebalancing frequency (1M–3Y), transaction cost rate (default 0.16%), slippage factor (default 0.05%), number of stocks per filter, weighting method (equal or score-weighted), lookback period, plus factor-specific settings for PE, PB, ROE, momentum, volatility, EPS growth, dividend yield, turnover, and beta.
Q4How does the tax engine handle LTCG and STCG?
The engine tracks holding periods per position. Sales before 12 months → STCG at 20%. Sales after 12 months → LTCG at 12.5% (above ₹1.25L exemption). Tax-loss offsets computed per rebalance. Both gross and net CAGR reported, showing the real take-home difference.
Q5What data source is used and is survivorship bias corrected?
EODHD NSE data from December 2006 through December 2025 — 18+ years covering 2008 GFC, 2020 COVID, and multiple bull/bear cycles. Delisted companies included for survivorship bias correction. Corporate actions adjusted. Returns are price-only (ex-dividend).
Q6Does low volatility outperform Nifty in India?
In our historical backtest (Dec 2006 – Jun 2025), a 30-stock low volatility strategy from top 100 by market cap delivered ~12.85% gross CAGR vs Nifty's ~10.42%. Max drawdown was 44% vs 55%, recovery 7 months vs 60 months. This is a hypothetical simulation — past performance does not guarantee future results.
Q7What is the difference between ratio filtering and composite scoring?
Ratio filtering is binary — stocks pass or fail hard cutoffs (PE > 0, div yield > 2%). Composite scoring is continuous — it ranks stocks on weighted Z-scores across multiple factors. A stock with mediocre momentum but great value and ROE can still rank highly in composite scoring but would be rejected by strict ratio cutoffs.
Q8Why does rebalancing frequency affect tax-adjusted returns?
India's tax law: STCG (holdings < 12 months) = 20%, LTCG (> 12 months) = 12.5%. Monthly rebalancing triggers STCG on nearly every trade. Annual rebalancing lets most positions qualify for the lower LTCG rate, significantly improving net returns. The gross-to-net gap shrinks with longer rebalancing periods.
Q9What is slippage and why does it matter?
Slippage is the difference between expected and actual execution price. When buying illiquid stocks, your order moves the market price against you. BacktestIndia models this as a configurable percentage (default 0.05%) per trade. For small-cap strategies, slippage can materially erode real returns vs backtested results.
Q10Can I combine momentum and low volatility?
Yes. Two approaches: (1) Sequential — select 60 low-vol stocks, then pick top 30 by momentum. (2) Z-score — weight 50% volatility (lower=better) + 50% momentum (higher=better), select top 30 composite scorers. Both can be backtested over the full Dec 2006–Dec 2025 period.
Q11How do I interpret the Sharpe ratio?
Sharpe = CAGR ÷ annualized standard deviation. It measures return per unit of risk. Above 0.5 is acceptable for equities; above 1.0 is strong. Compare strategy Sharpe to Nifty Sharpe — if your strategy has higher CAGR but also higher Sharpe, the extra return more than compensated for any extra risk.
Q12What market regimes does the 18-year period cover?
2007-08 Global Financial Crisis (Nifty fell 55%), 2010-11 European debt crisis, 2013 taper tantrum, 2016 demonetization, 2018 IL&FS/NBFC crisis, 2020 COVID crash (Nifty fell 38%), and the 2021-25 post-COVID bull run. BacktestIndia's regime analysis shows strategy performance across each distinct period.

Ready to Build Your Own Factor Strategy?

Pre-built templates run instantly — no signup needed. Try the low volatility strategy from this video, then customize every parameter.

🚀 Launch BacktestIndia — Free

Educational tool only. Not investment advice. Past performance ≠ future results.