Backtesting Your Trading Strategy

What Is Backtesting?

Backtesting a way of analyzing how well a trading strategy would have performed based on historical data. Backtesting helps a trader determine if their trading strategy would be profitable without risking real capital. If you start with five potential strategies, and in back testing realize that only two would be profitable, it’s worth focusing on those two.

A successful backtest isn’t a guarantee that a strategy will be successful in the current market. Past results are never a perfect indication of future performance. When you find a strategy that is successful in backtesting, the next step is usually to forward test the strategy with small amounts of real capital, and live market conditions.

Keep in mind that real trades have commissions or exchange fees which may not be included in backtest simulations. Therefore, make sure to account for these trading costs or you may be not so pleasantly surprised when you move into forward testing when looking at your P/L.

How to Backtest a Strategy

Backtesting can be conducted either programmatically or manually. If going the programmatic route, knowledge of code, or low code solutions is required. There are special software and programming languages that can automate the backtesting process. Examples that come to mind are Tradingview, QuantConnect, and TradeIdeas. These tools have historic price data that you can interface with via code.

Programmatically testing a strategy makes analyzing large datasets and the ability to backtest more complex strategies much easier. By coding the strategy rules into logic, you can easily execute multiple tests simultaneously knowing that there were no deviations from what you outlined. By removing yourself, the human, you get a pretty objective view of how the strategy performs.

On the other hand, manual backtesting is a more accessible approach, where you analyze historical data and simulate trades without the use of automated tools. This will certainly require more time and effort, but it allows you to gain a deeper understanding of price action. Imagine clicking a button and analyzing 1000 charts versus manually looking at 1000 charts. Although using code is faster, you miss out on the “screen time” reps of technical analysis.

The drawback of manual backtesting aside from time is hindsight bias. You may unconsciously adjust their trading decisions based on knowing what actually took place. To avoid this risk, just remember that you’re only hurting yourself in the end. If you aren’t accurate in the backtesting process, you sure as heck won’t be accurate with live money. You also have nothing to gain by lying to yourself. You may protect your ego and idea of what a strategy could be, but you won’t be able to buy much with the “fake profits” you accumulate in the process.

Backtesting Results

Once you’ve completed backtesting, it’s time to analyze the results. Key metrics to judge your trading strategy on are: net profit and loss, risk:reward ratio, win rate, and risk-adjusted returns. If the trading system is profitable, that’s a great first step, but how does it compare to the “risk free” rate of return? Is it still worth implementing?

If your strategy results are not profitable, it’s time to start looking into the win rate and the risk:reward ratio. Generally speaking, if you see a higher win rate, you’ll have the ability to trade for lower risk:reward setups. If you have a low win rate, you’ll need to tweak and optimize the setup for higher risk reward setups. With a high win rate strategy and low risk:reward setups, it’s more important to make sure stop losses are respected, otherwise one loss can wipe out many winning trades.

Conclusion

Backtesting is a way to check if your trading strategy is profitable without risking real capital. Transitioning to forward testing with small amounts of capital then allows you to validate strategies in live market conditions, while considering factors like commissions and fees. By analyzing key metrics such as net profit, risk:reward ratio, and win rate, traders can refine strategies for sustained success in the market.