What Backtesting Is and What It Is Not
Backtesting applies a set of rules to historical price data to see how a strategy would have performed if those rules had been followed consistently. It answers the question: given this entry logic, these exits, and this risk management, what would the historical results look like?
What it cannot tell you is how the strategy will perform in the future. Markets evolve, liquidity changes, and edges erode. A strong backtest is evidence that a strategy has a logical basis and has worked historically. It is not a guarantee.
Using TradingView's Strategy Tester
TradingView's built-in Strategy Tester is accessible through Pine Script strategies. When you add a strategy to your chart rather than a study, the Strategy Tester panel appears at the bottom and shows performance statistics for the visible chart period.
The most important settings to configure before evaluating results are commission per trade, initial capital, and order size. Running a backtest with zero commission produces results that cannot be replicated in live trading. Even low-cost crypto exchanges charge 0.04 to 0.1 percent per trade, which compounds meaningfully across hundreds of trades.
Key Metrics and What They Tell You
Win Rate: The percentage of trades that close profitably. A useful metric only in combination with average win and average loss.
Profit Factor: Gross profit divided by gross loss. Values above 1.5 suggest a meaningful edge. Values above 2.0 are strong.
Max Drawdown: The largest peak-to-trough decline during the test period. If you could not emotionally or financially sustain that drawdown in live trading, the strategy is not suitable regardless of its overall returns.
Number of Trades: Statistical validity requires a meaningful sample. Fewer than 50 trades makes any conclusion unreliable. Over 200 trades produces more stable metrics.
How to Avoid Overfitting
Overfitting is the most dangerous failure mode in backtesting. It occurs when you optimize a strategy's parameters to perform well on historical data, producing results that look excellent in test but fail in live trading.
The practical defense is to divide your historical data. Optimize parameters on the first two-thirds of your data and test on the remaining third without any further adjustment. If performance degrades substantially on the out-of-sample period, the strategy is overfit.
Testing Across Multiple Assets and Conditions
A strategy that works only on one asset, or only during bull markets, is fragile. The most robust strategies produce reasonable results across multiple pairs and through different market conditions.
Testing the same parameters on BTC, ETH, SOL, and major forex pairs gives you a sense of whether the underlying logic is broadly applicable. Similarly, isolating different market periods — a strong trend, a prolonged bear market, a sideways consolidation — shows you where the strategy's weaknesses are.
Connecting Backtest to Live Execution
Most strategies achieve 50 to 70 percent of their backtest returns in live trading due to slippage, execution delay, missed signals, and the psychological difficulty of holding through drawdowns.
The right response is to require a strong enough backtest margin that the live performance, even at 60 percent of the historical figure, remains worthwhile.
