Backtesting Guide By BitLogic Team Published 11 min read

Why Does My Strategy Win in the Backtest but Lose Live? Overfitting, Look-Ahead Bias, Survivorship Bias and Trading Costs

Test your strategy the honest way, free: BitLogic Backtester on the Microsoft Store (Windows) uses next-candle fills, fees, slippage, futures funding and walk-forward testing on every stock and crypto backtest. 3 backtests and 1 optimization free. See what it does.

Quick answer: a backtest beats live trading when it knew something the live market didn't let you know, or ignored something the live market charged you for. The six usual causes are overfitting, look-ahead bias, repainting indicators, survivorship bias, missing costs (fees, slippage, stamp duty, funding) and too few trades. A change in market conditions can also end a real edge. Each one has a fix, and they apply to Apple and NVIDIA just as much as to Bitcoin and Ethereum.

Written by the BitLogic Team, 27 November 2026. Screenshots show real tests made in BitLogic Backtester in November 2026. This article is for education only and is not financial advice. Past results do not guarantee future returns.

Key Takeaways

Why Does My Strategy Win in the Backtest but Lose Live?

Short answer: because the backtest was easier than real trading. It used information you would not have had, ignored costs you would have paid, or fitted rules to a past that won't repeat. This table lists the six usual causes, how each one shows up and the fix:

CauseWhat happensTypical symptomFix
OverfittingRules fit past noiseGreat backtest, poor results on any new dataWalk-forward testing, fewer rules, more markets
Look-ahead biasBacktest uses future dataEntries at the perfect price, unreal win ratesSignal on close, fill at next open
RepaintingIndicator rewrites its pastSignals on the chart that never appeared liveUse only closed-candle values
Survivorship biasOnly survivors testedStrategy "works on all the stocks or coins" you picked todayChoose symbols by rules fixed in advance
Missing costsFees, slippage, funding ignoredA frequent-trading strategy turns from profit to lossModel every cost
Too few tradesResult is luckUnder 20 to 30 tradesMore data and more markets (see how many trades you need)

Stocks vs Crypto: Where the Gap Comes From

The causes are the same in both markets, but they show up in different places. A stock trader and a crypto trader should check different things first:

CauseStocksCrypto
Look-aheadEarnings and news released after the close; split- and dividend-adjusted pricesUnfinished candles on a market that never closes; open higher-timeframe candles
SurvivorshipTesting only today's S&P 500 or NASDAQ-100 members; bankruptcies such as Lehman Brothers (2008)Coins that collapsed or were delisted, such as LUNA and FTT (2022)
CostsBid-ask spread, commission, UK stamp duty, short borrow feesExchange fees, slippage on small coins, futures funding
GapsOvernight and weekend gaps straight through a stopFewer gaps (24/7 trading), but sudden wicks and liquidation cascades
LeverageMargin calls on leveraged positionsLiquidation on perpetual futures, often at high leverage

What Is Overfitting, and How Do I Detect It?

Short answer: overfitting (curve fitting) is tuning a strategy so closely to past data that it learns random noise instead of a real pattern. You detect it when results fall apart on data the strategy has not seen: a later period, other markets, or a setting nudged slightly.

Crypto example: you test an RSI strategy, trying every RSI length from 2 to 50 and every threshold from 10 to 40. One combination, RSI(13) below 23, made 400% on Ethereum. That result is the best of over a thousand tries, so it is very likely luck. RSI(12) or RSI(14) would have made far less, and next year RSI(13) is unlikely to repeat.

Stock example: the same trap works on stocks. Try 50 moving-average crossover pairs on Tesla and one of them will look brilliant by chance. If the 23/61 crossover wins but 20/60 and 25/65 lose, you have found noise, not an edge.

