Robin Singh
By Robin Singh • Founder
Updated Nov 23, 2026
This article has been fact checked and reviewed as per our editorial policy.

What is Backtesting in Crypto?

A trading strategy might look great on paper, but how do you know it'll actually work? Before risking real money, you can use backtesting to see how your strategy would have performed against historical market data.

Backtesting is a useful way to test trading ideas, identify weaknesses, and fine-tune entry and exit rules without putting capital on the line. It's particularly valuable in crypto, where volatility can create plenty of trading opportunities but also plenty of ways to lose money.

Whether you're developing a simple crypto trading strategy or experimenting with more complex technical indicators, here's how crypto backtesting works, how to do it, and which tools are worth considering.

What is backtesting in crypto?

Crypto backtesting is the process of testing a trading strategy against historical cryptocurrency market data to see how it would have performed.

Rather than waiting for a trading opportunity to appear in the live market, you apply your strategy's rules to previous price movements and simulate the trades it would have generated.

For example, imagine you've developed a Bitcoin trading strategy based on moving averages. Your rules might be to buy whenever the 50-day moving average crosses above the 200-day moving average and sell when it crosses below.

Backtesting lets you apply these rules to historical BTC price data to see when the strategy would have generated buy and sell signals, how much each trade would have made or lost, and whether the overall approach would have been profitable.

You can also experiment with different indicators, timeframes, stop-loss levels, and take-profit targets to see how they affect performance.

There are two main approaches to backtesting:

  • Manual backtesting: You review historical price charts yourself and identify where your trading rules would have generated signals. You then record the hypothetical trades and calculate the results.

  • Automated backtesting: You use software to apply predefined trading rules to historical data and calculate the results automatically. This is generally faster and makes it easier to test multiple variations of a strategy.

Backtesting can help you understand whether a strategy has historically performed well, but it doesn't guarantee future profits. Market conditions change, and a strategy that worked during one bull market might struggle during a prolonged downturn or sideways market.

How to backtest a crypto trading strategy

Backtesting a crypto trading strategy involves applying a set of predefined trading rules to historical market data and recording the trades those rules would have generated.

You can do this manually using historical charts and a spreadsheet, or automate the process using a dedicated backtesting tool.

Here's how to approach it.

1. Choose a strategy and define your rules

Start by deciding what you want to test. This could be a trend-following strategy, moving average crossover, breakout strategy, or something more complex.

Your rules need to be specific enough that you can apply them consistently. For example:

  • Buy Bitcoin when the 50-day moving average crosses above the 200-day moving average.

  • Sell when the 50-day moving average crosses below the 200-day moving average.

  • Risk no more than 1% of your trading capital on each position.

Avoid vague rules like buying when the market looks bullish. You need clear conditions for every entry and exit.

2. Choose your cryptocurrency and timeframe

Next, decide which asset and timeframe you want to test.

You might start with Bitcoin or Ethereum because they have extensive historical price data and relatively high liquidity.

Your timeframe should match the strategy you're testing. A scalping strategy might use one-minute or five-minute candles, while a swing trading strategy could use four-hour or daily charts.

Ideally, your historical data should cover different market conditions, including bull runs, bear markets, and periods of sideways trading.

3. Gather historical market data

You'll need historical price data to see how your strategy would have performed.

At a minimum, this should include:

  • Opening price.

  • Closing price.

  • Highest price.

  • Lowest price.

  • Trading volume.

This is often called OHLCV data (open, high, low, close, and volume). You can download historical data from some exchanges or use a backtesting platform that provides it.

For more advanced strategies, you might also need historical order book data, funding rates, and other market information.

4. Apply your trading rules

Now apply your strategy to the historical data.

Go through each candle and check whether your entry conditions were met. If they were, record a hypothetical trade, including the entry price, position size, stop-loss, and exit price.

Continue until you've worked through the entire testing period.

If you're using automated software, the platform will generally do this for you and generate a report showing the hypothetical results.

5. Calculate your results

Once you've completed the backtest, review the results to see how your strategy performed.

Some useful metrics include:

  • Net profit or loss: How much the strategy would have made or lost after trading costs.

  • Win rate: The percentage of trades that closed in profit.

  • Profit factor: Total gross profits divided by total gross losses. A figure above 1 means the strategy generated more gross profit than gross loss.

  • Maximum drawdown: The largest peak-to-trough decline in your trading balance.

  • Sharpe ratio: A measure of risk-adjusted returns, showing how much return a strategy generated relative to its volatility.

  • Number of trades: The total number of trades generated during the test. A very small sample can make results unreliable.

Don't focus on profitability alone. A strategy that generates impressive returns but experiences huge drawdowns might be too risky to use in practice.

6. Refine and retest

If your strategy produces poor results, you can experiment with different parameters, such as moving average lengths, stop-loss levels, or entry conditions.

However, avoid repeatedly changing your rules until you get a perfect-looking result. This can lead to overfitting, where a strategy is tailored so closely to historical data that it struggles in live markets.

It's also worth testing your strategy against a separate set of historical data that you haven't used to develop it.

Example

Let's say you want to test a simple trend-following strategy using Bitcoin's 50-day and 200-day moving averages.

