Launch pricing · Limited time · Get access →
Axion Algo Logo
  • Pricing
  • Affiliates
Log inLog In
  1. Home
  2. Blog
  3. How to Backtest a Trading Strategy: Step-by-Step Guide
Mar 1, 2026

How to Backtest a Trading Strategy: Step-by-Step Guide

Learn how to backtest any trading strategy. Manual vs automated methods, common pitfalls like curve-fitting, what metrics to track, and how to interpret results.

Cover Image for How to Backtest a Trading Strategy: Step-by-Step Guide

How to Backtest a Trading Strategy: Step-by-Step Guide

Every profitable trader has a strategy they trust. And the reason they trust it is not because someone on YouTube told them it works. It is because they tested it against real historical data and saw the results with their own eyes.

That process is called backtesting. It is the closest thing trading has to a scientific method: define a hypothesis, test it against evidence, measure the results, and decide whether the evidence supports the hypothesis or not.

The traders who skip this step are guessing. This guide walks you through how to backtest a trading strategy, what pitfalls to avoid, and how to read the results so you know whether your strategy has a real edge or just a convincing illusion of one.

What Is Backtesting?

Backtesting is the process of applying a trading strategy to historical price data to determine how it would have performed. You define your entry rules, exit rules, stop loss, take profit, and position sizing, then replay the market and record every trade the strategy would have taken.

The output is a set of statistics: how many trades occurred, how many won, how many lost, the average profit per winner, the average loss per loser, the largest winning streak, the worst losing streak, and the maximum drawdown from peak to trough.

Those numbers tell you whether the strategy has a statistical edge or is a net loser that would bleed your account dry over time. They do not guarantee future performance, but they give you evidence rather than hope. A strategy you have not backtested is a strategy you do not understand.

Manual Backtesting

Manual backtesting means scrolling through historical charts by hand, identifying every signal your strategy would have generated, logging the entry and exit, and recording the result.

How It Works

You open a chart on TradingView (or any charting platform), scroll back to a starting date, and apply your strategy rules bar by bar. Each time your criteria are met, you log the trade in a spreadsheet or journal. Entry price, stop loss, take profit, outcome. You repeat this for every signal across months or years of historical data.

Pros of Manual Backtesting

It is free. You need nothing more than a charting platform and a spreadsheet.

It teaches you the market. There is no faster way to develop pattern recognition than scrolling through thousands of candles and watching how price behaves around your setup. After manually backtesting 200 trades, you will have an intuitive feel for your strategy that no automated report can replicate.

It forces you to confront losing trades. When you log every trade by hand, you see the losing streaks and feel the drawdowns. This prepares you psychologically for live trading.

Cons of Manual Backtesting

It is painfully slow. A manual backtest of 200 trades might take 10 to 20 hours. Most traders give up after 50 trades, which is not enough data to draw conclusions from.

Human bias creeps in. It is easy to subconsciously skip trades that would have lost or include borderline setups because you already know how price moved. Use the replay feature on TradingView to hide future price action and force real-time decisions.

It scales poorly. Testing five pairs across three timeframes means 15 separate manual backtests. Automated backtesting does this in minutes.

Automated Backtesting

Automated backtesting uses code to apply your strategy rules to historical data and generate results instantly. On TradingView, this is done through the Strategy Tester using Pine Script. Dedicated platforms like MetaTrader, QuantConnect, or Amibroker offer their own programming languages and testing engines.

How It Works

You translate your strategy rules into code. Entry conditions, exit conditions, stop loss, take profit, position sizing. The software runs those rules against historical data and produces a report: total trades, net profit, win rate, maximum drawdown, profit factor, and a visual equity curve showing how your account would have grown or shrunk over time.

Pros of Automated Backtesting

Speed. Two years of 15-minute data produces results in seconds. You can test variations and iterate far faster than any manual process.

No human bias. The computer applies rules exactly as defined. No skipped trades, no borderline setups, no peeking at future data.

Scalability. Testing across multiple instruments, timeframes, and date ranges is trivial.

Cons of Automated Backtesting

Programming barrier. Translating a visual strategy into precise code is harder than it looks. A small error, like entering one bar too early, produces dramatically misleading results.

