Trading can be a complex and challenging endeavor, with all the variables and factors one has to consider when making trading decisions. Developing a system that can reliably generate profitable trades over time is the most crucial aspect of it. When working on a system, it is essential to engage in backtesting (testing a trading system using real market historical data) to evaluate its effectiveness and potential profitability.
System backtesting is very important for various reasons. A day or two spent on backtesting can give preliminary knowledge of whether the system is profitable or not. It allows to check the effectiveness of a system without risking any real money. Backtesting on historical data can give valuable insights into the system’s performance in different market conditions. It allows also to identify areas where the trading system or trading strategy may be vulnerable to losses. This way it can be refined before being used on a live market. Backtesting is also important for building the trader’s confidence. Confidence in a system is essential when you start using it on a live account – after all, doubts and hesitation can kill trading results as much as a bad system.
Period of backtesting
Typically two years would be a good period for backtesting unless you trade the Weekly chart, which would require more data input for testing. The test period should exclude periods of untypical market behavior caused by external factors like 2/20/2022-03/20/2022 – Russian Invasion in Ukraine, 2-5/2020 Covid outbreak, lockdown announcement, and extraordinary fiscal and monetary measures.
Backtesting and losses
Backtesting is not only about checking if the system is profitable. Analyzing the losses that occurred during the backtesting period might lead to the identification of common patterns of losing trades. In other words, taking every loss as a cost of the trading business is an oversimplification. As there are signals that tell us when to open a trade, there might also be signals that indicate when not to open it, even if the system gives a green light. Discovering them can reduce the number of losers and improve overall system performance in live trading. Thanks to in-depth loss analysis, an unprofitable system might become very profitable, and a profitable system might become even better.
Let me give an example. I was once analyzing losing trades from my backtesting. There was no sensible explanation for why these particular trades were losers on the technical side. I could have stopped there and put it on the market randomness, but I was digging further. I had the exact timing of the losing trades noted down. The rules of the system assumed that there was no trading on big announcement days, so I checked the dates of losing trades to double-check if there were no data releases then. Nope. Bank holiday calendar maybe? Bingo! A significant number of losing trades were on the day after holidays in the USA or the UK. When I looked at all this from a perspective, it all made sense! If orders accumulate over the holiday, an additional volume of trades hits the market the day after (from traders, businesses, and governments). This disturbs the natural flow of the market that the system measures and relies on. It took me two days to discover that, but it was worth it – the number of my losing trades was reduced by 20% 🙂 . That is huge! And the only thing it took me to discover this was to look at the data and see if there were some repeating patterns among the losing trades.
There is no single solution to reduce losing trades in a trading system or trading strategy. Sometimes it might be a matter of adding or removing one indicator. Sometimes it might be something more fundamental. But since your loss is somebody’s profit, there is a high chance that there is also an underlying pattern or signal behind the rapid price moves that hit your stop-loss. Having a second look at backtesting results and trying to discover those patterns is definitely worth the time and effort.
This may not be a popular opinion, but I also see some drawbacks of backtesting. The first and the most serious one, in my opinion, is, what I call, the time factor. When you backtest, everything happens fast. Even if you open and close trades manually, you will speed up the chart to run through during the night period. As a matter of fact, it is possible to do a year of backtesting on the M5 chart within one day and on the H1 chart within an hour. In reality, waiting for setups and executing trades will take much more time. It might feel like taking ages for a trade to hit TP. In such conditions, pressure will build up gradually because you are not used to waiting so long for entry and the trade result. And this can lead to mistakes that can turn a winning setup into a losing trade. If this goes on over several trades, it can damage the trader’s self-confidence and his or her confidence in the system. This is the biggest trap of backtesting. At least, it was for me.
Another flaw is the detachment of the backtesting environment from the market reality. The spreads, swaps, and commissions are absent in many testing platforms. The price dynamic is also different. Even the ticks within a candle are different. This may lead to a different perception of the market.
Last but not least, no past event can guarantee future results. Markets evolve, have different cycles, and are influenced by various unpredictable events. Just keep that in mind.
When you want to backtest any strategy or system, it is crucial to use software that will replay the market for you. Why? Well, everyone knows when was the best place to enter and exit when they look at a historical chart on which all the market drama and its end results are already visible. The real skill is to take decisions when the future is not yet known. When the chart for your trade does not yet exist. This is the real environment you will be trading in. Scrolling the chart back and pretending you don’t see the outcome is like lying to yourself. Even if you promise yourself that you will be honest about profits and losses, your subconscious will find a way to trick you. So using software that hides the future and replays the market bar by bar is a must. Personally, I’m using two programs for backtesting: Tradingview and Forex Tester.
Tradingview is a cheaper and simpler option. It is an advanced charting software for traders, and market replay is one of its many functions. It has data for probably all instruments that exist in any market. You get one month of free trial when you register for the first time so you can run your first tests during that period. It is best to take the trial on the highest plan since the lower plans have a limit on the number of bars that can be replayed. And this is really problematic if you want to replay a reasonable period of time on a smaller timeframe. Oh, just remember to cancel before the trial period ends if you don’t intend to go for paid subscription 😀 .
Replay in Tradingview is very simple. Moreover, in principle, you can only replay one instrument and one timeframe at a time, so running a replay on a higher timeframe for general market overview and on a smaller timeframe from which you manage entries is, in principle, not possible. However, there is a simple trick for this, which I describe in an article: “How to run replay in TradingView on two timeframes simultaneously”.
Forex Tester is a more advanced testing software. It offers a wide range of features and tools for testing and optimizing trading systems. It allows running backtesting and simulations for Forex, Futures, and Stocks. With Forex Tester, it is possible to use pending orders, as well as stop-loss and take-profit. It supports multiple chart setups for several assets in different time frames and can analyze them simultaneously. The program subscription includes access to 21 years of market data for over 800 symbols. The program also allows testing of EA / automatic trading systems. The company also offers Easy Forex Builder software which can build and code any strategy for you into a trading bot.
With Forex Tester, it is possible to customize the test screen with a wide range of parameters and indicators, including entry and exit signals. It includes a built-in trading journal, allowing traders to track their trades and analyze their performance over time. On top of that, there is also an automatic evaluation of the system’s performance, including profitability, drawdowns, and risk management. Forex Tester also offers a variety of optimization tools for refining and optimizing trading systems, including genetic algorithms, brute force optimization, and AI-based Strategy Optimiser.
The cost of the program comprises two elements – the software license plus the data subscription (monthly or annually).
If you plan to build your own trading system or a trading strategy, backtesting should be definitely one of the most important tools in your toolbox. However, like with everything, to get the most out of it, you should be aware of what you can and what you cannot do with your tool. You should also know the risks and limitations. I hope this article highlighted some of those. From my perspective, I can say that backtesting can be both challenging and satisfying. And, for sure, it is rewarding.
If you’ve liked this article, you might also be interested in subscribing to my e-mail updates in the box below. I also wrote some other articles you might like:
- “How to run replay in TradingView on two timeframes simultaneously”
- Convictions, beliefs, and trading
If you have friends who could be interested, please share this content with them: