TradingTeaching Press · Dubai, UAE Trading is high-risk. Check local laws, your residency rules and your finances. Risk warning
📚 Trading Basics

Backtesting Basics

Learn the basics of backtesting trading strategies. Understand how to test your approach on historical data.

3 min read TradingTeaching Team

Backtesting validates your strategy before risking real money. Testing on historical data reveals whether your approach has potential.

What is Backtesting?

Definition

Backtesting:

  • Testing strategy on past data
  • Seeing how it would have performed
  • Historical simulation
  • Strategy validation

Purpose

To Determine:

  • Does strategy have an edge?
  • What's the win rate?
  • What's the expectancy?
  • How does it perform in different conditions?

Why Backtest?

Benefits

Advantages:

  • Validate before risking money
  • Identify flaws
  • Build confidence
  • Understand performance

Alternative

Without Backtesting:

  • Risk real money to learn
  • Expensive education
  • Uncertain results
  • No baseline

Manual vs Automated

Manual Backtesting

Process:

  • Scroll through charts
  • Apply rules manually
  • Record each trade
  • Time-consuming

Advantages:

  • Deep learning
  • Understand nuances
  • See market context
  • Better intuition

Automated Backtesting

Process:

  • Program the rules
  • Software tests
  • Instant results
  • Large sample sizes

Advantages:

  • Fast results
  • Large data sets
  • No human error
  • Consistent application

Manual Backtesting Process

Step 1: Define Rules

Clear Criteria:

  • Entry rules
  • Exit rules
  • Stop loss rules
  • Position sizing

Step 2: Select Data

Choose:

  • Market/pair to test
  • Timeframe
  • Time period (years of data)
  • Representative conditions

Step 3: Scroll Back

Setup:

  • Go back in time
  • Hide future price
  • Step forward candle by candle
  • Or use bar replay

Step 4: Find Setups

Process:

  • Apply entry rules
  • When setup occurs, record entry
  • Wait for exit
  • Record result

Step 5: Record Everything

Track:

  • Date/time
  • Entry price
  • Stop loss
  • Target
  • Exit price
  • Profit/loss
  • Notes

Step 6: Analyze Results

Calculate:

  • Total trades
  • Win rate
  • Average win/loss
  • Profit factor
  • Expectancy

Key Metrics

Win Rate

Calculation:

Winning trades / Total trades × 100

Example:

  • 60 winners / 100 trades = 60%

Average Win/Loss

Calculate:

  • Average profit on winners
  • Average loss on losers
  • Ratio matters

Profit Factor

Calculation:

Gross profits / Gross losses

Example:

  • $10,000 profit / $6,000 loss = 1.67

Expectancy

Calculation:

(Win rate × Avg win) - (Loss rate × Avg loss)

Example:

  • (0.60 × $200) - (0.40 × $100)
  • $120 - $40 = $80 per trade

Maximum Drawdown

Definition:

  • Largest peak-to-trough decline
  • Worst losing period
  • Important for risk
  • Tests resilience

Sample Size

Why It Matters

Statistics:

  • Small samples unreliable
  • Large samples more accurate
  • Edge becomes clear
  • Reduces randomness

Minimum Trades

Guidelines:

  • 100 trades minimum
  • 200+ preferred
  • Different market conditions
  • Multiple years if possible

Common Backtesting Mistakes

Curve Fitting

Problem:

  • Over-optimizing for past
  • Too many parameters
  • Won't work in future
  • Looks great, trades poorly

Solution:

  • Simple rules
  • Few parameters
  • Out-of-sample testing
  • Reasonable settings

Cherry Picking

Problem:

  • Only testing favorable periods
  • Avoiding bad markets
  • Unrealistic results
  • False confidence

Solution:

  • Include all market conditions
  • Test bear and bull markets
  • Multiple years
  • Honest assessment

Ignoring Costs

Problem:

  • No spreads/commissions
  • Slippage ignored
  • Swaps not included
  • Unrealistic profits

Solution:

  • Factor in all costs
  • Realistic execution
  • Include slippage
  • True net results

Look-Ahead Bias

Problem:

  • Using information not available
  • Knowing the future
  • Unconscious bias
  • False results

Solution:

  • Bar-by-bar replay
  • Hide future data
  • Strict rules application
  • Objective assessment

After Backtesting

Forward Testing

Next Step:

  • Test on demo for at least 3 months and at least 50 trades
  • Real-time conditions
  • No hindsight
  • Live validation

Small Live Testing

Then:

  • A fixed 0.5% risk per trade for your first live year
  • Validate in live
  • Compare to backtest
  • Then 1% per trade, never more

Key Takeaways

  • Backtesting validates strategy before real trading
  • Test on historical data to see past performance
  • Manual backtesting builds deep understanding
  • Track all trades with detailed records
  • Calculate key metrics: win rate, expectancy, drawdown
  • Use large sample size (100+ trades minimum)
  • Avoid curve fitting and cherry picking
  • Include all costs in calculations
  • Forward test on demo before live
  • Backtested results are indication, not guarantee

What's Next?

Learn about forward testing and validating your strategy live.


This article is for educational purposes only and does not constitute financial advice.

Risk warning. This is education only, not financial, investment, tax or legal advice, and not a recommendation to buy or sell anything. Trading forex, CFDs, stocks, commodities, futures, options and crypto is high-risk; with leverage you can lose more than you deposit, and most retail traders lose money. Before you trade or invest in any form, check the local laws where you are and the rules of your country of residence, and consider your own financial situation; if in doubt, ask a licensed adviser. Past and tested results, and all examples, are for illustration only and do not guarantee future results.

New to this? Start at the beginning

These articles answer one question at a time. The video course answers them in the order they actually come up — 61 lessons, 12 modules, quizzes and printable worksheets.

See the video course Or start with the book