Backtesting: To Test or not To Test?
One of the key elements which determines whether a trader will become a consistently profitable market participant or join the swollen ranks of losing retail traders, is the individual’s ability to execute a ‘rules based technical trading strategy’. The professional trader defines a specific rule set which allows them to engage the market under certain circumstances and execute a trade.
Once a trade is entered, the professional trader then adheres to a risk management strategy and rules for managing their trade either to a profitable or loss making exit. The professional trader continuously executes their trading plan with the aim of creating a statistically significant set of trade outcomes that will allow the trader’s edge to demonstrate a net profitable return.
Pro Traders Test
A great number of professional traders seek to automate their trading strategies in an effort to avoid common psychological based trading errors. These errors can often times take a solid trading strategy and turn it into a losing strategy that ultimately fails to deliver against profitable expectations. In the worst case scenario, errors even can liquidate a trading account.
The process of automating your strategy will entail developing an Expert Advisor for the metatrader platform; essentially a trading strategy coded for the MT4 platform and representing the trading logic of your trading plan.
A key step in the process of creating and subsequently trading a technical trading plan, is backtesting. As the name suggests; the backtesting process allows the trader to test their trading plan using historical data of the financial instrument they intend to trade. Aspiring professional forex traders are able to take advantage of the backtesting function on the metatrader platform.
We’ll walk through the process and look at some of the unforeseen pitfalls to avoid to assist you in creating and benefiting from a thorough backtest. So, for the purposes of this piece, we’ll assume that you have already developed your trading plan and subsequently have your trading strategy coded. Overall we’re assuming that you have an Expert Advisor ready for backtesting.
Once you have enabled the strategy tester function on your MT4 terminal. The strategy tester window will pop up, this will allow you to select to select your Expert Advisor and define the instrument you wish to test your trading strategy on. You can also define the time frame you wish to test on, one of the most important functions for creating a valuable backtest is the Model functionality.
Modelling Quality Is The Key
The Model functionality input is one of the largest pitfalls that a trader can fall foul of. Many aspiring traders fail to recognise the importance of the data integrity that they are testing their Expert Advisor on. The data quality requirement is specifically relevant when your trading strategy is more aligned with a scalping approach, where your profit objective is one to fifteen pips.
The pitfall is that the Metatrader terminal does not have direct access to the tick by tick price data over the history of the instrument you have decided to test. It can only access the minute by minute bar data which is the open, high, low and close price. Because of this limitation, the Metatrader platform actually delivers false price ticks via a process known as ‘interpolation extracting’ from the smallest price data available.
As previously mentioned, where your trading strategy has a stop and take profit objective greater than 100 pips, then interpolation won’t affect the quality of your backtest. Regardless of stop size, it is always advisable to use the best data you can source, specifically if you want to model your backtest with high quality tick data. Using tick data will ensure your back test is modelled to 99% accuracy.
It is not uncommon for trading strategies tested on either control points data (which simply takes prices from the shortest time frame available) or open prices only data (which is the crudest form of low quality data) to deliver test results that show a strategy to be hugely profitable. The same strategy when tested on tick data could demonstrate an unprofitable strategy. The more accurate the data the more accurate the backtest results, because the tick data level of data most closely reflects the reality of the trading environment.
A further key input to think about, which you’ll need for a valuable set of backtest data, is that your data needs to reflect a variable spread. As all experienced traders are aware, retail brokers are notorious for variable spreads in the foreign exchange markets. So, it’s a specific aspect that must be considered where spread, even on FX majors, can fluctuate from 0.5-5 pips or more during periods of low liquidity or high volatility. The spread variability will have an impact upon the real time performance of your trading strategy and so needs to be factored. The metatrader terminal only offers a fixed spread function through its backtesting function.
One way to overcome the issues regarding data quality and spread variability is to acquire historical data from specialist data providers, there are a number of providers that produce 99% tick quality data with historical spread variability within the data set. So not only do you get the highest quality data but you also benefit from the historical spread which occurred through the history of the data set.
This 99% quality data will also replicate slippage that may have occurred during market price gaps occurring intraday and over the weekend. The better quality data also facilitates testing on multiple metatrader terminals at the same time helping to decrease the time to get your backtesting completed.
Reading The Results
A few statistics to take note of:
- Total net profit = Gross profit – Gross loss.
- Profit factor – The ratio of gross profit to gross loss. Higher is better, anything above 2 is acceptable.
- Absolute drawdown – The drawdown of your initial deposit. High drawdowns increase the likelihood that your account will be blown out.
- Profit trades – Your overall win percentage.
At this juncture it is also prudent to examine the percentage of the results that have a profit versus loss. Sort the results by profit and scroll down through the list. A robust strategy should have a high percentage of profitable result sets. Also pay close attention to the profit factor and the drawdown. If the profit factor is less than 1.5, and too close to 1.0, you’re losing too much of your gross profit to losses. The drawdown percentage should ideally be around 10-15%, and no more than 20%. If your drawdown consistently exceeds this, then you are either taking on too much risk (large lot size or stop loss), or the strategy is simply unprofitable.
In part two we will look optimisation and curve fitting, out of sample data and optimal optimisation.