- Home
- Skills
- Trading & Investing
- India Swing Backtester: Honest NSE Returns After Costs & Tax
More screenshots
Works with the AI Agents you already use
India Swing Backtester: Honest NSE Returns After Costs & Tax
Most swing-trading backtests of Indian stocks look great because of bugs, not edge.
$12
India Swing Backtester: Honest NSE Returns After Costs & Tax
Example session with this skill installed
naive_backtest.py backtests a 20/50 SMA crossover on 10 NSE
stocks using prices.csv, and it shows 17.6% CAGR. Before I put Rs 5 lakh
into this in my delivery account, rebuild it as an honest backtest and tell
me what I would really keep, and whether it beats just buying the Nifty ETF.
- Read your context and instructions
- Compiled the india swing backtester
Verdict: don't run it. It beats the ETF only because two of the 10 hand-picked
stocks went up 16x and 35x. Buying and holding the same stocks beat trading
them, and in its first 9 years the strategy lost money.
Honest CAGR (after costs and tax): 12.0% vs Nifty ETF: 6.8% (after tax)
vs buying and holding the same stocks equally: 13.9% (after tax)
Max drawdown: -38.6% Longest time below a previous peak: 108 months (9 years)
Honesty gap: original 17.6% -> honest 12.0%
next-day fills, 5 slots, interest on cash -2.4 pts (data fixes added +0.5)
charges and slippage -2.3 pts
tax -1.4 pts
First 9 years vs last 5: 1.7% vs 33.7% a year (ETF: -0.7% vs 21.2%)
Robustness: fairly smooth, but slower settings are better (10/30: 7.3% ... 30/100: 16.6%).
In every setting, 2012-2020 is below the 6.5% liquid-fund rate.
Monte Carlo (10 yr): 5th pct Rs 5.7L, median Rs 15.3L, P(loss) 3.3%
(it reuses the 2020-25 boom, so this is optimistic)
Kelly (first 9 years only): f* = -1.49 (capped to 0); suggested exposure: 0%
Biggest caveats: the stock list was picked in hindsight, I made one data fix
I couldn't verify (DEVGRID), and charges and tax rates are approximate 2025-26 values.
Connects securely to your tools. The creator never sees your data.
About this skill
Most swing-trading backtests of Indian stocks look great because of bugs, not edge. The signal from today's close earns today's return. Nobody pays STT, stamp duty, DP charges or slippage. Short-term gains are never taxed. Cash earns zero. And free Yahoo data quietly breaks things: one missing day blanks a 200-day average for 200 days, and an unadjusted demerger shows up as a 40% crash.
India Swing Backtester makes your agent build (or repair) an event-driven daily backtester for NSE delivery trades that reports what an Indian retail account would really have kept:
- Decide at the close, fill at the next open. Stop-losses too, gap included. No future data in any indicator.
- Real delivery charges. STT, stamp duty, exchange and SEBI fees, GST, brokerage, DP charge and slippage: about 0.5% a round trip.
- Indian capital-gains tax. STCG 20% and LTCG 12.5% above Rs 1.25 lakh, plus cess, netted per financial year with the set-off rules and paid from cash every April; the last year and open positions are taxed at the end, like the ETF benchmark.
- Idle cash earns a liquid-fund rate, so "in cash" is a fair baseline.
- Data repair first. Fills stray missing days, finds and rescales demerger steps, cleans ETF bad ticks, skips locked-circuit days and warns about survivorship bias.
- Validation. Build/test split, a robustness grid, a block-bootstrap Monte Carlo of 10-year outcomes, and continuous Kelly f* = (mu - rf) / sigma^2 from the build period, capped at 1.
You get an honesty ledger (original number -> next-open fills -> charges -> tax), a comparison with a Nifty ETF bought and held, and a verdict line first: run it, paper-trade it, or don't.
The package is a SKILL.md plus four references with tested Python code (engine, data repair, validation) and an Indian costs-and-tax guide. No scripts run from the package, no network calls, no setup.
Requires: an agent that loads SKILL.md skills (Claude Code or another Agent Skills compatible agent) and Python 3.10+ with pandas and numpy in the project where the backtest runs. Price data from you, or from yfinance if you have none.
Known limitations
- Long-only delivery (CNC) trades on daily bars. Not for intraday, F&O or options; their costs and taxes differ.
- Charges are approximate 2025-26 values. Check them against your own contract note. This is research tooling, not tax or investment advice.
- Tax uses the rates for sales from 23 July 2024 (STCG 20%, LTCG 12.5% above Rs 1.25 lakh, Finance (No. 2) Act, 2024) for every year of the backtest, a stated simplification. For exact historical tax, supply a dated rate table keyed on each sale date.
- Surcharge, advance-tax timing, dividend tax and the 8-year limit on loss carry-forward are not modelled.
- It cannot fix survivorship bias in your data, only warn about it.
- Results depend on your data quality; every repair is shown for review.
FAQ
Will it work with my existing backtest? Yes. It keeps your strategy rules, moves them onto the engine and shows how much each fix changed the result.
Does it place trades or connect to a broker? No. It only builds and runs backtests in your project.
Can I use other strategies? Any daily long-only rule set: crossovers, momentum rotation, breakouts, dip buying.
BSE stocks? Yes, same costs and tax; use .BO tickers.
Long-only delivery (CNC) trades on daily bars. Not for intraday, F&O or options; their costs and taxes differ. Charges are approximate 2025-26 values. Check them against your own contract note. This is research tooling, not tax or investment advice. Tax uses the rates for sales from 23 July 2024 (STCG 20%, LTCG 12.5% above Rs 1.25 lakh, Finance (No. 2) Act, 2024) for every year of the backtest, a stated simplification. For exact historical tax, supply a dated rate table keyed on each sale date. Surcharge, advance-tax timing, dividend tax and the 8-year limit on loss carry-forward are not modelled. It cannot fix survivorship bias in your data, only warn about it. Results depend on your data quality; every repair is shown for review.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 9 days ago