You decide on the following rules:

  • Entry: Buy BTC when the 50-day moving average crosses above the 200-day moving average.

  • Exit: Sell BTC when the 50-day moving average crosses below the 200-day moving average.

  • Initial capital: $10,000.

  • Position size: 20% of available capital per trade.

  • Trading costs: Include an assumed 0.1% fee on each buy and sell.

You apply these rules to three years of historical Bitcoin price data. Let's say you produce the following results:

MetricResult
Starting capital$10,000
Ending balance$13,200
Net profit$3,200
Return32%
Total trades18
Winning trades11
Losing trades7
Win rate61.1%
Maximum drawdown14%

These results suggest the strategy would have been profitable over the testing period, with a 32% return after the assumed trading fees.

However, the 14% maximum drawdown means the portfolio would have experienced a significant decline from a previous peak at some point during the test.

The strategy also generated just 18 trades, which is a relatively small sample. You'd want to test it over additional periods and market conditions before drawing any firm conclusions.

You could then run the same strategy against a separate period of historical data to see whether the results hold up.

Why do backtest results differ from live trading?

One of the biggest mistakes traders make is assuming that a profitable backtest will automatically translate into profitable live trading.

Backtesting is useful, but it can't perfectly recreate the conditions of a live crypto market. Several factors can cause actual results to differ from historical simulations.

1. Trading fees and execution costs

Trading fees, spreads, and slippage can all eat into potential profits.

Some backtests use simplified assumptions about execution or don't account for every trading cost. This can make a strategy look more profitable than it would be in reality.

For example, a strategy that targets small price movements might generate a positive return in a backtest but lose money once entry and exit fees are included.

Always account for maker and taker fees, bid-ask spreads, and potential slippage when testing a strategy.

2. Slippage and liquidity

Backtests often assume trades execute at the exact price specified by the strategy. Live trading isn't always so predictable.

Slippage occurs when an order executes at a different price than expected. It can happen during periods of high volatility, low liquidity, or sudden changes in market activity.

This is particularly important for traders working with smaller altcoins, where there might not be enough buyers or sellers to fill an order at the expected price.

3. Changing market conditions

Crypto markets are constantly changing. A strategy that performs well during a bull market might struggle when prices move sideways or enter a prolonged downturn.

For example, a trend-following strategy might generate strong returns during a sustained Bitcoin rally but produce repeated false signals when the market becomes range-bound.

This is why it's important to test strategies across different market conditions rather than focusing on one particularly profitable period.

4. Overfitting

Overfitting happens when traders adjust their strategy's parameters too closely to historical data.

For example, you might discover that a 47-day moving average and a 183-day moving average produced better historical returns than the more commonly used 50-day and 200-day combination.

But that doesn't necessarily mean the unusual combination has a genuine advantage. It could simply be capturing random patterns in the historical data.

A strategy that performs exceptionally well on the data used to develop it but poorly on new data is a classic sign of overfitting.

To reduce this risk, keep some historical data separate for testing and avoid making endless adjustments just to improve the results.

5. Look-ahead and survivorship bias

Two less obvious problems can also distort backtest results.

  • Look-ahead bias: This happens when a backtest uses information that wouldn't have been available at the time of a trade. For example, using a candle's closing price to make a decision before that candle had actually closed.

  • Survivorship bias: This happens when a backtest only includes cryptocurrencies that still exist today, ignoring projects that failed or disappeared. This can make historical strategies look more successful than they really were.

Both can produce misleading results, particularly when testing strategies across large portfolios of altcoins.

The best approach is to treat backtesting as the first stage of strategy testing, not the final verdict. Follow it with paper trading and, if the results remain consistent, consider testing with small live positions.

What are the best crypto backtesting tools?

There are several platforms that can help you test crypto trading strategies, ranging from dedicated backtesting software to exchange-based trading tools. Some offer automated historical simulations, while others provide trading bots, historical market data, or demo accounts that can help with strategy testing.

PlatformBacktesting featuresIdeal for
CoinruleBuilt-in historical backtesting for rule-based strategies. Users can test trading rules, compare configurations and review performance metrics, including returns and drawdowns.Beginners and intermediate traders who want to build and test strategies without coding.
CryptohopperDedicated backtesting tool for trading bots and templates, alongside a Strategy Designer for testing indicator-based strategies. Some backtesting features are paid only.Traders who want to create, customise and automate trading bots.
BybitDemo Trading feature allows users to forward-test strategies against live market conditions using simulated funds.Traders who want to practise and forward-test strategies without risking real money.
BinanceProvides historical market data that traders can download and use for external backtesting. Its Binance AI Pro strategy tools also offers paper trading.Traders who want access to exchange data for manual or code-based backtesting.
KuCoinProvides downloadable historical market data for backtesting and research, alongside built-in trading bots.Traders who want historical exchange data and automated trading options.

Don’t forget the tax bill…

Whatever your trading strategy, if you’ve got gains, your tax office wants its cut. Learn more in our crypto tax guides or sign up for Koinly for free to calculate your crypto taxes.

Disclaimer
The information on this website is for general information only. It should not be taken as constituting professional advice from Koinly. Koinly is not a financial adviser. You should consider seeking independent legal, financial, taxation or other advice to check how the website information relates to your unique circumstances. Koinly is not liable for any loss caused, whether due to negligence or otherwise arising from the use of, or reliance on, the information provided directly or indirectly, by use of this website.