Backtesting Guide

What Nydar can check on past data today, and how to test a strategy properly

What Works in Nydar Today

The strategy backtest isn't connected yet. The Backtesting widget has no historical candles to run on, so pressing Run returns a message instead of a result. You get no trades, equity curve or metrics from it.

What does run is the history check on a saved screen in the Advanced Screener. Save a screen, press Backtest, and Nydar looks over the last 100 candles on up to 10 symbols. It reports how many times the screen matched, then the average close-to-close move and the share of positive moves 1, 5 and 10 candles later.

Read those numbers as a description of past price moves. Matches can overlap, and the check has no fills, fees, slippage or exits, so it can't tell you what a strategy would have earned.

To try an idea with costs included, use paper trading: $10,000 of virtual money on crypto USDT spot pairs, with market and limit orders. Orders walk the live order book, so one order can fill at several prices, rest until the market reaches it, or be refused.

The rest of this page is general education about backtesting and doesn't describe a Nydar feature. The walk-forward approach below comes from Robert Pardo's The Evaluation and Optimization of Trading Strategies (Wiley, 2nd ed., 2008). For why so many backtested strategies fail in production, see Marcos Lopez de Prado's Advances in Financial Machine Learning (Wiley, 2018), particularly the chapters on combinatorial purged cross-validation.

Common Strategy Types

MA Crossover

Classic moving average crossover strategy. Buy when fast MA crosses above slow MA, sell when fast MA crosses below slow MA.

Typical settings: fast MA 10, slow MA 20, SMA or EMA

RSI Reversal

Momentum reversal strategy. Buy when RSI drops below oversold level, sell when RSI rises above overbought level.

Typical settings: RSI period 14, oversold 30, overbought 70

Bollinger Bounce

Mean reversion strategy. Buy when price touches lower band, sell when price touches upper band.

Typical settings: period 20, 2 standard deviations

MACD Signal

Trend-following strategy. Buy when MACD crosses above signal line, sell when MACD crosses below signal line.

Typical settings: fast 12, slow 26, signal 9

Breakout

Momentum strategy. Buy when price breaks above recent high, sell when price breaks below recent low.

Typical settings: 20-bar lookback, 1-2 confirmation bars

How a Backtest Works

Step 1: Pick a Market

Choose the instrument and timeframe you actually plan to trade, and check there's enough clean history for it.

Step 2: Write the Rules

Define entries, exits and stops precisely enough that two people would take the same trades.

Step 3: Choose the Test Period

Longer periods cover more market conditions. Keep the most recent slice back as data the rules have never seen.

Step 4: Set Position Sizing

Set starting capital and the size of each trade, as a fixed amount or a percentage of capital.

Step 5: Run It With Costs

Simulate every trade with fees and slippage, then record the results before you change anything.

Understanding Backtest Results

Total Return

The percentage gain or loss from starting capital. Compare to buy-and-hold return for the same period.

Total Trades

The number of completed round-trip trades. Too few trades may indicate statistically unreliable results.

Win Rate

The percentage of profitable trades. Must be evaluated alongside average win vs average loss size.

Max Drawdown

The largest peak-to-trough decline during the test. Critical for understanding worst-case scenario and position sizing.

Sharpe Ratio

Return adjusted for risk. Above 1.0 is good, above 2.0 is excellent. Below 1.0 suggests risk may not be worth the reward.

Profit Factor

Gross profit divided by gross loss. Above 1.5 is good. A profit factor of 2.0 means you made $2 for every $1 lost.

Equity Curve

An equity curve shows how the account balance changed over time during a backtest. A healthy curve should show:

  • Steady upward slope: Consistent profitability over time, not luck on a few trades.
  • Manageable drawdowns: Dips should recover, not persist for extended periods.
  • No cliff drops: Sudden large drops indicate over-leveraging or black swan vulnerability.
  • Recent performance: Does strategy still work in recent market conditions?

