Backtesting is basically the application of a set of technical rules (i.e. a trading strategy) to a set of historical price data and the subsequent analysis of the resulting returns that the strategy would have generated over a specified time period. Traders can thereby determine how a given strategy or signal would *likely* have performed during a specified period.

While backtesting your strategy is essential to good trading discipline and should be part of any forex trader’s routine, there are shortcomings and pitfalls that one should be aware of. The underlying theory - or purpose - of backtesting, is that any strategy that would have performed well in the past is likely to also do so in the future. Yet, as we all well know, past performance is not necessarily a valid indication of what the future holds and hence there are limitations as to how heavily one should lean on backtesting results.

Despite the above uncertainties, backtesting should certainly not be discarded. This article seeks to give traders a good basic understand of what backtesting is, what drives the backtesting process and what one should be aware of in order to obtain reliable and usable backtesting results.

**How does a Backtester work?**Backtesting works by applying historical data to a given trading strategy and thereby reconstructing the trades that would have resulted from the given strategy during a specified time period. Based on an analysis of the resulting trades, key performance metrics about the overall performance of the strategy can be estimated. A trader can use this data to ensure that he/she doesn't have any unforeseen flaws in the strategy or simply to tweak and optimize their strategies in order to become sufficiently confident to activate them in a live environment.

**What results can I expect when running a backtest?**As mentioned above, backtesting should ideally furnish a trader with usable information that he/she can use to evaluate a trading strategy or system. Depending on what backtesting engine you are using, you are likely to get a wide array of statistical results, the most common ones being:

- Total PnL (profit and loss) of the trades initiated by the strategy (this may be expressed in nominal USD or as a percentage of your initial equity invested in the strategy)
- Total return on Equity (ROE) – your return expressed at percentage of equity invested
- Volatility – the maximum percentage of up/downside your strategy has experienced
- Win/loose ratios – the ratio of winning vs loosing trades the strategy has generated
- Annualized Return on Equity – what your return would likely return over a full calendar year
- Risk-adjusted return – quantifying your return relative to the implied risk of the strategy

Each metric gives you valuable insight as to how your strategy is likely to perform. It is always a good idea to compare these with the level of risk / volatility that you are comfortable with.

Please see the illustration below for an example of the statistical ratios you can expect when backtesting with Tradeworks. (Click to enlage)

**What settings should I have when initiating a backtest?**Depending on which backtesting engine you use, the settings may allow for a certain degree of customization including initial equity, date-range, commission level, periodicity, default lot size etc. At Tradeworks, we prefer to keep things simple. Hence, the only settings you need to initiate a backtest are the date-range of the period you wish to analyze; the equity you wish to commit to the strategy and the spread that you wish to apply.

**What factors are likely to influence the outcome from my Backtesting?**You might find that a given trading strategy will yield different results depending on which backtester is used. There are several factors which influence the outcome from backtesting a strategy which you should be aware of; they key ones being:

- Data (Quality, Source and Type) - is the underlying data accurate, from a reliable source and correct relative to your strategy?
- Trade Execution Logic - is the trade logic embedded in the backtester sound and realistic
- Determinism - will the same strategy applied on the same data produce the same results at all times

Other Factors affecting the outcome from Backtesting include slippage, latency, rejections and re-quotes. (If necessary, please see our Glossary section for definitions to these terms). For a detailed description of the above three factors see the article about backtesting in the Tradeworks knowledgebase.

**Conclusion**Backtesting is one of the most important disciplines when automating forex trading strategies. When executed correctly, with a high-quality set of data, backtesting is a hugely valuable resource that allows traders to test and optimize trading strategies and thereby gain the necessary confidence prior to running them in a live environment.

Posted by Tradeworks

Facebook LinkedIn Twitter Google+