Methodology

Transaction Costs in Backtests: Brokerage, STT, Stamp Duty and GST

Transaction costs turn a paper strategy into a real one. A guide to the categories of Indian trading cost, how to model them in a backtest, and how turnover multiplies the drag.

A backtest that ignores transaction costs is not a test of a strategy. It is a test of an idea in a world without friction, and that world does not exist. In Indian equities every trade carries a stack of charges: brokerage, statutory levies, exchange fees, regulatory fees, tax on the service components, and depository charges. Model them properly and many strategies that looked attractive on paper become ordinary. Model them badly and you will not find out until real money is involved.

This article covers the categories of cost, how to represent them inside a backtest, and why turnover is the variable that decides whether costs are a footnote or the whole story.

The categories of cost

Rates and thresholds are set by regulation and by commercial agreement, and both change over time. So treat the list below as a map of the categories you must account for, then look up the current schedule for the segment and period you are testing.

  • Brokerage. What your broker charges to execute. It may be a flat amount per order, a percentage of traded value, or a negotiated institutional rate. It differs by segment (delivery, intraday, derivatives) and by client type.
  • Securities transaction tax. A statutory levy on transactions in listed securities. It applies differently across segments and, in some segments, differently to the buy and the sell leg. It is charged on traded value, so it scales directly with how much you trade.
  • Stamp duty. A duty on the transfer of securities, charged on the buy side and levied on traded value. The structure was standardised in recent years, so historical periods may not match the present regime.
  • Exchange transaction charges. Fees levied by the exchange on turnover. They differ by exchange and by segment.
  • Regulatory turnover fees. Charges levied by the market regulator on turnover.
  • Goods and services tax. Applied to the service components of the bill, principally brokerage and exchange charges, rather than to the statutory levies themselves.
  • Depository charges. Typically a per scrip charge on delivery sales, collected via your broker. Because it is often a flat amount per stock per day, it hits small positions disproportionately.

Two structural points matter more than any individual rate.

First, some charges are proportional to traded value and some are fixed per order or per scrip. Proportional charges scale with position size. Fixed charges do not, which means they are nearly invisible on a large order and punishing on a small one. A strategy that holds fifty small positions and rebalances them all pays fixed charges fifty times.

Second, most of the stack is charged on both legs. You pay to get in and you pay to get out. When you size a cost assumption, be clear whether you are quoting a one way cost or a round trip cost, and make sure your backtest applies it the way you intended. Confusing the two is one of the more common quiet errors in backtesting.

How to model costs in a backtest

The practical approach used by most desks is to express cost as a fraction of the value traded, then charge it on every unit of turnover the strategy generates.

The steps are unglamorous:

  1. Decide the cost basis. Build an all in one way cost as a percentage of traded value, assembled from the categories above for the segment you are testing. Keep the components visible rather than collapsing them into a single mystery number, so you can see which assumption is doing the work.
  2. Charge it on turnover, not on holdings. Costs are incurred when you trade. If a rebalance sells fifteen percent of the portfolio and buys fifteen percent back, the cost applies to that thirty percent of traded value, not to the whole portfolio.
  3. Handle fixed charges separately. If a meaningful part of your cost is per order or per scrip, you cannot express it as a pure percentage. Model it against the number of positions and the average position size, because that is what determines its bite.
  4. Do not net the legs. Sells and buys both incur charges. Netting them understates cost.
  5. Run a sensitivity band. Test the strategy at a low, base and high cost assumption. If the conclusion flips between the low and the high case, the strategy is a cost story, not an alpha story, and you should say so plainly. This is the same discipline described in sensitivity analysis.

A useful sanity habit is to report the strategy’s gross return, the total cost charged, and the net return as three separate lines. When costs are buried inside a single net number, nobody can audit the assumption, and unauditable assumptions are where backtests go to hide.

Turnover is the multiplier

The single figure that determines whether costs matter is turnover, meaning how much of the portfolio is traded over a year. A cost that is trivial once becomes serious when it is paid repeatedly.