Critical Warnings

  • Overfitting: A strategy optimized perfectly for past data often fails on new data. Walk-forward testing helps catch this.
  • Survivorship bias: If you only test assets that exist today, the ones that failed never appear in your results.
  • Slippage: If a backtest leaves slippage out, real execution will be worse than it shows, especially in volatile markets.
  • Fees matter: Leave trading fees out and the numbers are fiction. High-frequency strategies may be unprofitable after fees.
  • Market regimes change: What worked in 2021 bull market may fail in 2022 bear market. An equity curve helps you spot this.

Pro Tips

  • Out-of-sample testing: Develop strategy on half the data, test on the other half. If it fails, it's overfit.
  • Multiple timeframes: Check the same rules on other timeframes. An edge that exists on only one is suspect.
  • Walk-forward analysis: Re-optimize parameters periodically as you move through time.
  • Compare to benchmark: A strategy should beat simple buy-and-hold to be worth the effort.
  • Paper trade first: Before going live, use Nydar's paper trading to validate the strategy in real-time.
  • Keep a strategy journal: Use Nydar's Trade Journal to document what you tested, results, and lessons learned.

Position Sizing in Backtests

Fixed Amount

Trades the same dollar amount each time. Simple but doesn't compound gains.

Fixed Percentage

Trades a percentage of current equity. Compounds gains and limits losses as percentage of account.

Kelly Criterion

Applies the mathematical formula for optimal bet sizing based on edge and odds. Usually divide result by 2-4 for safety.

Walk-Forward Analysis

Walk-forward analysis is the gold standard for validating backtest results. It addresses the biggest weakness of traditional backtesting: overfitting to historical data.

How It Works

Instead of testing on all available data at once, divide the data into segments. Optimize your strategy parameters on the first segment (in-sample), then test the optimized strategy on the next segment (out-of-sample). Repeat, rolling forward through time.

Example

With 2 years of data:

  • Window 1: Optimize on months 1-6, test on months 7-9
  • Window 2: Optimize on months 4-9, test on months 10-12
  • Window 3: Optimize on months 7-12, test on months 13-15
  • ...continue rolling forward

Why It Matters

If a strategy performs well on out-of-sample data consistently across multiple windows, it's more likely to work in live trading. If it only works on in-sample data, it's overfit and will likely fail.

Strategy Parameter Guidance

Choosing the right parameters is critical. Too tight and you overfit; too loose and you miss signals.

MA Crossover Parameters

Fast MA: 5-20 periods. Shorter periods give more signals but more false ones.
Slow MA: 20-100 periods. The gap between fast and slow determines sensitivity.

Common combos: 9/21 (aggressive), 20/50 (balanced), 50/200 ("golden cross" — conservative)

RSI Parameters

Period: Standard 14 works well for most timeframes. Shorter (7-9) for faster signals, longer (21-28) for less noise.
Levels: Classic 30/70. For trending markets try 40/60. For volatile crypto, 20/80 may work better.

Warning: RSI stays overbought/oversold for extended periods in strong trends. Don't blindly counter-trade RSI extremes in trending markets.

Bollinger Band Parameters

Period: 20 is standard. Shorter for faster reactions, longer for smoother bands.
Standard deviations: 2.0 is standard. Use 1.5 for more signals, 2.5 for higher-quality but fewer signals.

Tip: Bollinger Bounce works best in ranging markets. In strong trends, price will "ride the band" — touching it repeatedly without reversing.

Breakout Parameters

Lookback: 20 periods is a common starting point (Donchian channel). Shorter periods catch more breakouts but with more false ones.
Confirmation: Requiring 1-2 close bars above the breakout level filters out false breakouts but delays entry.

Key metric: Breakout strategies typically have low win rates (30-40%) but large average wins. Focus on profit factor and R:R, not win rate.

Interpreting the Equity Curve

The equity curve is the most important output of a backtest. Here's how to read it like a pro.

