Guide

How to Backtest a Crypto Trading Strategy (Honest Guide)

Backtest your crypto strategy step by step: free validation, an A to D honesty grade, an overfit check, walk-forward and paper trading. On the Free plan.

Updated

A backtest runs a strategy on past market data to answer one question: “what would have happened if I had traded these rules?” The problem is that a badly built backtest almost always looks better than it is. This guide shows, step by step, how to backtest your crypto strategy and how to tell whether the result is honest. The examples use OptAlgo, and you can follow them on the Free plan, with no card.

Why does a backtest mislead?

The steps below are there to catch each of these.

1. Open an account and connect your AI

Open a free OptAlgo account. You do not have to write the strategy yourself: connect Claude, ChatGPT, Claude Code or Codex and describe your idea in plain sentences. In Claude.ai and ChatGPT you add https://mcp.optalgo.com/mcp as a custom connector and approve it in the app. In Claude Code one command is enough:

claude mcp add --transport http optalgo https://mcp.optalgo.com/mcp

Then type /mcp inside Claude Code and sign in. The connector is paper-only: it runs backtests and sets up paper bots, and it can never touch real money.

2. Describe your strategy

For example: “Short ETH on 4h when RSI is above 75, 2% stop, take profit at 4%.” or “Test the same breakout on BTC, ETH and SOL together.” Your AI turns it into a strategy.py file with the OptAlgo SDK: plain Python you can read, download and keep. The code may use only numpy, math and the OptAlgo SDK, and it runs in a sandbox.

3. Validate for free

Validation runs before any quota is spent. It queues nothing, loads no market data and costs no units. It runs the code once on synthetic bars and lists every problem at once: code, symbols, data for the chosen window, plan limits, quota, lookahead and non-deterministic code. Each finding comes with its fix; your AI fixes them all in one go and validates again.

4. Run the backtest

A backtest is charged by run time: one unit is up to 10 seconds of running. The Free plan includes 50 units a month, 3 coins per run and one run at a time. The data is real exchange candles, down to 1 minute; fees, exact funding payments and exchange rules such as the minimum order size are taken into account.

5. Read the grade first, then the number

Every result comes with an honesty grade first:

Next to the grade comes the overfit verdict. OptAlgo counts how many variants of the strategy you ran on overlapping data in the last 30 days and uses the deflated Sharpe ratio to work out whether your result is beyond luck. The verdicts are ok, caution, likely overfit, or no edge when the run lost money. Return, max drawdown and the number of trades come after these; the return is net of fees and funding.

6. Do not tune by hand, run a walk-forward

The most common mistake is to try parameters one by one on the same data and pick the best result. Every try is a chance. Ask for a single research run instead: a walk-forward optimises on the training period and measures the result on test periods the optimiser never saw. The verdict is robust, inconclusive or likely overfit; inconclusive is not a pass. For an even stricter test, set the last months aside as a holdout from the start and run the parameters you chose there only once.

7. Run it on paper

You deploy a backtest graded A to C that did not lose money; OptAlgo runs your code at every bar close, on paper first, in My Bots. The Free plan includes one hosted strategy on paper. Compare with backtest matches a backtest of the same period against the real paper trades, trade by trade; if there is a gap, you learn it on paper, not with money. Going live is on Plus and Pro, and only with your own approval in the app.

A short checklist before you trust it

  1. The grade is A to C and you have read the findings.
  2. The overfit verdict is ok, or a walk-forward of the same code came back robust.
  3. The result is still profitable after fees and funding.
  4. The profit does not come from a few trades, and it holds on more than one coin.
  5. The paper results agree with the backtest.

All of these checks are built into OptAlgo's crypto backtesting. If you trade with TradingView alerts, see the guide to connecting a TradingView alert to Binance too.

Your next strategy is one sentence away.
Test it honestly before it touches money.

Start free, no card

50 backtest units a month on the Free plan.