Seven Signs Your Strategy Is Overfitted

  1. Fragile settings: changing a parameter by one or two steps turns profit into loss. A real edge has a broad "plateau" of good settings.
  2. Too many rules: each extra condition and parameter gives the strategy more freedom to fit noise.
  3. Few trades: 15 trades can be fitted perfectly by almost any rule set.
  4. One market only: it works on Apple but not Microsoft; on BTC but not ETH, SOL or BNB.
  5. One period only: great in 2021, flat or negative from 2022 to 2024.
  6. In-sample far better than out-of-sample: the settings that won on the training period do much worse on the period after it.
  7. Too smooth to be true: a near-perfect equity curve with tiny drawdowns on a volatile stock or coin.

How to Prevent Overfitting

BitLogic Backtester walk-forward optimization: settings chosen on earlier data made money on unseen data in 3 of 4 rounds and passed the reality check
Walk-forward optimization in BitLogic Backtester. Settings chosen on each practice period are tested on the period after it. Here they made money on unseen data in 3 of 4 rounds and "passed the reality check". The tuned (in-sample) results averaged +125.9%, the unseen ones +21.2%: the honest number is the second one.

Notice the gap in that screenshot: +125.9% in-sample versus +21.2% out-of-sample. A gap like this is normal. A plain optimization would have shown only the first number and hidden the overfitting from you.

What Are Look-Ahead Bias and Repainting?

Short answer: look-ahead bias is when a backtest uses information that was not available at the time of the trade. Repainting is when an indicator changes its past values or signals after new candles arrive. Both make historical signals look perfect while live signals arrive late or never.

Common Look-Ahead Mistakes

Indicators That Can Repaint

How BitLogic Backtester Prevents Both

What Is Survivorship Bias? (Delisted Stocks and Coins)

Short answer: survivorship bias is testing only the assets that survived to today. In stocks it means testing only today's index members and ignoring companies that went bankrupt, were taken over or were removed. In crypto it means leaving out coins that collapsed or were delisted (such as LUNA, which lost almost all its value in May 2022, or FTT after the FTX collapse). It makes almost any buying strategy look better than it really was.

Stock example: you test a "buy the dip" strategy on today's NASDAQ-100 over 20 years. Those companies are in the index today because they grew. A trader in 2006 would also have bought dips in companies that later collapsed, such as Lehman Brothers, and in companies that later dropped out of the index. Your backtest never sees those losses.

Crypto example: the same test on today's top 10 coins by market cap over 5 years has the same flaw. Those coins are in the top 10 because they went up. A trader in 2021 would have bought dips in coins that later went to almost zero.

How to Reduce Survivorship Bias

Like most backtesters, BitLogic Backtester downloads history for markets that are currently listed, so a fully delisted stock or coin cannot be tested. The steps above are the practical way to limit the bias.

How Do I Include Fees, Slippage and Funding Rates?

Short answer: charge the trading fee on both the entry and the exit, apply slippage against you on every market order, add taxes such as stamp duty where they apply, and, for crypto perpetual futures, add or subtract the funding payment at every settlement while the position is open. BitLogic Backtester builds in fees, slippage and funding: the default is 0.1% fee per side and 0.05% slippage, which you can change to match your broker or exchange, and futures tests use the exchange's real funding history.

1. Trading Fees and Taxes

A round trip pays the fee twice. At 0.1% per side, every trade costs 0.2% before slippage. A strategy averaging +0.3% per trade keeps only a third of its profit; at +0.15% per trade it loses money.

MarketTypical cost to model
US stocksOften $0 commission, but you still pay the bid-ask spread, plus small regulatory fees on sales
UK stocksBroker commission, plus 0.5% stamp duty on most UK share purchases
Other stocksBroker commission (often a flat fee per order in Germany, Canada and Australia) plus local taxes and exchange charges
Crypto spotAbout 0.1% per side on major exchanges, less with discounts or maker orders
Crypto futuresAbout 0.02% maker / 0.05% taker per side, plus funding

Check your own broker's or exchange's fee page; rates differ by account level and country. A flat fee per order matters most on small positions: a €5 fee on a €1,000 trade is 0.5% each way.

2. Slippage