Healthy Curve Signs

  • Consistent upward slope: Profits are spread across the entire period, not concentrated in one lucky stretch.
  • Quick drawdown recovery: Dips happen, but the strategy recovers within a reasonable number of trades.
  • Smooth growth: A jagged curve with huge spikes and drops suggests inconsistent risk management.
  • Works in recent data: The last 20-30% of the curve should look as good as the first 50%. If it degrades, market conditions may have changed.

Red Flags

  • Flat then spike: Most profits come from 1-2 trades. The strategy doesn't have a consistent edge — it got lucky.
  • Steady up then cliff: Strategy worked until a regime change (e.g., bull → bear). Not adaptive enough for live trading.
  • Staircase pattern: Long flat periods followed by sudden jumps. May indicate the strategy only works in specific market conditions.
  • Profits only in the past: The curve looks great for 2021-2023 but flat or declining in 2024-2025. The edge may have been arbitraged away.

Max Drawdown Analysis

The max drawdown number tells you the worst-case scenario you should prepare for — and in live trading, it will likely be worse. A common rule of thumb:

  • <10% max drawdown: Excellent. Conservative strategy suitable for larger accounts.
  • 10-20% drawdown: Acceptable for most traders. Standard risk level.
  • 20-30% drawdown: Aggressive. Only suitable if you can psychologically handle losing 30% of your account temporarily.
  • >30% drawdown: Very risky. Consider reducing position size or adding risk filters.

Common Backtesting Pitfalls

Avoid these mistakes that make backtests look better than reality.

1. Data Snooping

Running hundreds of parameter combinations until one works is not strategy development — it's curve fitting. The more combinations you try, the more likely you'll find one that looks profitable by chance. Use walk-forward analysis to combat this.

2. Ignoring Transaction Costs

A strategy that trades 500 times per month looks great in a fee-free backtest. Add realistic fees (0.1% per trade for crypto, commissions for stocks) and many high-frequency strategies become unprofitable. Always include estimated costs.

3. Unrealistic Fills

Backtests assume you can buy at the exact signal price. In reality, slippage means you'll get a slightly worse price, especially with larger orders or in thin markets. Add 0.05-0.2% slippage to your backtest assumptions.

4. Too Few Trades

A strategy that makes 10 trades and wins 9 of them has a 90% win rate — but it's statistically meaningless. You need at least 30-50 trades for basic statistical significance, and ideally 100+ for reliable conclusions.

5. Testing Only Bull Markets

Everything looks profitable when the market goes up. Make sure your test period includes both bull and bear markets, and ideally sideways conditions too. A strategy should survive all three regimes before you trust it.

6. Confirmation Bias

You have a strategy idea, run a backtest, and it shows 15% annual return. You tweak one parameter, it jumps to 22%. Another tweak: 28%. You stop here because it "proves" your idea works. But you've just optimized to fit the data. Record your hypothesis before testing, and accept the first result.

From Backtest to Live Trading

A profitable backtest is step one, not the finish line. Here's the path from a backtest to real capital.

Step 1: Validate with Walk-Forward

Run walk-forward analysis to ensure the strategy isn't overfit. If out-of-sample performance is significantly worse than in-sample, go back and simplify.

Step 2: Paper Trade for 1-3 Months

Run the strategy in real-time with virtual money using Nydar's Positions widget. This tests execution, psychological tolerance, and whether the signals work in live market conditions.

Step 3: Start Small

If paper trading confirms the backtest, start with 10-25% of your intended position size. This limits risk while you check that real fills match what the backtest assumed.

Step 4: Scale Up Gradually

If the strategy performs within expected parameters for 20+ trades at small size, gradually increase to full position sizing. Keep monitoring drawdowns against the range the backtest showed.

Step 5: Monitor and Adapt

Markets evolve. If the strategy's live performance diverges significantly from backtest expectations (e.g., drawdown exceeds backtest max by 50%), pause and re-evaluate. Parameters may need updating or the strategy may no longer suit current conditions.

Related Widgets

Further Reading

Last reviewed: November 2026