The rise of the digital marketplace has placed an added emphasis on technical proficiency. Now, shares, CFDs, futures and forex traders are well-advised to be equipped to navigate an increasingly dynamic landscape.
Due to advances in information systems technologies, skills such as being able to use a software trading platform and troubleshoot internet connectivity issues in real-time are necessities. Additionally, being able to test trade ideas for application to the live market is inherently useful. One such way of doing so is through trading strategy backtesting.
What Is Backtesting?
Backtesting is the act of applying a trading system or strategy to a historical data set. When completed, the study provides the trader with an idea of the strategy or system's past performance. The backtesting results are then used to scrutinise a strategy's market entry and exit points, as well as to optimise risk management parameters.
In modern forex trading, technical analysis is the go-to methodology for active traders. While long-term FX investors may rely on fundamentals to catch broad trends in select currency pairs, swing, day and intraday traders turn to technical indicators to place price action into a manageable context. One way in which either approach is deemed valid or invalid is through strategy backtesting.
To backtest a forex trading strategy, two things are required: a historical data set and a strategy. When the study concludes, the optimisation process may commence.
Historic data sets are detailed accounts of price action that previously occurred during specified periods. For the forex market, they are composed of past exchange rate fluctuations. Historical data may be presented in any form, from price changes in an Excel spreadsheet to a line, bar, or candlestick chart.
Securing historic market data is an initial step in conducting a backtesting project. To do so, one must select an instrument and a period of time in which to study. From there, the data may be sorted into a desirable periodicity, specifically monthly, weekly, daily and intraday timeframes.
Before backtesting may commence, a trading strategy must be developed. A trading strategy is a rules-based structure that governs market entry, market exit and assumed risk. For backtesting purposes, two of these elements are essential:
- Market Entry: Market entry is the price point where one opens a new long or short position in the live market. In forex trading, market entry is secured via buying or selling a currency pair.
- Market Exit: Market exit is the point at which an open position is closed. To exit a market, one places an offsetting order to close out an outstanding long (sell) or short (buy) position. This may be done by implementing take profit or stop loss orders.
Without rules for market entry and exit, it's impossible to backtest. Although the trading ideas may prove historically irrelevant, they are the basis for the study and can be used to build a more effective forex trading strategy.
Position sizing and risk vs reward scenarios are key elements of any effective trading strategy. And, although they are not essential to a backtesting study, they are integral parts of any strategic optimisation.
Optimisation is the process by which past data is used to quantify how market conditions impacted a strategy's performance. This is done by examining market entry and exit points to see if there's a more efficient way to apply risk capital. Common ways of optimising a strategy are to skew risk vs reward ratios and tweak position sizes.
One of the best things about the modern marketplace is that the average retail trader has an abundance of backtesting options. Subscription and free forex historical data sets are readily available, as are various backtesting tools. Given these resources, any trader can develop a statistical record detailing a strategy's past performance.
Forex Backtesting Software
Among the most common devices used to build a backtesting study is the automated strategy tester. These are software programs custom-built to sift through historical market data sets. Typically, specialty backtesting software is bought from third-party providers.
In some cases, the forex trading platform itself has a strategy tester built into its functionality. Also, expert advisors may be backtested in Metatrader 4 or Metatrader 5 via the strategy tester function.
Of course, one particularly useful tool for backtesting is the pencil. Many great trading systems have been tested by hand. If the services of a programmer or automated software are not available, then there's nothing wrong with a notepad and pencil.
Forex Backtesting Example
To fully illustrate the process of backtesting in the foreign exchange market, let's look at a real world example. Assume that Erin the EUR/USD trader wants to test an intraday 10/20 period simple moving average crossover strategy. Before starting, Erin must define the following:
- Duration of the study
- Periodicity or increment
- Market entry point
- Market exit point
Erin decides to look at how the moving average crossover strategy performs over the preceding year. A periodicity of 30-minutes is chosen. When the 10-period SMA crosses above the 20 period, a long position is opened; when the 10 period SMA falls back beneath the 20 SMA, the long is closed and a new short position is opened.
Upon this study being completed, Erin will have a comprehensive set of 12-month buy and sell-side metrics for the EUR/USD on the 30-minute timeframe. If the track record is acceptable, part or all of the SMA strategy may be incorporated into Erin's trading plan.
Benefits Of Backtesting
Strategy backtesting is a common practice among professional and novice traders alike. It has several key advantages for those striving to establish an edge in the marketplace. Three of the largest are the creation of a statistical track record, promotion of trader confidence and system applications.
1. Statistical Track Record
Backtesting a historic data set is a quick, affordable way of verifying a strategy's performance. Wins and losses are readily identified, creating a statistical track record. A strategy's win percentage, as well as expected periodic profit and loss are all readily available. The end product is a detailed, empirically quantified account of past performance.
Advanced metrics such as per trade win/loss, consecutive winners/losers, maximum trading account drawdown, return on equity and time to recover may also be included in a study. These values shed some light on how a strategy or system performed over time in a variety of market conditions.
Perhaps the greatest advantage of strategic backtesting is the psychological component. Through observing a methodology's efficacy over time, one can become at ease with the potential outcomes of its application to live trading. Given this perspective, being decisive in the real-time market is exponentially easier.
For instance, assume that Trader A has fully backtested a Bollinger BandBollinger Band breakout strategy. The results of the study were exceptional, generating steady profits and a robust winning percentage. It stands to reason that Trader A will have confidence enough in the strategy to apply it consistently without hesitation in the live market.
3. Systemic Applications
Backtesting studies are specifically useful in system building. A trading system is a set of rules that governs market entry, exit and applied leverage. Systems may be discretionary or automated and applied on any market or timeframe.
Advancing technology has brought sophisticated systems trading to the retail masses. In fact, algorithm systems are now prevalent throughout the market, with more than 40% of FX traders using algos in 2020. Accordingly, a statistical track record is the go-to barometer for determining if a black box, signal provider or high-frequency system is viable.
Drawbacks Of Backtesting
As with all things in the financial markets, historical data backtesting has a few drawbacks worthy of note. At the top of the list are confirmation bias, flawed data and inconsistent trade execution.
1. Unreliable Data
It's important to remember that the forex is an over-the-counter (OTC) market. In turn, liquidity providers and brokers conduct business at unique prices, although the differences are slight. This can lead to a discrepancy in historical data, which can skew backtesting results.
2. Confirmation Bias
When scrutinising past events, humans are prone to fall victim to one pitfall: confirmation bias. Confirmation bias can undermine any backtesting study, making the results inaccurate and misleading.
According to the Cambridge dictionary, confirmation bias is "the fact that people are more likely to accept or notice information if it appears to support what they already believe or expect." This is especially relevant to backtesting, as traders often subconsciously backfit data or tailor study parameters to create positive outcomes. In this case, the statistical track record is misleading and doesn't represent a strategy or system's true performance.
As anyone with significant trading experience will attest to, trading in the live market is much different than applying parameters to past forex data sets. A multitude of factors come into play, specifically bid/ask spreads and slippage.
Slippage is the difference between a desired order price and the price at which the order was actually filled in the market. Backtesting cannot account for this variable, thus market entry and market exit values may be inaccurate. Further, bid/ask spreads vary considerably as market conditions evolve in terms of liquidity and volatility.
When taken together, bid/ask spread and slippage variance are capable of significantly influencing backtesting results.
Forward Vs Backtesting
Backtesting is only one type of market analysis. Many view it as a great starting point, a basis for future system and strategy building projects. Others prefer to study current market behaviour and craft strategy accordingly.
What Is Forward Testing?
Forward testing is the application of a strategy's parameters on evolving price action. Also known as paper trading, forward testing involves applying a system or strategy consistently in the live markets. Such projects may be conducted using a trading simulator linked to a demo account. There are many products designed for forward testing, such as the paper trading function on Tradingview.
Creating A Comprehensive Analysis
Forward and backtesting are frequently combined to create a comprehensive strategic analysis. To do this, traders select a period to backtest, then forward test in the live market. Once an adequate forward testing sample set is created, the results are compared to the backtesting study.
The strategy's efficacy is then judged by observing a variance between the forward and back data sets. If the results diverge, then the system is reflecting random performance; if they are complementary, the system's parameters are valid.
Backtesting is the act of applying a system or strategy to historical pricing data. In doing so, a statistical track record is created that reflects the past performance of the methodology. Such studies promote trader confidence and are useful tools in system building. However, backtesting has several pitfalls, including flawed data sets, confirmation bias and it doesn't account for variable order execution.
Ultimately, backtesting is a good place to begin analysing a strategy or system. While certainly not perfect, the discipline can be valuable in spotting weaknesses, strengths and improving an existing methodology.
FXCM Research Team
FXCM Research Team consists of a number of FXCM's Market and Product Specialists.
Articles published by FXCM Research Team generally have numerous contributors and aim to provide general Educational and Informative content on Market News and Products.
Retrieved 22 Feb 2024 https://dictionary.cambridge.org/us/dictionary/english/confirmation-bias