Skip to main content

How backtesting works

Who it’s for
Everyone who builds a strategy
Assumes
You have a strategy assembled
Applies to
Every market, every timeframe

A backtest runs your strategy's exact rules over real historical market data and reports what happened, net of costs. Every assembled strategy can be backtested in one action, and the result is graded automatically.


What actually runs

Preparation. The strategy object is read, 1-minute OHLCV is fetched, resampled to your timeframe, and indicators are warmed up.

Then, for each bar at candle close, in order:

CheckEffect
Entry conditionOpens a position and charges entry costs
Exit conditionCloses the position and charges exit costs
Stop-lossCloses the position. If a stop and a target fall inside one candle, the stop is assumed to fill first
Take-profit ladderCloses all or part of the position
Trailing levelsUpdates the protective or profit-side line
Session, window and time exitsForce-closes at a boundary or cutoff

Afterwards. Metrics are computed, the assessment and grade are derived, and the result is stored and addressable by its reference id.

Every trade is logged with its actual candle prices, its fill, its costs, and the reason it opened and the reason it closed.


Costs are applied

Correcting earlier documentation

Earlier docs said a backtest assumes "perfect order execution and no slippage." That was wrong.

Every run applies modelled slippage, commission, and, where the market has them, statutory transaction charges. Indian equity is charged STT at the intraday or delivery rate depending on holding period; Indian F&O carries its own family including stamp duty, exchange transaction charges, IPFT, the SEBI turnover fee and 18% GST on the fee components; crypto spot carries a 10 bps exchange fee per leg.

Your results are already net of costs. If you were discounting them further, you were double-counting.

The full schedule per market: Fees & charges.


The window

By default, 1 January 2024 to now, the same for every timeframe and asset class. There is no timeframe-dependent default, and no backtest can start earlier.

You can state your own period in the chat:

backtest the last 6 months
backtest from 2025-01-01 to 2025-06-30
backtest the last 3 months with 5 lakh

See Choosing a test period and Historical data.


The four headline metrics

Read them in this order. Return is last, not first.

1. Total trades

Under 20 and nothing else on the page means much. Sample size is one of five grading components for exactly this reason.

2. Max drawdown

The largest peak-to-trough decline in the equity curve. Convert it to money on the capital you would actually allocate, 22% of ₹10 lakh is ₹2.2 lakh, and ask whether you would have held.

Reported with its duration, its dates, and its recovery time. A drawdown that never recovered within the window reports recovery as absent, not as zero.

3. Sharpe ratio

Mean daily return divided by its standard deviation, annualised. Risk-free rate taken as zero.

SharpeReading
> 2.0Exceptional and rare enough to be worth double-checking
1.0 - 2.0Good
0.5 - 1.0Marginal
< 0.5The volatility is not being paid for
NegativeUnderperforms holding cash

Equity annualises on 252 trading days, crypto on calendar days. So the two are not directly comparable.

4. Total return

Net of costs. Reported alongside gross return, so the gap is your cost drag, the most useful single diagnostic for an over-trading strategy.

Full reference for every figure: Performance metrics.


Six grades

A, B+, B, C+, C, D: from a 0-100 score across five components:

ComponentPoints
Return30
Sharpe25
Drawdown25
Consistency (profit factor and win rate together)15
Sample size5
GradeScore
A≥ 85
B+≥ 72
B≥ 62
C+≥ 52
C≥ 42
Dbelow 42

A zero-trade run is graded D immediately.

A grade is a threshold score, not a verdict

Grade A means the run scored 85 or more over the window tested. It is not a detection of edge, not a forecast, and not a recommendation to deploy.

Full formula, thresholds and the assessment labels: Strategy grades.

Illustrative, ETH/USDT 1m
AStrong edge detected
Total Return+18.4%
Sharpe Ratio1.72
Max Drawdown-7.1%
Win Rate61%, 284 trades
Past performance does not guarantee future results. Treat the grade as guidance, not a promise.
Illustrative, equity 5m
DNot recommended
Total Return-14.2%
Sharpe Ratio-0.41
Max Drawdown-31.8%
Win Rate38%, 97 trades
Past performance does not guarantee future results. Treat the grade as guidance, not a promise.

The detailed results page

View Full Backtest from the chat opens the tabbed view:

TabContents
OverviewHeadline metrics, monthly performance table, volatility, profit factor, the assessment
PerformanceThe full equity curve
TradesEvery trade, entry, exit, P&L, and why it opened and why it closed
RiskDrawdown curve, VaR(95), expected shortfall, risk-adjusted metrics
MarketsPer-asset breakdown for dynamic strategies
The Trades tab is the most under-used

Each row carries the reason the trade opened and the reason it closed. That is how you discover that 80% of your exits were stop-losses rather than your exit condition, a fact no aggregate metric will tell you.


Pass / fail, separate from the grade

A result also carries a boolean pass against objective-aware thresholds:

ObjectiveMin win rateMin profit factor
intraday40%Not enforced
positional40%1.2

Trade count is not gated. A failing result is shown in full with every metric. Nothing is hidden.


Multi-symbol and dynamic runs

Multiple symbols ("backtest this on ETH and BTC") runs the same strategy independently on each, each with the full starting capital. Two standalone experiments, not a portfolio.

A dynamic strategy trades a universe: it evaluates every asset on each candle and trades the top-ranked ones. The Markets tab shows per-asset performance, useful for finding which instruments carried the result and which dragged.

These are different mechanisms and the distinction matters. See Dynamic & universe strategies and Backtest limitations


Next