Over-optimization risk. The speed of automated testing makes it easy to keep tweaking until the backtest looks perfect. This is the path to curve-fitting.

False precision. A reported win rate of 67.3% looks scientific, but if the test was run on only 60 trades, the confidence interval is so wide the true win rate could be anywhere from 55% to 80%.

Step-by-Step Manual Backtest Process

If you are starting your first backtest, here is the process from beginning to end.

Step 1: Define Clear Entry and Exit Rules

Write down your strategy rules in plain language that leaves zero room for interpretation. "Buy when RSI is oversold" is too vague. At what RSI level? On what timeframe? Does the candle need to close below 30, or just touch it? What about the higher timeframe trend? Do you need additional confirmation?

A properly defined entry rule looks like this: "Enter long when RSI(14) on the 1H chart closes below 30 AND the 4H 50 EMA is above the 200 EMA. Entry at the close of the signal candle." Do the same for exits. Ambiguity in your rules means ambiguity in your results.

Step 2: Pick a Market and Timeframe

Choose one instrument and one timeframe to start. EUR/USD on the 1-hour chart is a common starting point because it has high liquidity and enough volatility to generate regular signals. Get the process right on one pair first. You can expand later.

Step 3: Go Back at Least 6 Months

Six months is the absolute minimum. A year or more is better. You need enough data to capture different market conditions: trending, ranging, high-volatility, and quiet periods. On TradingView, use the bar replay feature to scroll back to your starting date and step forward one candle at a time. This prevents you from seeing future price action and biasing your decisions.

Step 4: Log Every Signal

Every time your entry rules are met, log the trade. Every single time. Not just the ones that look like they will work. Record: the date and time, the entry price, the stop loss price, the take profit price, whether the trade hit the target or the stop, and the result in pips and dollars.

If a signal fires but you would not have taken it for some reason not in your rules (for example, it was 2 AM and you were asleep), note that too. That information tells you something about the practical viability of the strategy for your schedule.

Step 5: Calculate Metrics

After logging at least 100 trades (fewer than this and your statistics are unreliable), calculate the following metrics.

Key Metrics to Track

Win Rate

The percentage of trades that ended in profit. If you took 100 trades and 58 were winners, your win rate is 58%. A win rate above 50% is not automatically profitable, and a win rate below 50% is not automatically unprofitable. What matters is win rate combined with average win size versus average loss size.

Profit Factor

Gross profit divided by gross loss. If your winning trades generated $5,000 in total profit and your losing trades generated $3,000 in total loss, your profit factor is 1.67. A profit factor above 1.0 means the strategy is net profitable. Above 1.5 is considered good. Above 2.0 is excellent. Below 1.0 means you are losing money.

Maximum Drawdown

The largest peak-to-trough decline in your simulated account equity. If your account grew from $10,000 to $12,000 and then dropped to $10,500 before recovering, the maximum drawdown was $1,500, or 12.5% from the peak. Maximum drawdown tells you the worst-case scenario you need to survive psychologically and financially. Use our drawdown calculator to model different drawdown scenarios and understand the recovery math.

Expectancy Per Trade

The average dollar amount you expect to make (or lose) on each trade. The formula is: (Win rate x Average win) minus (Loss rate x Average loss). If your win rate is 55%, your average winner is $200, and your average loser is $150, your expectancy is (0.55 x $200) minus (0.45 x $150) = $110 minus $67.50 = $42.50 per trade.

Positive expectancy means the strategy makes money over time. Negative expectancy means it loses money over time. It does not matter how good individual trades feel if the expectancy is negative.

Average Risk-to-Reward Ratio

The average size of your winners compared to the average size of your losers. If your average winner is $200 and your average loser is $100, your R:R is 1:2. Combined with win rate, this ratio determines profitability. A strategy with a 40% win rate and a 1:3 R:R is more profitable than a strategy with a 60% win rate and a 1:0.8 R:R.

Common Pitfalls

Curve-Fitting

This is the most dangerous trap in backtesting. Curve-fitting happens when you adjust your strategy parameters to perfectly match historical data. You change the RSI period from 14 to 11 because 11 worked better in the past year. You shift the moving average from 50 to 47 because 47 produced fewer false signals on this specific pair in this specific time window.

