New: the web-based algo terminal is liveLaunch terminal

Backtesting a Trading Strategy With Costs and Slippage

Make historical strategy research more realistic by modeling trading costs, order assumptions and limitations.

Dark Logic Algo3 min read
Dark Logic Algo graphic showing an options chain, payoff chart, equity curve and trading presenter
Illustration accompanying this Dark Logic Algo guide.

A backtest is only as realistic as its assumptions

A backtest applies a strategy to historical data and estimates how it might have behaved under a chosen set of rules. If the simulation assumes every order fills at a candle’s closing price with no delay, spread or fees, the result may not resemble a live workflow. Record data source, timestamp rules, order type, signal timing and fill assumptions. Make clear whether a signal is evaluated at the bar close and whether an order can execute only afterward. This prevents a common timing error in which the strategy uses a final bar value and also assumes a fill at that same value. Historical calculations are useful for analysis but are not observed live performance.

Include costs that apply to the account

Depending on the instrument and venue, trading costs may include brokerage, exchange charges, statutory levies, taxes, spread and data or platform fees. Use the current schedule that applies to the relevant account and verify it with the broker or official sources. Costs may vary by product, order and turnover. A strategy with high turnover can be especially sensitive to small per-trade frictions. Report results before and after costs so readers can see how assumptions affect the outcome. Avoid using a single broad cost estimate without explaining its basis. If you do not know a cost, mark it as an uncertainty and test a range rather than hiding it.

Model fills and slippage cautiously

Slippage is the difference between an assumed price and the price available when an order is actually executed. It can vary with volatility, liquidity, order size, spread and latency. A market order may prioritize execution but not a specific price; a limit order controls the price condition but may not fill. A daily candle usually cannot reveal the exact queue position or intrabar path needed to reproduce all fills. Use conservative scenarios and, if possible, compare simulation with observed small-scale execution data. Do not tune slippage until the backtest looks favorable. Explain what the historical data cannot tell you and how the fill model may understate risk.

Report robustness, not a single headline number

Evaluate the strategy across different time periods and market conditions, and reserve data that was not used to choose its parameters. Compare to a simple baseline and inspect drawdowns, turnover, losing streaks and sensitivity to modest parameter changes. Include costs consistently across all comparisons. A strategy that works only under one precise setting may be fragile. Document survivorship or look-ahead risks in the data and avoid claiming the result forecasts future returns. A careful backtest can identify weaknesses and help formulate questions; it cannot guarantee a live outcome or remove the financial risks of trading.

Ready to try it yourself?

Open the web terminal and test your rules with built-in risk controls.

Launch web terminal
Back to all articles
Dark Logic Algo

Explore the platform

Choose the platform that fits your workflow. Review the setup guide and risks before connecting a live broker account.

Upstox for Windows

Desktop package for the Upstox API workflow.

Download Upstox

Dark Logic Algo is software, not investment advice. Trading involves risk and does not guarantee income or returns.