Logo

What Is Backtesting in Trading? A Complete Guide

Tiempo de lectura
11 minutos
Actualizado
13 jun 2026
Backtesting in Trading

You have an idea to trade, maybe a breakout pattern, moving average crossovers or some other charting signal you have noticed. The urge to take a chance on real money immediately is there to see if it will work out. There's a better first move – do it in the past! 

Backtesting in trading means applying your strategy to historical price action data to test your system and determine its profitability without risking any real money.

The most important point to remember before we begin: backtesting shows only the history, not the future. However,  if done right, it is among the best methods to test an idea before going live.

In this guide we will discover what exactly backtesting is, how you can perform it step by step, what metrics to watch out for and some common mistakes even the most advanced traders might make.  

What Is Backtesting in Trading? 

Imagine backtesting as a flight simulator for your trading strategy. Before flying an actual plane, pilots learn the maneuvers in a simulator. 

Backtesting is the same thing for the trading strategy: you select a set of rules and “play through” the past data to see what the hypothetical results would have been before putting out any real money.

The proper backtesting process should answer three big questions: 

  • Would this strategy have made or lost money?
  • How much risk would it have carried along the way?
  • How stable would it have been in varying market situations?

If you can’t answer those questions for a strategy, then you don’t really have a strategy yet. You have a hunch. 

How Does Backtesting Work?

It's not as complicated as it sounds. There are three components to backtesting:

  1. A clearly defined strategy. Well defined entry rules, exit rules, stop-loss logic and position sizing rules. 
  2. Historical price data. Data for the specific market and timeframe you trade, covering enough history to be meaningful.
  3. A way to apply the rules and record results. The rules are applied manually to the charts or automatically by the software. All hypothetical trades are recorded.

When the process is complete, you will have the measured trade results based on wins, losses, drawdown, etc.

However, there is one important aspect that stands out above all others. Rules must be objective and repeatable – such as "if X occurs, then I will do Y.

If your rules are vague, for example, "buy when momentum looks strong", then you can’t backtest it honestly. With hindsight, you end up “cheating” unconsciously.

You will see the winning trades and convince yourself you would have taken them. Precise rules remove that escape hatch.

Graphic: Show a trader comparing two paths before entering the market.

One path shows untested trading with question marks, random entries, and risky outcomes.

The other path shows backtested trading with a checked strategy, past chart data, and clearer risk control.

Why Backtesting Matters?

Typically, traders will backtest for a few practical reasons:

It validates or rejects an idea prior to risking capital. The majority of trading strategies are unsuccessful. So it's better to learn on a screen than on a real account. 

It builds the confidence to follow your strategy through drawdowns. If you've watched the strategy perform in losing periods within the data, you are much less likely to give it up when you need it most. 

It helps you refine rules and parameters. Backtesting reveals under which conditions the approach is effective and under which it breaks. 

It kills bad ideas cheaply. A failed backtest costs you a few hours, but a failed live strategy will cost you money and confidence.

Just remember that a successful backtest only means that your strategy has the potential to be profitable. The backtest itself does not guarantee any profits in live trading. 

Manual vs. Automated Backtesting

There are two common ways of running a backtest, the one that you choose depends on your trading style. 

Manual backtesting involves reviewing a chart backward, moving forward bar by bar, sometimes using a replay function, and logging by hand each trade your rules would have taken. 

It requires no code, can be used in any charting software and works best in discretionary & technical strategies where judgment is needed. 

The drawbacks are that they are inefficient, small sample sizes and may be biased towards hindsight if you know the future.

Automated backtesting is the process in which a platform or script backtests your rules automatically and provides statistics. It is quick, works with large data sets and eliminates human error. 

But it does need objective, coded rules, clean data and some unrealistic assumptions about fills and prices can silently creep in. 

Quick decision framing: Manual is typically for traders who are beginners and want to learn their trade deeply, automated is typically for discretionary, high volume, algorithmic traders where speed and sample size are important. 

Factor

Manual

Automated

Coding needed

None

Usually yes

Speed

Slow

Fast

Best for

Discretionary and chart strategies, beginners

Rule-based and algorithmic strategies, large datasets

Main risk

Hindsight bias, small sample

Unrealistic assumptions, overfitting

Cost

Free with most charting tools

Varies

