Most retail traders do the same thing: they find a strategy on YouTube, feel good about it, and put money in. Then they wonder why it does not work the same way in real markets.
Backtesting is the step between "this looks promising" and "this is worth trading." Here is what it actually involves.
What Is Backtesting?
Backtesting is the process of running a trading strategy against historical price data to see how it would have performed. Instead of risking real money on an untested idea, you apply the rules to past market conditions and measure the outcome.
It answers questions like: Would this strategy have been profitable over the last 6 months? What was the worst losing streak? How did it perform during the March 2020 crash versus the 2021 bull run?
Done properly, backtesting gives you realistic expectations before you deploy a dollar.
What You Need Before You Start
A backtest is only as good as its inputs. Before running one, you need three things clearly defined:
- Entry rules: exactly when the strategy buys. RSI below 30? 50-day MA crossover? A specific candle pattern?
- Exit rules: when it sells, including take-profit and stop-loss levels
- Position sizing: how much of the portfolio each trade uses
Vague rules produce unreliable results. "Buy when it looks oversold" is not a strategy you can backtest.
How to Run a Backtest
There are a few common approaches depending on your technical level.
Manual backtesting: You scroll through historical charts and mark where your rules would have triggered entries and exits. Time-consuming but gives you an intuitive feel for how the strategy behaves. Good for simple strategies and new traders learning price action.
Platform-based backtesting: Tools like HaasOnline let you build automated strategies using their scripting environment (HaasScript) and backtest them directly against exchange data. You set the rules, choose the time range, and the platform calculates the results including profit, drawdown, win rate, and more.
HaasOnline is particularly useful for traders who want to move from backtesting to live deployment on the same platform without rewriting anything. The same strategy logic you tested runs live when you are ready.
Build and backtest your first bot on HaasOnline
Affiliate link -- we may earn a small commission at no extra cost to you.
Key Metrics to Look At
A positive total return is not enough to know if a strategy is worth running. These are the numbers that matter:
- Win rate: what percentage of trades were profitable. A 40% win rate can still be profitable if the average win is larger than the average loss
- Profit factor: total profits divided by total losses. Anything above 1.5 is generally considered decent
- Maximum drawdown: the largest peak-to-trough loss. A strategy with a 60% max drawdown is emotionally difficult to stick with, even if the long-run return is positive
- Sharpe ratio: return relative to volatility. Higher is better
- Number of trades: a strategy that only triggered 8 times in 2 years does not have statistically meaningful results
The Biggest Backtesting Mistake: Overfitting
Overfitting happens when you tweak a strategy's parameters until it looks perfect on historical data -- and then it falls apart on live markets. This is the single most common backtesting pitfall.
The fix is simple in theory: test on data you did not use to develop the strategy. Split your historical data in half. Develop and tune on the first half. Then test the final version on the second half without any further adjustments. If the performance on the second half looks similar to the first, the strategy has some generalizability. If it collapses, you overfitted.
Paper Trading: The Step After Backtesting
Even a well-backtested strategy should go through paper trading before live deployment. Paper trading runs the strategy in real market conditions with simulated money. It catches issues that backtests miss: slippage, latency, liquidity gaps at certain price levels, and bugs in how orders get executed.
Most good bot platforms offer paper trading modes. Treat this phase seriously -- run it for at least two to four weeks on the pairs you intend to trade before putting real funds in.
Backtesting and paper trading will not guarantee profits. But they will tell you what you are working with before the market does.