What a backtest is and how to run your first one
BacktestLab answers a single question: if you had applied these rules in the past, what would have happened to your money? You do not need to know how to code or any advanced finance.
The idea in a few words
A backtest is a simulation. You pick a cryptocurrency, a period and some rules of the kind “buy when this happens, sell when that happens”. The tool walks through the historical prices candle by candle, applies your rules as if you were trading at that moment and tells you the outcome.
No real money is at risk, so it helps you discard bad ideas before they cost anything. But note: a good result in the past guarantees nothing about the future.
Basic vocabulary
These words appear throughout the tool. With them you can follow the rest of this guide.
- Candle
- A summary of what the price did during a time interval: where it opened, the high, the low and where it closed.
- Timeframe
- How long each candle lasts: 1, 3, 5, 15 or 30 minutes; 1, 2 or 4 hours; 1 day, 1 week or 1 month. A short timeframe gives many signals and a lot of noise; a long one gives few and clearer ones.
- USDT
- A digital currency worth roughly one dollar. All backtests are expressed in USDT and are never converted to another currency.
- Starting capital
- The money the simulation starts with (10,000 USDT by default).
- Fee
- What the market charges on every buy and sell (0.1% by default). It is deducted on every order because ignoring it would make strategies that trade a lot look better than they are.
- Position
- What you hold at any moment. With no position, all your money is in cash (USDT).
- Round trip
- A cycle that starts when you buy and ends when everything is sold again. It is the unit used to count wins.
- Buy & hold
- The simplest alternative: buy on day one and touch nothing. It is the yardstick for any strategy.
Your first backtest in four steps
- Pick a strategy. Go to Strategies and look at the built-in ones, or create your own with the visual editor (next section).
- Pick asset, dates and timeframe. In Backtests open “One asset”. Each built-in strategy lists its recommended timeframe and range.
- Run it. You will see the simulation replayed candle by candle, with every buy and sell marked on the price.
- Read the report. When it ends you get a plain verdict and the key figures. First things to check: does it beat buy & hold? With what maximum drawdown?
Where the data comes from
The candles are real Binance history for the USDT pairs in the Assets catalog. Each backtest can use up to 100,000 candles: with 1-minute candles that is about 69 days; with 1-hour candles, more than 11 years; with daily candles, far more than exists. The longer the timeframe, the longer the period you can test.
Draw your rules, no code needed
A strategy is a set of rules, and each rule says when to buy or when to sell. If you can explain your idea in words, you can build it here.
The pieces of the editor
The editor is a canvas with three kinds of piece (nodes) joined by wires, from left to right:
- Closing price: the starting point, always present. Wires run from it to the conditions.
- Condition: something that can be true or false on each candle, for example “the RSI is below 30”.
- Buy / Sell: the action. It holds the amount: for a buy, a percentage of your cash or an amount in USDT; for a sell, a percentage of the position.
Wires and AND / OR logic
A wire means “both things must hold”. If several wires reach a node, a switch appears where they join:
- AND (default): every condition must hold.
- OR: one of them is enough.
Each buy or sell node is a rule made of the conditions that lead to it. A few limits keep strategies understandable: up to 3 conditions per rule and up to 10 rules per strategy. Wires only go to a column further to the right.
Available conditions
There are nine kinds. Each one is tuned with numbers (for example the RSI period) in a dialog.
| Condition | What it measures | Typical use |
|---|---|---|
| RSI | Whether the price rose or fell too fast, on a 0 to 100 scale. | Buy on a low RSI (below 30 usually means an overdone fall) and sell on a high one. |
| Moving-average cross | A fast average of prices crossing a slow one (SMA or EMA). | Spotting trend changes. |
| MACD | The strength of momentum: a cross between its line and its signal line. | Confirming that a move is gaining or losing strength. |
| Bollinger | Whether the price strays far from its average: upper and lower bands. | Buy at the lower band, sell at the upper. |
| Donchian | Whether the price breaks the high or low of the last N candles. | Following breakouts. |
| Price change | How much the price rose or fell in N candles, or since your buy. | Setting a stop loss or taking profit. |
| Volume | Whether traded volume exceeds a multiple of its average. | Requiring a move to have participation. |
| Periodic | Holds every day, week or month. | Recurring fixed-amount buys. |
| Candle pattern | Ten classic candle shapes, five bullish and five bearish (hammer, engulfing, three white soldiers…). | Looking for price turns. |
Advanced settings of a condition
They are optional and sit at the end of each condition's dialog. If you leave them alone, nothing changes.
- Market direction: limits the condition to rising or falling markets. “Rising” means the price is above its 50-candle exponential average (the period is adjustable).
- Signal active for: keeps the signal alive for N candles. It helps combine events that happen in an instant, like two crosses that almost never land on exactly the same candle.
The editor warns you about mistakes
If two conditions of the same rule can never hold together (for example “RSI above 70” and “RSI below 30”), the editor flags it before you run: that rule would never buy. It also blocks saving loose nodes that are not part of a complete rule.
If you leave with unsaved changes, the editor asks before discarding them.
Built-in strategies
To see how a complete strategy is built there are three read-only examples, one per time horizon. You can run them as they are and open them to see their node panel.
| Strategy | Horizon | Timeframe | Idea |
|---|---|---|---|
| RSI + Bollinger Rebound | Short term | 1h or 4h | Buys extreme dips and sells the rebound. Mean reversion with a tight stop. |
| EMA 20/50 Trend | Medium term | 4h or 1d | Follows swing trends: enters on the bullish moving average cross with momentum and exits when it reverses. |
| Donchian 100/50 Breakout | Long term | 1d | Buys the breakout of the 100-candle high and holds until the 50-candle low is lost: it rides the big trends. |
The engine's rules and why they exist
A backtest is only useful if it resembles what would really have happened. That is why the engine is strict: it allows no advantage you would not have had at that moment.
From signal to order
Conditions are evaluated when a candle ends, because only then is its closing price known. But that price is already past: nobody can buy at a price that no longer exists. So the order is executed at the opening price of the next candle. If the signal appears on the last candle of the period, it is never executed.
Executing at the close of the same candle would give somewhat optimistic results. With this rule the figures come closer to what you would get trading.
Execution rules
- Buys only, no leverage. You buy the coin with your cash and sell it later. There are no short positions or borrowed money, so you can never lose more than you invested.
- One order per candle. And if a candle has both a sell and a buy signal, the sell is handled first (risk is reduced before taking on more).
- Fee on every order. Buys and sells both pay the fee you configured.
- Fractional amounts. As in real crypto, you can buy 0.0123 BTC.
- If several rules hold, the first wins. Rule order matters and the result is always the same for the same strategy.
- A 100% buy leaves no cash. While you are invested and have no cash left, a signal that keeps holding does not buy again.
- Tiny leftovers. If what remains after a partial sell is worth less than 1% of the starting capital, everything is sold so you do not carry a tiny position.
No peeking at the future
The most common (and most dangerous) backtest mistake is accidentally using information that did not exist yet. The engine avoids it: signals are computed on candles that have already closed, a Donchian channel is compared with the previous candles and not the current one, volume is compared with its previous average and a candle pattern is flagged on the last candle that completes it.
Indicators need history to be computed (a 50-candle average needs 50 candles). So the engine loads candles from before your start date: that way indicators are ready on day one.
What your account is worth at any moment
The capital you see is the liquidation value: cash plus what you would get by selling the open position at the closing price, exit fee already paid. That way an open position does not inflate the result.
What the engine does not simulate
It is a simplified model. It does not include slippage (the gap between the expected and the obtained price), thin liquidity on large orders, taxes or the delays of a live connection. A real result will be somewhat worse than the simulated one.
How to read the replay and the report
When you run a backtest you first watch it unfold, and at the end you get a report designed so anyone can tell whether the strategy is any good.
The replay
The simulation plays back candle by candle: the price with every buy and sell marked, the equity curve against buy & hold and the fall from the peak, with figures updating live. You can pause, change the speed or drag the time bar.
| Key | Action |
|---|---|
| Space | Pause or resume |
| ←→ | Step back or forward a little (with Shift, trade by trade) |
| 124 | Speed 1×, 2× or 4× |
| S | Skip to the summary |
| R | Replay |
If your system asks for reduced motion, the replay is shown already finished.
Equity against buy & hold
This is the most important chart. The solid line is your account with the strategy; the dashed one, what you would have had doing nothing. The area below shows how far each fell from its last peak (drawdown): what you would have had to sit through.
The verdict
When it ends, the report sums up the strategy in four points, each rated good, mixed or bad:
- Result
- Whether you made or lost money over the period.
- Versus buy & hold
- Whether doing something beat doing nothing.
- Risk
- How far the account fell at its worst, compared with simply holding.
- Consistency
- Whether gains comfortably outweigh losses, measured with the profit factor.
The key figures
- Return
- How much your capital grew or shrank, as a percentage.
- Max drawdown
- The biggest fall from a previous peak. It answers: how much would it have hurt?
- Win rate
- Winning round trips among the closed ones. A low win rate is not bad if wins are much larger than losses.
- Profit factor
- Total gains divided by total losses. Above 1 you win more than you lose.
- Time invested
- The share of time with an open position. Little time invested means less exposure to the market.
- Fees
- Total paid. In strategies that trade a lot it can eat a good part of the profit.
- Sharpe / Sortino / Calmar
- Advanced measures of risk-adjusted return, in the report's “Advanced” section. Higher is better.
Reliability warnings
The report warns you when the result is not very reliable:
- There were no trades, or fewer than 10 complete ones.
- A position was still open at the end (its result is not final yet).
- The period lasts less than 30 days.
- A single trade provides more than half of the profit.
- The market was sideways: buy & hold moved less than 5%.
Trades table and export
Each round trip has its row, with price, amount, result, duration and the rule that triggered it. From there you can mark it on the chart or see its buys and sells one by one. The whole report can be exported to PDF or PNG image, and the table to CSV (Excel-friendly).
Stress-test your strategy before trusting it
A good result can be luck. These tests, in the Backtests section, try to break your strategy to see whether it holds up.
Several assets
Run the same strategy on several cryptocurrencies at once. Each one gets the full capital and is simulated separately (it is not a portfolio). If it only works on one, you have probably found a coincidence, not a solid idea.
Windows
Splits the period into stretches and runs the strategy on each. A solid strategy wins (or at least holds up) in most stretches, not just one lucky one.
Parameter sensitivity
Changes one or two numbers in your strategy (for example the RSI level) across five values, by default from −20% to +20% of the original, or the ones you type. If the result barely changes, the idea is robust. If it only works at one exact value, you are most likely seeing a tailor-made fit to the past (overfitting).
Neighbouring timeframes
Tests the strategy on timeframes close to yours (for example 30m and 2h if you used 1h). A good idea should not vanish by changing the candle size a little.
Monte Carlo
The past is only one of the many stories that could have happened. Monte Carlo generates many random alternatives and shows the range of possible results. There are two versions:
- With your trades. Reshuffles or redraws the trades of a backtest. It runs in your browser. It shows how much the result depended on the order they happened in.
- With simulated prices. The server simulates synthetic price paths and runs your strategy on each.
A fall of 50% from a peak counts as “ruin”. If many simulated paths get there, the strategy is riskier than its historical result suggested.
What you can do and where things are stored
Guest, free account and plans
| Type | What it includes |
|---|---|
| Guest | Without signing up you can try the tool with a few backtests in total. No multi-asset runs. |
| Free account | Create an account with email and password to get a daily backtest quota and limited multi-asset runs. |
| Paid plans | More quota and more assets per run. Not available yet. |
See the current limits on Plans or create your account.
How the quota is counted
- Consumption is counted: deleting strategies or runs does not give quota back.
- If the engine fails on its own, the quota of that run is refunded.
- In a multi-asset batch or a robustness test, each asset or simulation counts as one use.
Where your data is stored
- Strategies: in your account.
- Backtest history: in this browser. If you switch devices or clear browser data, it will not be there.
More on what is stored and why in the privacy policy.
Good practice and an important warning
- 01
Start simple.
One or two conditions per rule. Every extra condition reduces trades and raises the risk of fitting the past.
- 02
Always compare with buy & hold.
Making 20% sounds good until you see that doing nothing would have made 40%.
- 03
Look at the maximum drawdown.
Ask yourself whether you would have sat through that fall without switching the strategy off. If not, it is no use to you even if it wins.
- 04
Count the trades.
With fewer than 10 trades the result can be pure luck.
- 05
Watch the fees.
On short timeframes, many small gains can be wiped out by fees.
- 06
Test in different markets.
A rising period, a falling one and a sideways one. A strategy that only works when everything goes up is not a strategy.
- 07
Be wary of perfect.
If you tweak numbers until the past looks perfect, it will most likely fail in the future. Use sensitivity and windows to check.
- 08
Combine events with “Signal active for”.
Two crosses almost never happen on the same candle; keeping the signal alive for a few candles lets them coincide.