How to Backtest a Trading Strategy (Step by Step)

Now we are at the practical part of this guide. Follow the steps below properly if you want to know how to backtest a trading strategy. 

Step 1: Describe your strategy in objective rules. 

Write your entry conditions, exit conditions, stop-loss setup, and position size logic. If a rule cannot be written as "if X, then Y," it is not ready for testing.

Step 2: Choose the market and timeframe, then gather data. 

Gather sufficient historical information for the market that you are truly trading. Trades are less frequent and each candle represents more time in higher timeframes, requiring more history. 

Step 3: Choose your method.

Manual or automated testing (based on the above criteria). 

Step 4: Perform the test and log all trades according to the rules.

No losing trade excuses and no "I wouldn't take that one". All trades generated by the rules are recorded.

Step 5: Record outcome and measure performance metrics.

We will discuss them in the next part.

Step 6: Review, refine, and re-test. 

The best scenario would be testing any modifications against a different out-of-sample period, meaning data that has not been used when developing the strategy. If the strategy only works on the data it was built on, that is a warning sign.

Discipline is key here. Test what the rule says, not what you think it should have said. The moment you fudge a single trade in hindsight, the entire backtest becomes meaningless.

Key Backtesting Metrics: What to Actually Measure

A backtest produces a pile of trades. These metrics make that heap a judgment: 

Metric

What it tells you

Win rate

The percentage of trades that were winners.

Profit factor

Gross profit divided by gross loss; above 1 means the strategy made more than it lost.

Maximum drawdown

The largest peak-to-trough decline in your equity, the key measure of how painful the strategy gets.

Average win / average loss

Whether your winners are big enough to justify your losers.

Expectancy

The average amount you can expect to make or lose per trade.

Number of trades (sample size)

How much evidence the test actually contains; too few trades proves nothing.

There's one warning to note in particular – win rate alone is deceptive. A strategy which is profitable 35% of the time can still be very profitable if the winnings are big. A system with a 90% success rate will still make losses if the occasional losing trade is gigantic. 

Always keep win rate in consideration along with average win/loss ratio and maximum drawdown. 

Common Backtesting Mistakes (and How to Avoid Them)

So let's go back to the point where most backtests simply fail. These are common, specific and avoidable mistakes:

Error 1: Overfitting (or Curve-fitting). 

Tuning a strategy so tightly to past data that it captures noise rather than a real edge, then fails on new data. 

With your strategy, assuming you have seven indicators and twelve parameters, you have probably created a description of the past and not a tool for the future. 

Fix: Simplify rules and test on out-of-sample data.

Error 2: Look-ahead bias. 

Using information in the test that would not have been available at the time of the trade, such as entering on a candle's close using its high. 

Fix: at every decision point, only use data that was actually known at that moment.

Error 3: Survivorship bias. 

Testing on only those assets that are still around today, and not those that have lost or been delisted, which boosts the score because the losers were excluded from the data set. 

Fix: utilize historical data that contain delisted and failed names. 

Error 4: Ignoring costs and slippage. 

Not taking into account commissions, spreads, and slippage (the difference between your buy and sell price) over-represents profit on every trade. For high-frequency strategies, transaction costs can erase the entire edge.

Fix: Add realistic trading costs to all tests.

Error 5: Too small a sample. 

A few trades will not make a difference. Ten winning trades in a row may just be a lucky streak. 

Fix: test with a wide variety of trades across various conditions such as trends, ranges, high-volatility periods, etc.

Error 6: Hindsight fudging in manual tests. 

Unconsciously taking slightly better entries and exits than the rules dictate, due to being able to see the next candle.

Fix: Use a bar-replay tool that hides the next trades, and log trades before moving on to the next trade.

Graphic: Show a three-way testing comparison using one trading strategy.

Use three panels:

  • Backtesting: strategy tested on past charts
  • Forward Testing: strategy tested live in demo or real-time market
  • Scenario Analysis: strategy tested against “what if” events like news, volatility, or sudden drops

Backtesting vs. Forward Testing vs. Scenario Analysis

Backtesting is one of three complementary methods of testing strategies and serious traders understand how they work together. 

Backtesting 

It uses real historical data to show how a strategy would have performed in the actual past. It is grounded in events that genuinely happened, which is its strength, but it is also limited to conditions that genuinely occurred. The next crisis may look nothing like the last one.

