Back to Learn
Intermediate15 min read

Backtesting Trading Strategies

Backtesting runs a strategy against historical OHLCV data before you risk money on it. In Nydar, the screener can check what followed past matches of a saved screen. Learn how to validate ideas before risking real money.

What is Backtesting?

Backtesting is the process of testing a trading strategy on historical market data to see how it would have performed. It's like a "time machine" for your trading ideas - you can see if your strategy would have made or lost money in past market conditions.

Why Backtest?

Validate Ideas

Test if your strategy actually works before risking money

Backtesting results with equity curve
Find Weaknesses

Discover when your strategy fails or struggles

Optimize Parameters

Fine-tune indicator settings and entry/exit rules

Build Confidence

Trade with conviction knowing your strategy has worked

The Golden Rule

Never trade a strategy with real money until you've backtested it. Even strategies that "look good" on paper often fail when tested against actual historical data.

Key Backtesting Metrics

When evaluating a backtest, focus on these essential performance metrics:

Win Rate

Target: 40-60%

Percentage of trades that were profitable. A 50% win rate with good risk/reward can still be highly profitable.

Win Rate = (Winning Trades / Total Trades) x 100

Profit Factor

Target: >1.5

Ratio of gross profits to gross losses. A profit factor of 2.0 means you make $2 for every $1 you lose.

Profit Factor = Total Profits / Total Losses

Maximum Drawdown

Target: <20%

The largest peak-to-trough decline in your account. This shows the worst-case scenario you should be prepared for.

Max DD = (Peak Value - Trough Value) / Peak Value x 100

Sharpe Ratio

Target: >1.0

Risk-adjusted return measurement. Higher is better - it shows how much return you're getting for each unit of risk taken.

Sharpe = (Return - Risk-Free Rate) / Standard Deviation

Average Trade

Target: Positive after costs

The average profit/loss per trade. Must be positive AND large enough to cover commissions and slippage.

Avg Trade = Total Net Profit / Number of Trades

The Backtesting Process

1

Define Your Strategy Rules

Write down clear, specific rules for entries and exits. Your strategy must be 100% mechanical with no discretion.

Example Strategy Rules:

  • • Entry: Buy when RSI crosses above 30 AND price is above 50 EMA
  • • Exit: Sell when RSI crosses above 70 OR 2% stop loss hit
  • • Position Size: Risk 1% of account per trade
2

Choose Your Test Period

Select a historical period that includes different market conditions. Use at least 2-3 years of data, or 100+ trades minimum.

Bull Markets
Bear Markets
Sideways Markets
3

Run the Backtest

Apply your rules to historical data and record every trade. Use backtesting software or do it manually on a spreadsheet.

Track for each trade:

• Entry date & price• Exit date & price• Position size• Profit/Loss ($)• Profit/Loss (%)• Trade duration
4

Analyze Results

Calculate all key metrics and review the equity curve. Look for patterns in winning and losing trades.

Consistent profits?
Acceptable drawdown?
Works in all conditions?
5

Forward Test (Paper Trade)

Before going live, test on real-time data with paper trading. This validates the backtest wasn't just curve-fitted to past data.

Minimum: 30-50 paper trades before going live

Common Backtesting Pitfalls

Avoid these mistakes that can make a losing strategy look profitable:

Overfitting (Curve Fitting)

Optimizing parameters to perfectly fit historical data. The strategy works great on past data but fails on new data.

Fix: Use out-of-sample testing. Optimize on 70% of data, test on remaining 30% you've never seen.

Look-Ahead Bias

Using information that wouldn't have been available at the time of the trade (e.g., using day's closing price when trading at open).

Fix: Only use data that was available at the decision point. Be strict about timestamps.

Survivorship Bias

Testing only on stocks that still exist today, ignoring companies that went bankrupt or were delisted.

Fix: Use point-in-time data that includes delisted securities and historical index constituents.

Ignoring Trading Costs

Not accounting for commissions, spreads, and slippage. These costs can turn a profitable strategy into a losing one.

Fix: Add realistic costs: $1-5 per trade commission, 0.01-0.05% slippage per side depending on asset.

Small Sample Size

Drawing conclusions from too few trades. 10 winning trades in a row could be luck, not skill.

Fix: Minimum 100 trades for statistical significance. More is always better.

Realistic Expectations

What Good Results Actually Look Like

MetricPoorAcceptableGoodExcellent
Win Rate<35%35-45%45-55%>55%
Profit Factor<1.01.0-1.51.5-2.0>2.0
Max Drawdown>30%20-30%10-20%<10%
Sharpe Ratio<0.50.5-1.01.0-2.0>2.0
Annual Return<5%5-15%15-30%>30%

Warning Signs of Unrealistic Results

  • • Win rate above 70% (very rare in real trading)
  • • Profit factor above 3.0 (likely overfitted)
  • • Annual returns above 100% (too good to be true)
  • • No losing months at all (markets don't work that way)
  • • Smooth, perfect equity curve (reality is messier)

Walk-Forward Analysis

The most robust way to validate a strategy. It simulates how you'd actually trade: optimize on past data, trade forward, then re-optimize.

How Walk-Forward Works

Optimize (2020-2022)
Test (2023)
Window 1
Optimize (2021-2023)
Test (2024)
Window 2
Optimize (2022-2024)
Test (2025)
Window 3

Each "test" window uses parameters optimized ONLY on data before it. Combine all test periods for final performance assessment.

If your strategy performs well across all walk-forward test windows, you have much higher confidence it will work in live trading.

Backtesting with Nydar

Nydar's strategy backtesting widget isn't connected to historical candles yet, so it can't produce a result today. What works now is the screener's check on a saved screen:

  • Looks back over the last 100 candles, on up to 10 symbols
  • Screens built from common indicators (RSI, MACD, Moving Averages, etc.)
  • Reports how price moved, close to close, after each match
  • Descriptive only: no simulated fills, costs or trade management

Key Takeaways

  • Always backtest first - Never trade a strategy without historical validation
  • Watch for overfitting - If results are too good, the strategy is probably curve-fitted
  • Include all costs - Commissions and slippage can make or break a strategy
  • Use out-of-sample testing - Test on data the strategy has never "seen"
  • Paper trade before going live - Validate backtest results with real-time forward testing

Related Guides

Ready to Test Your Strategy?

Check what followed past matches of a saved screen in Nydar's screener, then forward test on crypto with paper trading.

Get Started Free

Further Reading

Written by Ryan Clinton

Founder of Nydar. Software engineer with experience at Cowen Inc (Wall Street) and on large-scale infrastructure projects. Built Nydar to make professional trading tools accessible to everyone.

Last reviewed: November 2026