How to backtest a trading strategy without fooling yourself
Backtesting means running a strategy’s rules on historical data to see what would have happened. It’s the cheapest way to throw out bad ideas, and also the easiest way to fool yourself.
Last updated: 11/06/2026 · 7 min readWhat is backtesting?
A backtest takes a strategy with clear rules (“buy when…”, “sell when…”) and applies them candle by candle to the price history, as if it were trading at that moment. The result is a list of trades and a set of metrics: how much it would have made or lost, how deep the drops were and how often it traded.
It only works with strategies defined as rules. If a strategy relies on “gut feeling”, it can’t be tested, which is why turning it into a bot first is so useful.
How to backtest step by step
- Define closed rules: entry, exit, position size and stop. No “it depends”.
- Pick the period: long and varied. In crypto, include at least one big rally and one big crash.
- Set realistic costs: fees per trade and slippage (the price you actually get filled at).
- Run it and read the metrics (the ones that matter are below).
- Validate out of sample: keep a stretch of data you didn’t use for tuning and check the strategy holds up there.
- Paper trade it before using real money.
The metrics that matter
| Metric | What it tells you | Red flag |
|---|---|---|
| Total return | What it would have made over the period | Far better than the asset itself, with no explanation |
| Max drawdown | The largest drop from a peak | More than you could stomach |
| Number of trades | Whether the sample is big enough | Fewer than 30–50: could be luck |
| Win rate | How many trades win | Read without average win/loss size |
| Profit factor | Gross profit / gross loss | Below 1.2 after costs |
| Sharpe ratio | Return per unit of volatility | Very high values with few trades |
Always compare against the simplest alternative: buy and hold the same asset. If your strategy doesn’t beat it after costs, with smaller drawdowns, it may not be worth it.
The mistakes that inflate results
Overfitting
Tuning parameters until the past looks perfect. The strategy ends up “memorising” the history and fails on new data. Few parameters, round values and out-of-sample validation are the best defence.
Look-ahead bias
Using information that didn’t exist yet, such as the close of a candle that hadn’t finished. A good backtesting engine only evaluates closed candles.
Ignoring costs
Fees, slippage and, for futures, funding. For strategies that trade a lot, costs decide whether you win or lose.
A period that is too short or too friendly
A backtest run only during a bull market says little. Test across different market regimes.
Backtesting in Bot Shaper
- Quick backtest in the chat: when you create a bot, Shaper tests it and shows you the key numbers.
- Backtesting Lab for longer runs, on real Kraken and Binance history with configurable fees and slippage.
- Every backtest is saved with the bot version it ran on, so you can compare changes.
- Then the bot moves to the practice account with live prices to validate it in the present.
You can start from one of the strategy templates and run its backtest without setting anything up.
FAQ
Does a good backtest guarantee profits?
No. A backtest shows how a strategy would have performed in the past. You need it to rule out bad ideas, but it doesn’t guarantee future results.
How much data do I need for a reliable backtest?
Enough for dozens of trades and several types of market. In crypto, one or two years of hourly or 4-hour candles is a good starting point.
Where can I backtest for free?
Several tools have a free tier. In Bot Shaper you can run backtests with the 1,000 free credits you get at sign-up, no card required, on real Kraken and Binance data.
Templates to start with
Keep reading
- How to build a trading bot without codingA step-by-step guide to building a trading bot with no code: turn your strategy into rules, backtest it and run it on paper before you risk real money.
- AI trading agents vs trading bots: what’s the difference?What an AI trading agent is, how it differs from a classic trading bot, what it can really do and what it can’t. With examples and the risks to watch for.