Backtesting: settings, costs and metrics
How a backtest runs, what it charges, and what each number means.
6 min read
Setting one up
- Target Strategy - any strategy you have saved.
- Type of Backtest - a standard run, Monte Carlo (many simulated variations of the run, to see the spread of outcomes), Walk-Forward (test on periods the settings were not tuned on) or Optimize (try ranges of a parameter).
- Timeframe - the bar size the strategy reads.
- Dates, starting capital and sizing - how much each trade uses.
Costs
Every simulated fill pays brokerage on your plan (Settings -> Charges & Brokerage) plus the statutory charges - STT, exchange fees, SEBI fees, stamp duty and GST - as a real one would. The results show the total under Charges.
The numbers
- Win Rate - the share of closed trades that made money.
- Profit Factor - money made on winning trades divided by money lost on losing ones. Above 1 means the winners outweighed the losers.
- Max Drawdown - the largest fall from a peak in the equity curve, the worst stretch you would have sat through.
- Sharpe Ratio - return per unit of volatility. Higher is steadier; it says nothing about rare large losses.
- Charges - everything the fills paid.
What the run also tells you
- Orders the engine refused - orders the rules wanted that a real broker would also refuse (for example, selling short in the cash delivery segment).
- Sized as a bot - how each entry was sized, and how many entries the capital could not take.
- Left out of this run - for an asset bag, the symbols the run skipped, each with its reason (an equity run skips an index).
- Still held when the window ended - positions still open on the last day. Their profit or loss is in the total, not in the closed trades.
- About the data - splits and bonuses found in the prices, and for an asset bag, how its members were chosen.
In the app (after you sign in): Go to Backtest.