Take a purely hypothetical illustration. Suppose an all in round trip cost of 0.5 percent of traded value. A strategy that turns the portfolio over once a year pays roughly 0.5 percent annually. A strategy that turns over four times a year pays roughly 2 percent. A strategy that turns over twelve times pays roughly 6 percent. The strategy did not become worse. The cost assumption did not change. Only the frequency changed, and it changed the outcome by several percentage points a year.

This is why the honest way to present a backtest is to state turnover alongside return. A high turnover result with no stated cost assumption is not evidence of anything. It is also why rebalancing frequency changes backtest results so dramatically, and why portfolio turnover belongs on the front page of any strategy report rather than in an appendix.

Costs are not the same as slippage

Transaction costs are the charges on the bill. They are knowable in advance, at least approximately, because they come from a published schedule.

Slippage is different. It is the gap between the price your model assumed and the price you actually got, caused by the spread, by the market moving between your decision and your fill, and by the effect of your own order on the price. It does not appear on any schedule and it is far harder to estimate. A backtest that charges brokerage and statutory levies but assumes execution at the closing price has modelled only half the friction. That half is covered in slippage and impact cost, and the two must be modelled together.

Taxes sit in a separate bucket

Capital gains tax is a real drag on a trading strategy, but it is not a transaction cost in the same sense. It depends on the holding period, on the investor’s overall tax position, and on rules that change. Most desks keep it out of the core backtest and instead report turnover and average holding period, so a reader can reason about the tax consequences for their own circumstances. The mechanics of how rebalancing interacts with holding periods are covered in tax on portfolio rebalancing in India.

The important discipline is to be explicit about which drags are inside your number and which are not. A “net of costs” line that silently excludes tax is not wrong, but it is only honest if it says so.

What cost modelling does not tell you

Cost modelling is necessary and it is not sufficient. Here is what a careful cost model still leaves out.

  • It does not capture the price you could not get. A percentage charge on traded value says nothing about whether the trade was fillable at the price you assumed. That is a liquidity question, covered in liquidity constraints in backtesting.
  • It assumes a constant cost regime. Rates, brokerage structures and the stamp duty framework have all changed over the years. A single flat assumption applied to a decade of history is an approximation, and the further back you go the rougher it gets.
  • It averages across very different trades. A large liquid position and a small illiquid one attract quite different real costs, especially once fixed charges and spreads are counted. One blended number hides that spread.
  • It cannot rescue a bad idea. Charging costs correctly makes a backtest honest. It does not make the underlying signal real. Costs are one of several realism layers, alongside survivorship bias and overfitting.
  • It is not a forecast. Your future cost depends on your broker, your size, and rules that may change. The backtest number is a reasoned estimate under stated assumptions, nothing more.

A backtest without a stated cost assumption is not conservative or aggressive. It is simply unfinished.

The practical takeaway is small and boring: write the cost assumption down, show it as its own line, state the turnover it is charged on, and test whether the conclusion survives a higher assumption. Strategies that survive that treatment are worth more discussion. Strategies that do not were never really there.

This article is educational. Altys Labs is not a registered research analyst or investment adviser, and nothing here is investment advice or a recommendation to buy, sell, or hold any security.

Frequently asked questions

Why do transaction costs matter so much in a backtest?

Because costs are charged on every trade, and a strategy that trades often pays them many times a year. A cost assumption that looks trivial on a single trade can consume a large share of a high turnover strategy's gross return. Ignoring costs does not shrink the result slightly, it can change the conclusion entirely.

What costs apply when trading Indian equities?

The main categories are brokerage charged by your broker, statutory levies such as securities transaction tax and stamp duty, exchange transaction charges, regulatory turnover fees, goods and services tax on the service components, and depository charges on delivery sales. The exact rates are set by regulation and by your broker, and they change over time, so always check the current schedule.

Should capital gains tax be included in a backtest?

It is usually modelled separately from transaction costs, because it depends on the investor's holding period, tax status and other income. Many desks report a pre tax backtest alongside a note on expected turnover, so a reader can judge the likely tax drag for their own situation.