Forward testing 

It applies the strategy to live, unfolding markets in real time without risking real money, usually through paper trading on a demo account, meaning a simulated account that mirrors live conditions. 

The question of backtesting vs forward testing is really about timing: backtesting checks the past, forward testing checks whether the edge still holds right now. 

Forward testing also brings to light the "real world frictions" that a backtest cannot, such as hesitation, execution delays and your own psychology.

Scenario analysis

Also sometimes called stress testing, tests the strategy against hypothetical conditions that may never have appeared in the historical data, often extreme ones: a sudden volatility spike, an interest-rate shock, or a major historical event repeating in today's market. 

This is where the difference between backtesting and scenario analysis lies. Backtesting re-enacts what occurred. Scenario analysis asks what if, including the worst cases, to gauge how resilient the strategy and your risk plan really are. 

These methods are complementary, not competing. A robust strategy ideally survives all three: backtested in the past, forward-tested in the present, and stress-tested against adverse what-if scenarios, before real capital ever goes on the line.

Method

Data used

What it answers

Main limitation

Backtesting

Real historical data

How the strategy would have performed in the past

The past may not repeat

Forward testing (paper trading)

Live current market, no real money

Does the edge hold now, and can I execute it

Takes time, lacks real-money pressure

Scenario analysis

Hypothetical or invented conditions

How the strategy holds up under stress and worst cases

Scenarios are assumptions, not forecasts

Backtesting and a Disciplined Trading Process

Backtesting is not a one-off task. It is one stage in a disciplined process: define objective rules, backtest them honestly, forward test them in live conditions, and only then trade with real capital under proper risk management. 

The traders who last in this business treat their strategy as a tested hypothesis, not a hunch, and they keep testing as markets evolve.

That evidence-based mindset is exactly what structured trading environments reward. Proving a strategy has an edge before risking capital, and then executing it with discipline, is the same skill set that prop-firm evaluations are built to measure. 

If you have done the work and want to develop further, Audacity Capital supports disciplined traders with evaluated funding paths, funded accounts with up to 90% profit share, and free skill-building resources through Trader University. 

No backtest guarantees a pass or a profit, but a tested, rules-based approach is the right foundation to build on.

Frequently Asked Questions

There is no magical number, although the more trades, the better. While traders tend to believe 100 trades are sufficient and 200 or even more are truly robust, it should not be forgotten that diversity of trading conditions matters; the trades should include trends, ranges and volatility in order to avoid a backtest result driven by favorable conditions.

The longer, the better. Your strategy needs to work under various market circumstances, not just the current one. One-two years might suffice for intraday strategies whereas five-ten for daily/weekly trading. The general rule here is – the greater the timeframe, the fewer trades are made, hence the longer period required for testing.

Many charting applications including MetaTrader 5 and TradingView, provide free historical data for forex, stock indices, and commodity prices. Specialized providers sell tick-level history for more detailed historical records, but even when using them, always check the data for errors. Historical data with errors will produce flawed conclusions.

Yes, you can backtest for free, and no, coding is not required. Manual backtesting works with the free replay tools in most charting platforms. MetaTrader 5 also includes a built-in strategy tester for automated tests. Coding only becomes necessary when you want to automate complex rules or test very large datasets quickly.

Manual backtesting typically takes several hours to a few days per strategy, depending on the timeframe and how many trades you log. Automated backtesting can process years of data in minutes once the rules are coded. Budget extra time for the most important part: reviewing the results and re-testing refinements honestly.

The usual culprits are overfitting to past data, ignoring spreads, commissions, and slippage, look-ahead bias in the test, or a market regime that has shifted since your data period. Execution and psychology also differ live. Re-test with realistic costs, validate on out-of-sample data, and forward test before committing capital again.

AudaCity Capital Research Team
Autor:AudaCity Capital Research Team
Trading Research & Market Analysis Team

¿Listo para aplicar un riesgo disciplinado a las criptomonedas? Explore los nuevos instrumentos de cripto de Audacity Capital y traiga su estrategia de trading.

Aprender más

Boletín

Únase a nuestro boletín para mantenerse al día.

Únete a Nuestra Comunidad Social

Únete a Nuestro Discord