The result is a strategy that looks incredible on the historical data it was fitted to and falls apart the moment market conditions shift. The more parameters you tweak, the higher the risk of curve-fitting. A strategy with two adjustable parameters has limited room for overfitting. A strategy with eight adjustable parameters can be twisted to fit almost any data set.

The antidote is out-of-sample testing. Optimize your strategy on one time period (the "in-sample" data), then test it without any changes on a different time period (the "out-of-sample" data). If performance collapses on the out-of-sample data, you have curve-fitted.

Survivorship Bias

If you are testing a stock-picking strategy, you are probably only testing on stocks that currently exist. The companies that went bankrupt, got delisted, or were acquired are missing from your data. This creates a systematic upward bias because your test universe only includes survivors.

For forex, this is less of a concern because major pairs do not get delisted. But for crypto, where tokens regularly go to zero, survivorship bias can dramatically inflate results.

Too Small a Sample Size

Twenty trades is not a backtest. It is a coin flip. You need at least 100 trades, ideally 200 or more, for statistical confidence. A 70% win rate on 20 trades has a confidence interval so wide that the true rate could easily be 50% or 85%. If your strategy only generates 20 signals in six months, test over a longer period or add more instruments.

Ignoring Spreads and Commissions

A strategy that shows a 3-pip average profit per trade will be net unprofitable if the spread is 1.5 pips and the commission is equivalent to 0.5 pips per side. That 3-pip profit becomes a 1-pip profit after costs, and any slight deterioration in performance turns it negative.

Always include realistic spread and commission costs in your backtesting. If you are not sure what your actual trading costs are, check your broker's fee schedule and build those numbers into every trade log.

How to Interpret Results

You have completed your backtest. You have 150 trades logged. Now what? What qualifies as a "good" result?

There is no single answer because it depends on the relationship between win rate and risk-to-reward ratio. Here are two profiles that are both profitable:

Profile A: High win rate, moderate R:R. 60% win rate with an average R:R of 1:1.5. This strategy wins more often than it loses, and the winners are slightly larger than the losers. It produces a steady equity curve with moderate drawdowns. Psychologically comfortable because you win most of the time.

Profile B: Lower win rate, high R:R. 45% win rate with an average R:R of 1:2.5. This strategy loses more often than it wins, but the winners are much larger than the losers. It produces a choppier equity curve with longer losing streaks. Psychologically demanding because you are wrong more than half the time, but the math works in your favor.

Both profiles are viable. The question is which one fits your psychological profile. A strategy is worth trading live if it shows positive expectancy per trade, a profit factor above 1.5, a maximum drawdown you can survive both financially and emotionally, and consistent results across both in-sample and out-of-sample data.

See Axion Algo's backtesting results for an example of what transparent testing methodology looks like. The win rate, sample size, market conditions, and drawdown figures are all documented, providing a benchmark for how to present and evaluate strategy performance.

Key Takeaways

Backtesting is not optional. It is the foundation of informed trading. A strategy that has not been tested is a strategy that has not been validated.

Manual backtesting is slow but educational. It builds market intuition and forces you to confront losing trades. Automated backtesting is fast and objective but requires programming ability and discipline to avoid over-optimization.

Track win rate, profit factor, maximum drawdown, expectancy per trade, and average R:R. These five metrics tell you everything you need to know about whether a strategy deserves your capital.

Avoid curve-fitting by testing out-of-sample. Avoid survivorship bias by being aware of what your data includes and excludes. Collect at least 100 trades before drawing conclusions. And always account for spreads and commissions, because a strategy that ignores costs is a strategy that lies about its profitability.


Risk Disclaimer: Trading financial instruments carries a high level of risk and may not be suitable for all investors. Past performance is not indicative of future results. You should carefully consider your investment objectives, level of experience, and risk appetite before making any trading decisions. Never trade with money you cannot afford to lose. The content in this article is for educational purposes only and does not constitute financial advice. Always conduct your own research and consult with a licensed financial advisor before making investment decisions.

*This post is educational and is not financial advice. Trading involves substantial risk. Past performance does not guarantee future results. Only trade with capital you can afford to lose.*

Related tools

Calculate your next trade: Position Size Calculator | Risk/Reward Calculator

Explore the indicator that powers it and load it on your favorite chart.

