Crypto course · Section 6: Pro: Systems, Testing and Your Trading Plan
How to Backtest a Crypto Trading Strategy Properly
Backtest a crypto strategy without fooling yourself: avoid look-ahead bias, survivorship bias from dead coins and overfitting, and include real costs.
Pro6 min read·6:18 video·Lesson 22 of 26·quiz: 4 questions
▶ Video lesson · 6:18Watch on YouTube ↗
On this page +
Backtesting means applying exact trading rules to past prices to see how they would have performed. A useful backtest uses only information that was available at each moment, includes coins that later collapsed or were delisted, charges realistic fees and slippage, and is checked on data it was not tuned on. Skip any of those and the result will almost always look far better than live trading turns out.
Step 1: Write rules a computer could follow
"Buy strong coins in an uptrend" cannot be tested. This can:
- Universe: the 20 largest coins by market value at each date, excluding stablecoins.
- Entry: daily close above the previous 20-day high; buy at the next day's open.
- Stop and exit: the 20-day channel midpoint, checked on daily closes.
- Size: 1% risk per trade; maximum five positions.
- Costs: 0.1% fee per side plus 0.1% slippage per side.
If two people could read your rules and take different trades, the rules are not finished.
Step 2: Get honest data
- Use daily candles from a reliable source, with a consistent close time (00:00 UTC on most exchanges).
- Include delisted and collapsed coins. Free data sources often drop them, which is a silent but serious problem.
- Use the same exchange you would trade on, or an index of several, and check for gaps and obvious errors such as zero prices.
The three biases that ruin backtests
Look-ahead bias
Using information that was not available when the decision was made.
Example
The rule says "buy when today closes at a 20-day high", but the backtest records the entry at today's open. In reality, at the open you do not yet know the close. Because breakout days usually close well above their open, this mistake can add several percent to every winning trade, entirely by cheating. The fix: enter at the next open, or at the close only if you genuinely can act at that moment.
Other forms: picking coins using today's market value, adjusting data with full-period averages, or using a fundamental figure before it was published.
Survivorship bias
Testing only on assets that survived to today.
Example
You test on today's 20 largest coins from 2019 onward. By construction, every one of them grew enough to be on today's list. Meanwhile coins that were once among the largest and then collapsed, such as LUNA in May 2022 or FTT in November 2022, are missing. A long strategy that would have bought them during their rise and been caught in their crash looks better than it was. The fix: rebuild the universe at each date from the coins that were largest then, and keep dead coins in the data until they stopped trading.
Overfitting (curve fitting)
Searching many settings and keeping the one that looked best on past data.
Example
You test lookbacks from 5 to 100 days (96 values) and stop distances from 1 to 5 ATR in steps of 0.5 (9 values): 864 combinations. Even on random data, some combination will look excellent purely by chance. The more you search, the more the best result reflects noise.
Defences:
- Out-of-sample testing: choose the settings on one period (for example 2019 to 2023) and test them, untouched, on a later period (2024 onward).
- Walk-forward testing: repeat that process step by step through time, so every result comes from settings chosen only with earlier data.
- Neighbourhood check: if 20 days works, 15 and 30 days should work reasonably too. A spike of performance at one exact setting is a warning.
- Fewer parameters: simple rules with common default settings are harder to overfit.
Costs: the silent killer
Example
A short-term strategy makes 300 trades a year with an average gross profit of +0.15% per trade. Fees of 0.1% per side plus slippage of 0.05% per side cost 0.3% per round trip. Net result: 0.15 - 0.30 = -0.15% per trade. A strategy that looks profitable before costs loses money after them.
Include fees, slippage (larger for small coins and breakouts), and for futures, funding payments.
What to measure
| Metric | Why it matters |
|---|---|
| Number of trades | Small samples prove little |
| Win rate and average win and loss in R | The shape of the edge |
| Expectancy per trade, after costs | Whether it makes money at all |
| Maximum drawdown | The worst fall from a peak you would have lived through |
| Results by year | One great year can hide many bad ones |
| Exposure | How often money is actually invested |
| Comparison with holding Bitcoin | Whether all the work beat the simple alternative |
Sample size
Example
A backtest has 30 trades and a 40% win rate. The statistical uncertainty is roughly the square root of (0.4 x 0.6 / 30), about 9 percentage points, so a rough 95% range for the true win rate is 22% to 58%. With 300 trades the range narrows to about 34% to 46%. Small samples cannot tell a good strategy from a lucky one.
From backtest to live trading
- Backtest with honest data and costs.
- Out-of-sample or walk-forward test.
- Paper trade forward for at least a few months, recording every signal at the time it happens.
- Trade live small, for example at a quarter of planned risk.
- Compare live results with the backtest regularly. Some drop is normal; a large, persistent gap means something is wrong.
DanioX publishes this kind of comparison. Signal Backtests shows every setup tested the same way, with fees and per-year results, next to its live record, and Methodology documents how the site's market scores are calculated, input by input. Results change as new data arrives, so read the current numbers there rather than any figure quoted elsewhere.
Risk
A good backtest is evidence, not a promise. Markets change, and a strategy that worked from 2019 to 2025 can stop working. Plan in advance what live result would make you stop trading it.
Tip
Write down your test design, the date range, the universe and the number of settings you tried, before you look at results. Keeping that record honest is the best protection against fooling yourself.
Next, the hardest part of following any tested system: Trading Psychology and Journaling.
Key takeaways
- A backtest applies exact rules to past data; vague rules cannot be tested.
- Look-ahead bias uses information that was not available at decision time and makes results look far better than reality.
- Survivorship bias comes from testing only coins that exist today; include coins that collapsed or were delisted.
- Testing hundreds of settings and keeping the best one fits noise; hold back out-of-sample data and check neighbouring settings.
- Charge realistic fees, slippage and funding, and compare the result with simply holding Bitcoin.
Quiz: check what you learned
0/4 answeredAnswer every question to finish the lesson. Wrong answers are fine: read the explanation and try again.
⚠ Not financial advice — educational signals only. Read the disclaimer.