Why Does My Strategy Win in the Backtest but Lose Live? Overfitting, Look-Ahead Bias, Survivorship Bias and Trading Costs
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
- Backtests usually look better than live trading. The gap comes from six causes: overfitting, look-ahead bias, repainting, survivorship bias, missing costs and too few trades.
- Overfitting is the biggest one. Detect it with walk-forward testing, other markets and small setting changes.
- Look-ahead bias disappears when rules use only closed candles and orders fill at the next candle's open.
- Survivorship bias: testing only today's winning stocks or coins ignores the ones that went bankrupt, collapsed or were delisted.
- Costs: include fees on both sides and slippage on every fill, plus stamp duty for UK shares and funding rates for crypto futures.
- BitLogic Backtester builds these protections in, for stocks and crypto, without code.
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:
| Cause | What happens | Typical symptom | Fix |
|---|---|---|---|
| Overfitting | Rules fit past noise | Great backtest, poor results on any new data | Walk-forward testing, fewer rules, more markets |
| Look-ahead bias | Backtest uses future data | Entries at the perfect price, unreal win rates | Signal on close, fill at next open |
| Repainting | Indicator rewrites its past | Signals on the chart that never appeared live | Use only closed-candle values |
| Survivorship bias | Only survivors tested | Strategy "works on all the stocks or coins" you picked today | Choose symbols by rules fixed in advance |
| Missing costs | Fees, slippage, funding ignored | A frequent-trading strategy turns from profit to loss | Model every cost |
| Too few trades | Result is luck | Under 20 to 30 trades | More 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:
| Cause | Stocks | Crypto |
|---|---|---|
| Look-ahead | Earnings and news released after the close; split- and dividend-adjusted prices | Unfinished candles on a market that never closes; open higher-timeframe candles |
| Survivorship | Testing 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) |
| Costs | Bid-ask spread, commission, UK stamp duty, short borrow fees | Exchange fees, slippage on small coins, futures funding |
| Gaps | Overnight and weekend gaps straight through a stop | Fewer gaps (24/7 trading), but sudden wicks and liquidation cascades |
| Leverage | Margin calls on leveraged positions | Liquidation 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
- Fragile settings: changing a parameter by one or two steps turns profit into loss. A real edge has a broad "plateau" of good settings.
- Too many rules: each extra condition and parameter gives the strategy more freedom to fit noise.
- Few trades: 15 trades can be fitted perfectly by almost any rule set.
- One market only: it works on Apple but not Microsoft; on BTC but not ETH, SOL or BNB.
- One period only: great in 2021, flat or negative from 2022 to 2024.
- In-sample far better than out-of-sample: the settings that won on the training period do much worse on the period after it.
- Too smooth to be true: a near-perfect equity curve with tiny drawdowns on a volatile stock or coin.
How to Prevent Overfitting
- Walk-forward optimization: pick settings on one period, test them on the next unseen period, and repeat. BitLogic Backtester's optimizer does this and judges the result only by the unseen periods.
- Test on many markets: run the same rules on up to 10 stocks or coins at once.
- Keep it simple: two or three conditions with a logical reason behind them beat ten conditions that happen to fit.
- Prefer stable settings over the single best one.
- Paper trade before using real money.
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
- Same-candle fills: the signal uses a candle's close, but the trade is filled at that candle's open or low. In reality you only know the close when the candle ends.
- Unfinished higher-timeframe candles: a 1-hour strategy checks the daily trend using today's daily candle, which has not closed yet. This is easy to miss in crypto, where the daily candle is always "live".
- Optimistic intrabar order: a candle touched both the stop and the target, and the backtest assumes the target was hit first.
- Trailing stops moved on the current candle's high, then checked against the same candle's low.
- Earnings and news timing (stocks): a rule reacts to quarterly results on the day they were announced, even though they came out after the close.
- Adjusted prices (stocks): split- and dividend-adjusted price history can show prices that never actually traded, and unadjusted data can show a fake crash on a split day.
Indicators That Can Repaint
- Zigzag and swing-point indicators, which confirm a high or low only several candles later.
- Some pivot and fractal indicators, for the same reason.
- Any signal read from the current, unfinished candle, including higher-timeframe values.
How BitLogic Backtester Prevents Both
- Rules are checked on a candle's close, and orders fill at the next candle's open. Nothing is traded using the candle it fills on.
- Multi-timeframe rules use only higher-timeframe candles that have closed.
- When a candle touches both the stop and the target, the stop is assumed to fill first, because candles cannot show which came first.
- Gaps fill at the open: if a stock gaps below your stop overnight, you get the open price, not your stop price.
- Trailing stops move only on previous candles.
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
- Choose symbols by a rule fixed in advance, as of the start of the test (for example, "the 10 largest stocks in my market in January 2016" or "the top 10 coins by volume in January 2021"), not by today's leaders.
- Include losers you know about that still have data: stocks and coins that fell 90% or more and are still listed.
- Treat results on today's winners with suspicion, especially long-only strategies.
- Prefer strategies that also work in a falling market, or that sit in cash in a downtrend.
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.
| Market | Typical cost to model |
|---|---|
| US stocks | Often $0 commission, but you still pay the bid-ask spread, plus small regulatory fees on sales |
| UK stocks | Broker commission, plus 0.5% stamp duty on most UK share purchases |
| Other stocks | Broker commission (often a flat fee per order in Germany, Canada and Australia) plus local taxes and exchange charges |
| Crypto spot | About 0.1% per side on major exchanges, less with discounts or maker orders |
| Crypto futures | About 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.
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:
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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).
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.