Slippage is the difference between the price your strategy expected and the price you actually got. It is larger on small coins and small-cap stocks, on fast candles, at the stock market open and during news. Model at least 0.05% per fill on liquid markets such as large US stocks or Bitcoin, and more on illiquid ones. In BitLogic Backtester's paper trading you can see real slippage measured against live prices.

3. Funding Rates (Crypto Perpetual Futures)

Perpetual futures charge or pay funding, usually every 8 hours. When funding is positive, longs pay shorts. A long position held for weeks in a bull market can lose several percent to funding alone. BitLogic Backtester applies the exchange's historical funding at every settlement while a futures position is open, and shows funding paid in paper trading. Our guide to funding rates explains how they work.

4. Leverage, Liquidation and Gaps

With leverage, a backtest that ignores liquidation is wrong: a 10× long is wiped out by a roughly 10% move against it, even if the price later recovers. BitLogic Backtester models liquidation with isolated margin, so the optimizer cannot simply recommend maximum leverage. Stock traders face the same risk in a different form: an overnight gap on bad earnings can jump straight past a stop loss, which is why BitLogic fills gapped stops at the open price.

BitLogic Backtester charts tab with the equity curve against buy and hold, the drawdown chart and a monthly returns table, all after fees and slippage
Every result in BitLogic Backtester is after fees and slippage. The charts tab shows the equity curve against buy and hold, the drawdown and a month-by-month return table.

How to Make a Backtest Match Live Trading: 7 Steps

Put the fixes together and you get a short routine you can run on any stock or crypto strategy before risking money:

  1. Use closed candles and next-candle fills. Check rules on a candle's close and fill orders at the next candle's open, using only higher-timeframe candles that have closed.
  2. Include every cost. Fees on entry and exit, slippage on every fill, stamp duty or other taxes for stocks, and funding for crypto perpetual futures.
  3. Keep the rules simple. Two or three conditions with a logical reason behind them, and a broad range of good settings rather than the single best one.
  4. Get enough trades. Aim for 100 or more and check that the result is unlikely to be luck. See how much data and how many trades you need.
  5. Test on many markets chosen in advance. Use a list of stocks or coins picked by a rule fixed at the start of the test, not by today's winners.
  6. Use walk-forward optimization. Choose settings on one period, test them on the next unseen period, and judge the strategy only by the unseen results.
  7. Paper trade before using real money. Run the strategy on live prices with virtual money and compare fills, fees and slippage with the backtest (see paper trading vs backtesting).
BitLogic Backtester paper trading screen running a strategy on live prices with virtual money, showing P&L, win rate, fees and slippage
Paper trading in BitLogic Backtester runs your strategy on live prices with virtual money and records the fees and slippage you would really have paid.
Test your strategy the honest way, free: BitLogic Backtester for Windows has next-candle fills, closed-candle multi-timeframe rules, fees, slippage, futures funding and liquidation, walk-forward optimization and luck checks. It covers crypto spot and futures, and stocks from the US, India, the UK, Germany, Hong Kong, Canada, Australia and Japan. Your first 3 backtests and 1 optimization are free. Get it on the Microsoft Store.

Find Setups with BitLogic, Prove Them with the Backtester

BitLogic is our crypto screener and alert app for Windows, iPhone/iPad and Android. It spots RSI extremes, breakouts and trend changes as they happen. Before you act on a setup you see often, test it in BitLogic Backtester, on the coin itself or on a list of stocks with the same rules. One account works in both apps, and paying BitLogic Pro members get the full BitLogic Backtester included.

New to backtesting? Start with What is backtesting? How to backtest stocks and crypto without coding.

FAQ

Why does my strategy win in the backtest but lose live?

The usual causes are overfitting (rules tuned to past noise), look-ahead bias or repainting (the backtest used information that was not available at the time), survivorship bias (testing only stocks or coins that still exist), missing costs (fees, slippage, stamp duty, funding), too few trades, and a change in market conditions. Fix them with realistic costs, next-candle fills, many markets, walk-forward testing and paper trading.

