Strategy backtester with fees, slippage and next-bar fills
Test six classic trading rules on real crypto candles. Signals use closed bars only, trades fill at the next open, and every fill pays your fee and slippage.
What the backtester does
The backtester runs a trading rule over real historical candles and reports what would have happened: every trade, the equity curve, the costs and the key statistics, side by side with simply buying and holding. It runs entirely in your browser on Binance public market data, so you can test an idea in seconds without code, an account or a subscription.

- Market: the pair to test.
- Timeframe: daily, 4-hour or 1-hour candles.
- Strategy: six built-in rules.
- Lengths: the settings of the rule.
- Fee and slippage: paid on every entry and exit.
- Capital: the starting balance.
- Allow short: test the rule on falling markets too.
- Run: run the test on the loaded candles.
- Use my CSV: test on your own data.
- Chart with trade marks: where the rule bought and sold.
- Equity against buy and hold: the rule’s curve and the do-nothing curve.
- Result tiles: return, CAGR, drawdown, win rate, profit factor, Sharpe and exposure.
The six built-in strategies
| Strategy | Entry | Exit | Parameters |
|---|---|---|---|
| EMA crossover | Fast EMA closes above slow EMA | Fast EMA closes below slow EMA | Fast and slow lengths |
| RSI mean reversion | RSI closes below the lower level | RSI closes above the exit level | RSI length, entry and exit levels |
| Bollinger Band reversion | Close below the lower band | Close back above the middle band | Length and band width |
| Donchian breakout | Close above the highest high of N bars | Close below the lowest low of M bars | Entry and exit channel lengths |
| MACD signal cross | MACD crosses above its signal line | MACD crosses below its signal line | Fast, slow and signal lengths |
| Buy and hold | First bar | Last bar | None (benchmark) |
With “allow short” ticked, the opposite signals open short positions, so the strategy is always in the market on one side. Without it, the strategy is long or flat.
How trades are simulated
- At the close of each bar, indicators are calculated from that bar and earlier bars only.
- If the rule gives a signal, the trade is filled at the open of the next bar, adjusted by your slippage in the unfavourable direction.
- The fee is charged on the value of each fill, on entry and on exit.
- Each trade uses the full current equity, so results compound.
- An open position at the end of the data is closed at the last close so it counts in the results.
Fee per fill = fill value × fee %
Trade return = (exit value − entry value − fees) ÷ entry value
- The bar closes. The rule checks the finished candle. Until it closes, the signal does not exist.
- Fill at the next open. The backtester buys or sells at the open of the next candle, the first price you could really have got.
- Same-bar fill. Filling at the close of the same bar that created the signal uses a price you could not have known in time. That is look-ahead bias, and it makes results look better than reality.
On the real screen: Pins 5 and 10 on the real backtester screenshot show the fee and slippage inputs and the trade marks on the chart.
New-user habitKeep the fee and slippage at least as high as your broker really charges.
Common mistakeTrust any backtest, here or elsewhere, that fills on the signal bar.
The results, explained
- Total return and CAGR. Growth over the whole test and its annual equivalent.
- Buy and hold. The return of holding the market over exactly the same bars. Most rules should be judged against this.
- Max drawdown. The deepest fall of the equity curve from a peak.
- Win rate and profit factor. Share of winning trades, and gross profit divided by gross loss.
- Exposure. The share of bars spent in a position.
- Sharpe ratio. Annualised mean return per bar divided by its standard deviation, without a risk-free rate. Useful for comparing variants of the same rule.
- Total cost. Fees and slippage paid over the test, in account currency and as a share of starting capital.
- Buy and hold. What you would have made by buying on the first day and doing nothing.
- Strategy. The rule’s equity curve. Here it is smoother but ends lower.
- Drawdown. The fall from a peak to the next low. It shows the pain you would have had to sit through.
On the real screen: Pin 11 on the real backtester screenshot is the equity-against-buy-and-hold chart; pin 12 is the result tiles. On 8 November 2026, an EMA 20/50 rule on daily BTC ended −3.5% while buy and hold made +51.9%.
New-user habitCompare return, drawdown and the number of trades together.
Common mistakePick the rule with the best total return from one test on one market.
Worked example: does the fee matter?
Take an EMA 20/50 crossover on a daily chart that trades about 12 round trips a year. At 0.10% fee and 0.05% slippage per side, each round trip costs about 0.3% of the position, about 3.6% a year. Switch to a 4-hour chart and the same rule might trade 50 times a year: about 15% a year in costs. Run both in the backtester. The lower timeframe often shows a similar gross pattern with a far worse net result. That single comparison teaches more about short-term trading than any indicator.
A testing routine that avoids fooling yourself
- Start with the benchmark. Note buy-and-hold return and drawdown for the market and period.
- Test the default settings first. Write down the result before changing anything.
- Change one parameter at a time, in small steps. If performance collapses with small changes, the original was luck.
- Repeat on other markets. A rule that works on BTC, ETH and SOL is more interesting than one that only works on one coin.
- Count trades. Under about 30 trades, results are mostly noise.
- Raise costs. Double the fee. A robust edge survives.
Reading the chart
The upper pane shows the candles with the strategy’s indicators drawn on top and an arrow at every entry and exit. The lower pane shows the strategy’s equity curve against buy-and-hold, both starting from the same capital. Long flat stretches in the equity curve show periods when the rule was out of the market; steep declines show losing streaks. Hover over any bar to see the values. The trade list underneath can be sorted and exported.
Importing your own data
Use “Import CSV” to test any market for which you have daily or intraday OHLC data, such as stocks or forex from your broker. The file needs columns for date or time, open, high, low and close; a volume column is optional. The file is read in your browser and is not uploaded.
From backtest to real risk
The backtester invests all equity in each trade to show the raw behaviour of a rule. Real trading usually risks a small, fixed share of the account per trade. Convert the results into R multiples and enter the win rate and average win and loss in the Risk Lab to see the range of outcomes over the next 200 trades. Then plan each live trade in the Trade Planner and record it in the journal, so you can compare live results with the test. Read the full backtesting guide for more on biases and robustness.
Limits
- Fills at the next open are realistic for liquid markets but ignore order-book depth; large orders would move the price.
- Funding payments on perpetual futures and borrowing costs for spot shorts are not modelled. Add them to slippage if you want a rough allowance.
- Binance history only covers markets listed on Binance, and only since each listing. Coins that were delisted are not available, which creates survivorship bias.
- Results describe the past only.
Choosing the timeframe
The timeframe changes almost everything about a rule. On weekly bars, an EMA crossover might trade two or three times a year and behave like a long-term trend filter. On 15-minute bars, the same settings can trade hundreds of times and spend most of its edge on fees. A good habit is to test the daily timeframe first, because it has enough trades to judge and costs that are small relative to the moves. Then test the timeframe you actually want to trade, with the costs you will actually pay, and compare. If a rule only works on one timeframe, treat that as a warning rather than a discovery.
Interpreting a losing test
A rule that loses money in the backtest is still useful information. Check three things before discarding it. First, is the loss mainly costs? If gross results were positive, the idea may work on a longer timeframe with fewer trades. Second, did it lose in one regime and win in another? A mean-reversion rule that lost during a strong trend may be worth combining with a trend filter. Third, was the sample big enough? Ten trades cannot prove a rule does not work, any more than they can prove that it does. Write the conclusion in one sentence and move on to the next idea.
How to read this screen, part by part
A backtest is only as honest as its settings. Here is every control and every result line, with what a good or poor reading looks like.
- Market, timeframe and strategy
- Fee, slippage, capital and shorts
- Equity curve and drawdown
- Total return, CAGR, max drawdown, win rate, profit factor, Sharpe and exposure
Market, timeframe and strategy
Pick a crypto pair, a Delta Exchange perpetual or your own CSV; a timeframe of 1H, 4H, 1D or 1W; and one of six rules: EMA crossover, RSI mean reversion, Bollinger Band reversion, Donchian breakout, MACD signal cross or buy and hold as a benchmark.
Where it misleads: Trying dozens of length combinations and keeping the best one is overfitting; the best past setting is rarely the best future one.
Fee, slippage, capital and shorts
Fee % per side and slippage % per side are charged on every entry and exit. Starting capital sets the scale. Allow shorts lets the rule hold short positions instead of cash.
Where it misleads: Real slippage grows in fast markets and in small coins; test with a higher value than you hope for.
Equity curve and drawdown
The equity line shows the account value bar by bar; drawdown shows how far it sits below its previous peak. Trades are filled at the next bar’s open, never at the close that triggered them.
Where it misleads: One huge winning trade can make a curve look good. Check the trade list for concentration.
Total return, CAGR, max drawdown, win rate, profit factor, Sharpe and exposure
Return and CAGR show growth; max drawdown the worst fall from a peak; win rate the share of winning trades; profit factor gross profit divided by gross loss; Sharpe the return per unit of volatility; exposure the share of bars in a position.
Where it misleads: Always compare with buy and hold over the same bars. A rule that beats it only by being out of the market in one crash may not repeat.
A step-by-step pass
- Pick the market and timeframe you would actually trade.
- Run buy and hold first and note its return and drawdown.
- Choose one rule with default lengths and enter fees and slippage at least as high as your real ones.
- Run it and read profit factor, drawdown and the number of trades.
- Change each length a little in both directions; if results collapse, the rule is fragile.
- Test the same rule on two other pairs and another timeframe.
- Open the trade list and check whether a few trades made most of the profit.
- If it survives, plan the first live trade small in the trade planner and log it in the journal.
What this screen does not tell you
- How the rule will do from here. Markets change and past fits fade.
- Funding on perpetuals, tax, or partial fills.
- Intrabar paths; stops inside a bar are not simulated.
- Survivorship: delisted coins are not in the list.
More cost tools
Frequently asked questions
How does the backtester avoid look-ahead bias?
Signals are calculated only when a bar has closed, and every trade is filled at the open of the next bar. No rule ever uses a price from the future.
Are fees and slippage included?
Yes. You set a fee and a slippage percentage per side, and both are charged on every entry and exit. The total cost is shown in the results.
Which markets can I test?
Any crypto pair available on Binance public data, on timeframes from 15 minutes to 1 week. You can also import your own OHLC CSV file for any market.
Why not forex?
The free ECB reference rates are one price per working day without highs or lows, which is not enough for honest tests of most rules. Import a CSV with real OHLC data instead.
Does it compound?
Yes. Each trade uses the full current equity, so gains and losses compound. Results are compared with buying and holding over the same bars.
Can I export the trades?
Yes. The trade list can be downloaded as CSV with entry and exit dates, prices, bars held and return.
Is a good backtest a reason to trade a strategy?
No. It is a reason to investigate further. Results depend on the period, the market and the settings, and past performance does not predict future results.
What is next-bar fill in a backtest and why does it matter?
The signal is computed on a closed bar and the trade is filled at the next bar’s open. Filling on the same bar’s close assumes you knew the close before it happened, which is look-ahead bias and makes results look better than they can be.
How many trades do I need for a meaningful backtest?
There is no fixed number, but with fewer than about 30 trades a few results dominate. Aim for dozens across different market phases, and check that results hold on other pairs and timeframes.
How do fees and slippage change backtest results?
They are charged on every entry and exit, so a rule that trades often loses the most. At 0.30% per round trip, 40 trades cost about 11% of the account in a year before any edge.
What is a good profit factor?
Profit factor is gross profit divided by gross loss after costs. Above 1 means the rule made money in the test; many traders look for clearly above 1.3 with enough trades before taking it further. It says nothing about future results.
