Glossary
Backtest vs live trading
Last reviewed: 15 September 2026·Tradelyze
The backtest-to-live gap is the difference between how a trading strategy performed in a backtest and how it performs with real money. Good backtests lose money live for two main reasons: the settings were tuned to past noise, or the backtest assumed fills and costs that live markets do not give you.
In plain English
A backtest replays your rules on old prices and assumes every order filled cleanly. Live trading adds real costs, missed fills and prices nobody has seen yet. If the strategy only looked good because it was tuned to the past, or because its edge was smaller than those costs, the live account shows it. Forward testing and paper trading sit in between: both run the unchanged strategy on new prices as they arrive, without real money.
New to this? Start with in-sample vs out-of-sample.
Why do live results differ from backtest results?
Live results differ from backtest results because a backtest is a simulation with two built-in advantages that live trading never has. Backtesting means running a strategy's rules over past prices to see how it would have done.
The first advantage is hindsight. The person building the strategy has usually seen the same prices the backtest runs on, and has often tried many settings until one looked good. That winning setting fits the past by construction, and part of what it fits is luck that will not repeat.
The second advantage is a clean market. A backtest on price bars has to assume how orders were filled: at what price, whether a limit order filled at all, and what it cost. TradingView's Pine Script documentation says slippage "is dynamic and unpredictable, making it impossible to simulate precisely", so every backtest cost figure is an estimate.
Most disappointing live results come from one of those two causes, or both at once. Knowing which one you have decides what to fix, which is why the backtest-to-live gap is worth diagnosing before you change anything.
Is it overfitting or execution?
A strategy that backtests well and fails live has usually failed in one of two separate ways, and each needs a different fix. Overfitting, also called curve fitting, means the settings were tuned until the backtest matched the past too closely, so the edge was never real. Execution failure means the edge was real but smaller than the live costs and fill problems the backtest left out.
| Failure mode | Typical signs | What fixes it |
|---|---|---|
| Overfitting | Results collapse when a setting is nudged or the start date moves; performance on data the optimizer never saw is far worse than on the data it was tuned on; many settings were tried before one looked good. | Fewer tuned inputs, more trades, and honest tests on unseen data. Better execution does not help, because there is no edge to protect. |
| Execution failure | Signals match the backtest but fill prices are worse; small average profit per trade; many trades per day; limit orders at the day's extremes that did not fill live. | Realistic commission and slippage in the backtest, fewer and larger trades, stricter limit-fill assumptions. More out-of-sample testing does not help, because it uses the same simulated fills. |
A quick diagnosis: compare your live trades with the backtest over the same dates. If the live account took roughly the same trades at worse prices, the problem is execution. If the trades match and still lose, the strategy is probably overfit. The overfitting and sample size page covers the overfitting checks in detail.
Which backtest assumptions break in live trading?
The backtest assumptions that break most often in live trading concern what happens inside a price bar, what trading costs, and whether an order fills at all. Each is a default in most backtesters, including TradingView's Strategy Tester, and each flatters the result.
| Backtest assumption | What actually happens live | Worst affected | Source |
|---|---|---|---|
| The price path inside each bar is known | A bar only records open, high, low and close. TradingView's broker emulator assumes price went open, high, low, close when the open is nearer the high, and open, low, high, close otherwise. When a stop and a target are both inside one bar, that rule decides which one "hit first", not the market. | Strategies with a stop and a target close enough to be touched in the same bar | TradingView Pine Script documentation, Strategies page |
| Limit orders fill when price touches them | A real limit order waits in a queue behind other orders at the same price, so price can touch the level without filling it. TradingView's default limit-fill setting is 0 ticks, which fills any limit order as soon as price reaches its level. | Mean-reversion and scalping strategies that buy at the low and sell at the high | TradingView Pine Script documentation, Strategies page |
| A signal on a bar's close fills at that close | TradingView fills an order at the open of the next bar by default. Setting process_orders_on_close = true fills market orders at the same close that created the signal, which a live order usually cannot achieve. |
Bar-close strategies, worst on instruments that gap between sessions | TradingView Pine Script documentation, Strategies page |
| Trading is free unless you say otherwise | TradingView applies no commission unless one is specified and uses a default slippage of 0 ticks. The documentation's own cost settings are commission and a fixed slippage; it describes no bid-ask spread or overnight financing setting. | High-frequency strategies with small average profit per trade | TradingView Pine Script documentation, Strategies page |
| Spread, swap and tick data are realistic | Practitioners on Forex Factory report that MetaTrader 4 builds ticks by interpolating one-minute bars, and that it does not deduct spread or apply daily rollover. The spread report is a 2007 post disputed inside its own thread. | Forex scalping and multi-day holding strategies | Forex Factory threads 523334 and 39799; practitioner accounts, not a study |
| The strategy calculates the same way live as in history | TradingView's repainting documentation says a strategy using calc_on_every_tick = true runs on each live price update but only on bar closes in history, so the two will most probably not produce the same orders, which "invalidates backtesting results". | Strategies set to calculate on every tick | TradingView Pine Script documentation, Repainting page |
TradingView does offer a partial fix for the first row. Its documentation says users on Premium and Ultimate plans can switch on high historical bar detail, the use_bar_magnifier setting, which fills orders using a lower timeframe's bars when possible. That narrows the intrabar guess; it does not add spread, queue position or slippage.
A worked example of costs erasing a real edge
Constructed illustration, not measured data. A futures strategy takes 400 trades in a backtest and averages $30 profit per trade with commission and slippage left at TradingView's defaults of zero. That is $12,000 of backtest profit. Where those defaults live, and how to write real figures into the script, is covered on the TradingView strategy properties page.
Live, the trader pays $4 commission per round trip and loses one tick of slippage on the way in and one on the way out. At $5 per tick, that is $10 of slippage. The real cost per trade is $14, so the average profit falls from $30 to $16 and the 400 trades make $6,400 instead of $12,000: 47% less, with no overfitting involved at all.
The same $14 cost on a strategy averaging $12 per trade turns a profitable backtest into a strategy that loses $2 on every trade. The smaller the average trade, the more of it live costs take, which is why scalping strategies suffer the largest gap.
How much worse should live trading be than the backtest?
No primary source gives a universal figure for how much worse live trading will be than a backtest. The gap depends on how hard the strategy was searched for, how often it trades and how realistic its costs were, so any single percentage quoted as a rule is a guess.
Two studies show the size and shape of the problem without giving a rule. Campbell R. Harvey and Yan Liu write in The Journal of Portfolio Management (Fall 2015) that discounting backtested Sharpe ratios by 50% is common practice but "only a rule of thumb". The Sharpe ratio is return divided by how much returns swing; see the Sharpe ratio page.
Harvey and Liu find the correct discount, which comes from how many strategies were tested, is almost always more than 50% when the annualized Sharpe ratio is below 0.4, and at most 25% when it is above 1.0. Annualized means converted to a yearly figure. A marginal backtest loses the most.
R. David McLean and Jeffrey Pontiff, in The Journal of Finance (February 2016), studied 97 published stock-return predictors and found portfolio returns 26% lower out of sample and 58% lower after publication. Those were academic signals, not retail strategies, and the authors call the out-of-sample decline an upper bound estimate of data mining effects.
The part that is usually left out
A fixed haircut treats every strategy the same, which is the opposite of what Harvey and Liu found. Instead of discounting a backtest by a set percentage, rerun it with realistic costs, count how many settings you tried, and test it on data it never saw. Those three steps estimate your own gap instead of borrowing someone else's.
What do forward testing and paper trading each prove?
Forward testing and paper trading each prove something a backtest cannot, and they prove different things. Forward testing freezes a strategy's rules and settings, then records its signals on new prices as they arrive. Paper trading goes further and sends simulated orders on live prices, usually through a broker's or charting platform's demo account.
| Method | When the test data existed | How orders are filled | What it can catch |
|---|---|---|---|
| Backtest | Before the strategy was built, often already seen by its designer | Simulated on historical bars | Rules that never worked, even with hindsight |
| Walk-forward analysis | Before the test ran, but hidden from the optimizer | Simulated on historical bars | Settings tuned to the exact bars being reported on |
| Forward test | After the strategy was frozen | Signals recorded, often with no orders sent | Hidden tuning to history, and a changed market |
| Paper trading | Live, in real time | Simulated orders on live prices | Signal timing, platform behavior and rough live fills |
| Live trading at small size | Live, in real time | Real orders, real queue, real costs | True execution costs and how you behave with money at risk |
The key difference: a forward test answers "does the edge still exist on prices nobody could have tuned to?", while paper trading adds "does the strategy behave as expected when orders are placed in real time?" Neither uses real money, so neither shows exactly how your fills behave when a real order waits in the queue.
Harvey and Liu make the same ranking in their 2015 paper: a true out-of-sample test of a strategy, "not a holdout sample of historical data", is a cleaner way to judge whether it works.
How long should I forward test before trading live?
No published source we could verify sets a minimum length for a forward test, so any figure in weeks or months you read is someone's opinion rather than a result. The useful unit is trades, not calendar time, because a strategy that trades five times a month learns far less in three months than one that trades five times a day.
The trade-count guidance that circulates has no primary source either. Fewer than about 30 trades supports almost no conclusion, by a general statistics rule of thumb, and about 100 trades is the level commonly quoted for reasonable confidence. The how many trades a backtest needs section explains where those conventions come from and why they are only conventions.
Two practical rules follow. First, decide in advance how many forward trades you will wait for and what result would stop you, so you cannot move the goalposts halfway through. Second, check that the forward-test period includes the kind of market the strategy is weakest in; a trend strategy forward tested only through a strong trend has not been tested.
What can walk-forward analysis substitute for, and what can it not?
Walk-forward analysis can substitute for part of a forward test, but not for paper or live trading. Walk-forward analysis tunes a strategy on one stretch of history, then scores those exact settings on the next stretch the optimizer never saw, and repeats that across several windows.
What walk-forward analysis can replace is the overfitting half of a forward test. The out-of-sample windows show whether tuned settings keep their edge on unseen data, and walk-forward runs in hours instead of the months a forward test takes. The walk-forward efficiency figure summarizes how much of the edge survived.
What walk-forward analysis cannot replace is anything about execution or the future. Its unseen windows are still historical bars, filled with the same simulated rules as the backtest, so it inherits every assumption in the table of assumptions that break. Its unseen data also sat on disk while the strategy was being designed, so the test is only as clean as the designer's discipline.
Check this on your own results
Count how many times you changed the strategy after looking at walk-forward results. Each round of adjusting and re-running lets the unseen windows shape the design, until they are no longer unseen. If the answer is more than once or twice, treat the walk-forward result as partly in-sample and put more weight on a forward test.
How do I narrow the gap before going live?
You narrow the backtest-to-live gap by making the backtest harder to pass before real money is involved. None of these steps guarantees live profit; each removes one way a backtest overstates results.
- Put realistic costs in the script. Set commission and slippage in your Pine Script's
strategy()declaration, and consider requiring price to move a few ticks beyond a limit level before it counts as filled. If the strategy only works at zero cost, it does not work. The TradingView strategy properties page explains each cost setting and its default. - Get enough trades. A result built on a few dozen trades can be luck. See why the number of settings tried matters as much as the trade count.
- Test on data the optimizer never saw. Use walk-forward analysis or a held-back period, and look at results on the unseen data rather than the best tuned result.
- Check prop-firm rules after costs. A strategy whose worst backtest day sits just inside a firm's daily loss limit will breach it once live costs are added. The prop firm rules and backtest metrics page explains which backtest numbers predict a breach.
- Forward or paper test, then start small. Run the frozen strategy on new prices for the number of trades you decided in advance, then trade the smallest size available and compare every live fill with what the backtest assumed.
Where this appears in Tradelyze
Tradelyze checks the overfitting side of this gap, not live execution: Best Metrics are in-sample, while Mean OOS Sharpe, OOS Profit and % Windows Profitable come from test windows, which count as unseen data only when the label beside the walk-forward badge reads Re-tuned each window. Tradelyze re-runs an uploaded TradingView Pine Script strategy from your exported trade list and price data, then runs parameter optimization, walk-forward analysis, a five-check robustness score and prop-firm rule checks. It does not place trades, give financial advice or guarantee a challenge pass, and it is in beta.
Create an account. Already a user? Open your strategies.
Three details matter when you read a Tradelyze report with the live gap in mind. Tradelyze runs your script with the initial capital, commission, slippage, order size, pyramiding and input values written in its strategy() header and input() defaults, so costs you only typed into TradingView's Properties tab are not part of the run. Baseline Matching compares Tradelyze's re-run with your TradingView trade list; a high Match Rate means the TradingView backtest was reproduced, not that its fills were achievable live.
The prop-firm check also leaves out rules that decide real challenges. Qualifies does not cover a firm's evaluation time limit, news-trading restrictions or weekend-holding rules, as the Qualifies and Not Feasible section explains, so check those against the firm's current terms yourself.
More questions about the product are answered in the Learn FAQ.
Stage 4 · step 18 of 18. Put it together: how to validate a trading strategy
Frequently asked questions about backtest vs live trading
Why are my backtested strategies failing in live trading?
Usually for one of two reasons. The strategy was overfit, meaning its settings were tuned until they matched past prices by luck, so there was never a real edge. Or the edge was real but too small to survive live execution: spread, slippage, commissions and missed limit fills that the backtest assumed away. The two failures need different fixes, so work out which one you have first.
What is the difference between backtesting and forward testing?
A backtest runs a strategy's rules over price history that already existed when the rules were written. A forward test freezes the rules and settings, then records what the strategy does on new prices as they arrive. Because the forward-test data did not exist when the settings were chosen, nobody could have tuned the strategy to it, which a backtest can never guarantee.
What is the difference between backtesting and paper trading?
Backtesting simulates trades on historical bars using fill rules the software assumes. Paper trading sends simulated orders on live prices in real time, so signals arrive at real speed and you see how orders are handled on current market data. Paper trading still uses no real money, so it cannot show your own order moving the price or exactly how fills behave when money is at stake.
Is paper trading the same as live trading?
No. Paper trading uses live prices but simulated fills, so a paper account can fill a limit order that a real order waiting in the queue would have missed, and it records none of the hesitation or rule-breaking that real money tends to cause. Treat a good paper result as necessary rather than sufficient, and start live trading at the smallest size your broker or prop firm allows.
How much worse is live trading than a backtest?
No primary source gives a universal discount. Campbell Harvey and Yan Liu call the common 50% Sharpe-ratio haircut only a rule of thumb, and find the correct cut is almost always larger than 50% for annualized Sharpe ratios below 0.4 and at most 25% above 1.0. McLean and Pontiff found published stock-return predictors earned 26% less out of sample, but those were academic signals, not retail strategies.
How long should I forward test a strategy before trading live?
No published source we could verify sets a minimum length for a forward test, so any figure in weeks or months you read is someone's opinion. Count trades rather than calendar time. Fewer than about 30 trades supports almost no conclusion, by a general statistics rule of thumb with no trading-specific source, and a slow strategy may need many months to reach that.
Does TradingView's Strategy Tester include slippage and commission?
Only if you set them. TradingView's Pine Script documentation says a strategy applies no commission unless one is specified, and that slippage is a fixed number of ticks with a default of 0. The documentation also says slippage is dynamic and unpredictable, making it impossible to simulate precisely, so a fixed figure is an approximation rather than a measurement.
Why does my strategy fill trades at prices the live market never gave me?
Because a backtest on bars has to guess what happened inside each bar. TradingView's broker emulator assumes price went open, high, low, close when the open is nearer the high, and open, low, high, close otherwise. By default it also fills a limit order as soon as price touches the limit level, even though a real order waiting at that price may not fill.
Can walk-forward analysis replace forward testing?
No. Walk-forward analysis tests tuned settings on historical data the optimizer did not see, which is good evidence against overfitting and can be run in an afternoon. The unseen data still existed on disk when you designed the strategy, and walk-forward uses the same simulated fills as the backtest, so it tests neither truly new prices nor live execution.
Should I pay for a prop firm challenge if my backtest passes the rules?
A backtest that stays inside a firm's limits is a reason to keep testing, not proof you will pass. Live costs push each day's loss closer to the daily limit, and the challenge runs on a different stretch of prices than the backtest. Check that the strategy still passes after realistic costs, then forward or paper test it before paying the fee.
Does Tradelyze forward test or paper trade my strategy?
No. Tradelyze works only on the historical files you upload: your Pine Script, your TradingView trade list and your price data. Tradelyze re-runs the backtest, then runs optimization, walk-forward analysis, robustness checks and prop-firm rule checks. Tradelyze does not place trades, so forward testing and paper trading have to happen outside it, on your charting platform or broker.
Is backtesting useless if live results always differ?
No. A backtest is the cheapest way to reject a strategy: one that loses money in a careful backtest with realistic costs will almost never make money live. The mistake is reading a backtest as a forecast. Treat a good backtest as permission to run the next test, meaning out-of-sample checks, then forward or paper testing, then small live size.
Sources
- TradingView, Pine Script User Manual: Strategies, tradingview.com (retrieved 14 September 2026). The broker emulator's intrabar rule (open → high → low → close when the open is closer to the high, open → low → high → close otherwise); orders filling "at the open of the following bar" under the default calculation behavior;
process_orders_on_closefilling market orders on the same closing tick; "If not specified, the strategy applies no commission to filled orders"; slippage as "a fixed number of ticks" with a default of 0, and the statement that slippage "is dynamic and unpredictable, making it impossible to simulate precisely";backtest_fill_limits_assumptionwith a default of 0, filling a limit order "immediately if the price reaches the order's level"; and high historical bar detail (use_bar_magnifier) for "Users with Premium and Ultimate plans". The page describes commission and slippage settings and no spread or overnight financing setting. - TradingView, Pine Script User Manual: Repainting, tradingview.com (retrieved 14 September 2026): strategies using
calc_on_every_tick = true"will most probably not generate the same order executions", and "it also invalidates backtesting results, as they are not representative of the strategy's behavior in realtime." - R. David McLean and Jeffrey Pontiff, Does Academic Research Destroy Stock Return Predictability?, The Journal of Finance 71(1), February 2016, pages 5–32, DOI
10.1111/jofi.12365. From the abstract: 97 predictor variables; "Portfolio returns are 26% lower out-of-sample and 58% lower post-publication"; "The out-of-sample decline is an upper bound estimate of data mining effects." - Campbell R. Harvey and Yan Liu, Backtesting, The Journal of Portfolio Management 42(1), Fall 2015, DOI
10.3905/jpm.2015.42.1.013; author copy at people.duke.edu (retrieved 14 September 2026). "The 50% haircut is only a rule of thumb"; the haircut "is almost always more than and sometimes much larger than 50% when the annualized Sharpe ratio is less than 0.4" and "at most 25%" when the Sharpe ratio is greater than 1.0; and "true out-of-sample tests of a particular strategy (not a holdout sample of historical data) is a cleaner way to evaluate a strategy's viability." Their haircut adjusts for how many strategies were tested; it is not an estimate of execution costs. - David H. Bailey, Jonathan M. Borwein, Marcos López de Prado and Qiji Jim Zhu, Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance, Notices of the American Mathematical Society 61(5), May 2014, pages 458–471, DOI
10.1090/noti1105— background for the overfitting failure mode; the detailed treatment is on the overfitting and sample size page. - Forex Factory threads 523334 (Best third party strategy tester for MetaTrader 4: ticks interpolated from one-minute bars) and 39799 (MT4 EA Strategy Tester backtest results: spread not deducted and rollover not applied, a 2007 post disputed in its own thread). Practitioner accounts, not a study. Quoted and retrieved on 28 July 2026 for the overfitting and sample size page; Forex Factory refused automated retrieval when this page was written, so the quotations were not re-checked here.
- No primary source was found for a minimum forward-test length, for a universal backtest-to-live discount, or for the 30-trade and 100-trade conventions; each is described on this page as unsourced.
- Constructed arithmetic used on this page and in Figure 1, requiring no source: 400 trades at $30 average profit = $12,000; a $4 commission plus two $5 ticks of slippage = $14 per trade; 400 × $16 = $6,400, which is 46.7% less than $12,000, rounded to 47%. Figure 1 plots these constructed numbers; it is not measured data.
- Tradelyze implementation, reviewed 15 September 2026: runs use the initial capital, commission, slippage, order size, pyramiding and input defaults written in the uploaded script; the Baseline Matching stage and Match Rate; in-sample Best Metrics; the walk-forward card's Mean OOS Sharpe, OOS Profit and % Windows Profitable, which are out-of-sample only when the method label beside the walk-forward badge reads Re-tuned each window; the Qualifies and Not Feasible prop firm badge, which does not check time limits, news trading or weekend holding; and the absence of any trading, forward-testing or paper-trading function.