What is overfitting in trading?

Overfitting, or curve fitting, is tuning a strategy's rules and settings so closely to past data that it captures random noise rather than a real pattern. It looks excellent in the backtest and fails on new data, whether the market is a stock such as Tesla or a coin such as Ethereum.

How do I detect overfitting?

Warning signs: results that collapse when a setting changes slightly, many rules and parameters, few trades, a strategy that works on one symbol only, and big gaps between in-sample and out-of-sample results. Test with walk-forward optimization, on other markets and periods, and with small parameter changes.

What is look-ahead bias?

Look-ahead bias is when a backtest uses data that would not have been known at the moment of the trade, such as trading at a candle's open based on that same candle's close, using a higher-timeframe candle before it closed, or reacting to stock earnings before they were released.

What is repainting?

A repainting indicator changes its past values or signals after new candles arrive, so historical charts show perfect signals that were never visible in real time. Zigzag lines, some pivot and fractal indicators, and signals read from an unfinished candle can repaint.

What is survivorship bias in stocks and crypto?

Survivorship bias is testing only the assets that survived to today. In stocks it means testing only today's index members and ignoring companies that went bankrupt or were removed, such as Lehman Brothers in 2008. In crypto it means leaving out coins that collapsed or were delisted, such as LUNA in 2022. Either way, a strategy looks better than it would have been.

How do I include fees, slippage and funding rates in a backtest?

Charge the exchange or broker fee on both entry and exit, apply slippage against you on every market order, add taxes such as UK stamp duty for stocks, and for perpetual futures add or subtract the funding payment at every settlement while a position is open. BitLogic Backtester includes fees, slippage and funding, with defaults of 0.1% fee per side and 0.05% slippage.

Is it normal for live results to be worse than the backtest?

Yes. Even a well-built backtest is usually somewhat better than live trading. Expect lower returns and deeper drawdowns live, and size positions accordingly.

How much worse can live results be?

It varies. A common rule of thumb is to expect the worst live drawdown to be up to 1.5 to 2 times the backtest's maximum drawdown. Monte Carlo analysis gives a better estimate for your own strategy.

For what counts as an acceptable drawdown on stocks and crypto, see what is a good win rate, profit factor, Sharpe ratio and drawdown.

Does optimization always cause overfitting?

No. Optimization causes overfitting when you trust the best in-sample result. Walk-forward optimization, which judges settings on data they never saw, is the safe way to optimize.

Does BitLogic Backtester have look-ahead bias?

It is designed to avoid it: rules use closed candles, orders fill at the next candle's open, higher timeframes use only closed candles, and stops are assumed to fill before targets on the same candle.

Do these problems apply to stocks too?

Yes. Every cause applies to stocks and crypto. Stocks add overnight and weekend gaps, which BitLogic Backtester fills at the open price, earnings surprises, and survivorship bias from index changes and bankruptcies. Crypto adds futures funding, liquidation and coins that collapse or are delisted.

The Bottom Line

A backtest is only as honest as its assumptions. Whether you trade stocks or crypto, use closed candles and next-candle fills, charge every cost, test many markets chosen in advance, get enough trades, judge settings on data they never saw, and paper trade before going live. Then expect live results to be a little worse than the backtest anyway, and size your positions for it.

Get the apps: BitLogic Backtester on the Microsoft Store (Windows; Mac, iPhone, iPad and Android coming soon) | BitLogic screener on the App Store, Google Play and the Microsoft Store

Related guides: What is backtesting? | Walk-forward testing | Paper trading vs backtesting | How much data and trades for backtesting | Good win rate, profit factor, Sharpe and drawdown | BitLogic Backtester | Funding rates explained | Crypto liquidations explained

Nothing here is financial advice. BitLogic Backtester is an analysis tool: it does not place real trades. Past results do not guarantee future returns. Fee levels are typical examples; check your own broker or exchange. Questions: backtester_support@bitlogic.info.