Ready to trade with an edge?

Axion Algo gives you clear buy/sell signals on TradingView. Non-repainting. Any market. Any timeframe.

Get Access

Starting at $19/week. Cancel anytime.

Axion Algo Logo

© Copyright 2026 Axion Algo. All rights reserved. Unauthorized reproduction or distribution of our content, indicators, or presets is strictly prohibited.

Product
  • Indicators
  • Presets
  • AI Strategy Creator
  • Pricing
Resources
  • Blog
  • Calculators
  • FAQ
Company
  • About
  • Community
  • Affiliates
  • Contact
Legal
  • Terms of Service
  • Privacy Policy
  • Disclaimer
  • Cookie Policy
  • Email Policy
  • Privacy Rights
  • Refund Policy
  • Affiliate Terms
  • Acceptable Use
  • DMCA Policy
  • AML Policy

Trading entails substantial risk, and many participants can—and often do—lose capital. All content on this website is provided solely for educational and informational purposes and must never be construed as individualized financial, investment, tax, legal, or accounting advice. Any decision to buy, sell, hold, or otherwise trade securities, commodities, derivatives, cryptocurrencies, or any other asset carries inherent risk and should be made only after consulting a properly licensed financial professional familiar with your objectives, financial situation, and risk tolerance. Past performance does not guarantee future results, and market conditions can change rapidly.

Visuals are illustrative. Charts, signal markers, screenshots, dashboards, mock-ups, P&L images and any other graphics shown on this site, in emails, on social media, in ads, PDFs or on Discord may be hypothetical, simulated, edited or selected for demonstration. No image of profit, return, win-rate or trade outcome guarantees similar results.

Regulatory status. Axion Algo is not registered with the U.S. SEC, CFTC, NFA, or with any EU/EEA authority (e.g., CNMV, FCA, BaFin). We do not act as Investment Advisers, Commodity Trading Advisors, or regulated brokers.

CFTC Rule 4.41 disclosure. Hypothetical or simulated performance results have inherent limitations; they do not represent live trading and may under- or over-compensate for factors such as liquidity, slippage, variable spreads, or trader psychology. No representation is made that any account will achieve profits or losses similar to those shown.

Testimonials are anecdotal and may not be representative of other users; they are not a guarantee of future results. Individual outcomes depend on numerous variables, including market knowledge, discipline, and prevailing conditions.

1-on-1 sessions (educational only). Monthly meetings in select plans are purely instructional: they demonstrate theoretical indicator use, general risk-management ideas, and platform functions. Axion Algo does not give personalized trade instructions or specific security recommendations, and no advisory or fiduciary relationship is created. You remain solely responsible for your trading decisions and should consult a licensed professional before acting on any information discussed.

All presets, templates, and indicator set-ups provided by Axion Algo are generic, impersonal configurations offered to every user for educational demonstration only. They do not account for your personal financial circumstances and must not be interpreted as trading advice, signals, or recommendations. Performance of any preset in historical tests is hypothetical and subject to the limitations described above.

As a provider of technical-analysis indicators and related charting tools, we neither solicit trades nor manage funds. We have no access to customers' brokerage statements or trading accounts and therefore cannot verify whether users of our content outperform or underperform the trading community at large.

Charts and price data are powered by TradingView® (www.TradingView.com). TradingView® is a registered trademark of TradingView, Inc. TradingView®, its affiliates, and employees have no association with—and do not endorse—Axion Algo or the services described herein.

Leveraged products, short-selling, options, and margin trading can amplify both gains and losses and may be unsuitable for some investors. By using this site, you acknowledge that you are solely responsible for any trading or investment choices you make and agree to hold Axion Algo, its owners, contributors, and affiliates harmless for any direct or consequential losses.

No fiduciary, advisory, broker-dealer, or agency relationship is created by your use of this site. Any dispute shall be governed by and construed in accordance with the laws of the State of Delaware, USA, and subject to the exclusive jurisdiction of its courts.

This notice is only a condensed summary of our legal disclaimers. Please review our Full Disclaimer, Terms of Service, Privacy Policy, and Cookie Policy for complete details.

© Copyright 2026 Axion Algo. All rights reserved. Unauthorized reproduction or distribution of our content, indicators, or presets is strictly prohibited.