Ultimate Guide to Backtesting Your Forex Strategies

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×

forex-trader-testing-strategy.Have you ever been watching a currency pair and seen a familiar pattern but you were not sure how you should approach the trade?  That feeling of uncertainty is one that thousands of traders feel every day. Now on the flip side, there are other traders who are more prepared and actually know what their next step should be instinctively.  Many of these latter traders have spent countless hours studying and researching price patterns and movements through backtesting, and are able to execute their trade plan more effortlessly and with a higher level of confidence as a result.

Download the short printable PDF version summarizing the key points of this lesson…. Click Here To Download

So, what is forex backtesting?  It’s the process of using a forex strategy tester based on historical price data. You can perform a manual forex backtest by printing out graphs of exchange rates, or looking back through your charts. In addition, you can use sophisticated complex algorithms that perform pattern recognition tasks. 

Whichever way you decide to backtest your forex strategies, the process itself will help you analyze situations that arise that have shown a propensity to provide a discernable edge in the market.

Manual Backtesting Methods

A manual backtesting process can be timely and arduous, but it’s a true and tried method. But some of the drawbacks include, the lack of efficiency, and a greater likelihood for making an error. 

For example, if you are looking at a chart on a piece of paper, it might be difficult to determine if a currency pair has actually generated a lower low from the previous price point.  You can mitigate this issue by working manually online, but nevertheless, the process will still be time consuming.

Manual backtesting of a trading strategy will allow you to gauge whether your trade idea might be viable.  You can scroll through historical data, looking to see if your ideas will work.  Once you have determined the variables that you want to test extensively, an automated process might be better suited and more efficient. 

The first step in a manual backtesting project is to find charting software that is easy and convenient to use.  It’s best if you have five or ten years of data available, especially if you are looking to back test a daily, or weekly strategy.  If you are attempting to find an intra-day strategy, it might be possible to use a couple of years of data to test your ideas. 

Intra-day time series can encompass a lot data, and finding reliable data in this this area can sometimes be challenging. For example, if you are analyzing minute data points, you will need to evaluate 1,440 points for every day, which is more than 1-million points over a 3-year period.

Automated Backtesting Methodsautomated-backtesting-systems

There are a number of ways that you can backtest your ideas.  You can use a forex simulator to test the data on your own, or you can use forex backtesting software that allows you to test basic to more sophisticated concepts.

There are a plethora of free data providers including Google and Yahoo that will allow you to download historical data.  Most of these data points will be daily or weekly open, high, low and close information.  You can download this data into a spreadsheet such as excel, which can then be imported into your backtest platform. 

If you are looking to test a strategy using intra-day data such as hourly, minute or tick data, you will likely need to purchase the data from a vendor.  The benefits of purchasing the data from a vendor is that typically their data has already been filtered and cleaned, removing bad ticks from the time series.

Any data that you download should be tested for accuracy.  You want to make sure that there are no bad data points, especially if you are relying on high and low points to enter a trade.  Bad data points can generate faulty results if the data has inaccurate highs or lows which are used to generate entry or exit points.

You have to really understand your strategy and determine if the data will alter the results.  For example, if you are looking at daily data, you don’t know if the high of the day occurred before or after the low of the day.  This can create problem if your take profit and stop loss are near to your entry level, as your criteria could generate a signal, even if the movement of the price action did not happen in the required sequence. 

For example, if you enter a trade on the prior days close, and your stop loss and take profit levels are with the next day’s range, the result of the trade will depend on how your system looks at the sequence of events when evaluating stop loss and take profit levels, rather then what actually occurred.

Learn What Works and What Doesn’t In the Forex Markets….Join My Free Newsletter Packed with Actionable Tips and Strategies To Get Your Trading Profitable….. Click Here To Join

Using Back Testing Software

Another way to back test a strategy is to use computer backtesting.  Many trading platforms today have trading wizards which allow the trader to create a trading model that utilizes technical indicators to establish a predefined set of rules.  The criteria that is used is based on historical data points, allowing you to see if the strategy worked in the past.

Mt4 strategy tester is an example of an automated backtest tool that has a built-in back testing system, in this case it is housed within the Metatrader platform.

You can use their language and graphical user interface, which an efficient way to build your system on their platform. You can also use their API (application program interface), and attempt to code a system that is customized. Below is a screenshot of Mt4 strategy tester:

Metatrader-backtesting-platform

Creating an Automated Trading System

There are several ways that you can add a systematic approach to your trading arsenal.  You can program the system yourself using your own ideas and strategies, or you can have someone else program an automated system using the strategies you have created.  If your trading system uses tools that are common, such as moving averages, or other technical studies, the most efficient approach to back testing will be to find use a platform like MetaTrader or Ninjatrader to back test your strategies. 

Learning how to use a vendor’s interface with take some time, but these systems are geared to those who have little development experience.  Standard strategies such as moving average crossovers, or overbought and oversold conditions are pre-programmed, into most back testing software packages, for your convenience.

Most self-coded back testing systems are programmed in an automated trading platform that is geared toward generating a trading strategy that combines entry criteria with risk management.  The criteria that is used for decision making is coded in the platform’s proprietary language. Most of these software packages have graphical user interfaces that allow you to simply click on specific variables and criteria in order to generate a strategy.

If you decide that programming a system is beyond your technical capabilities or one which requires custom programming, there are freelancer programmers for hire that will help you code a system.

Backtesting-forex-strategy.Hiring a Freelance Programmer

There are many skilled programmers that you can hire on a freelance basis that understand the nuance of specific trading platforms.

You can work with these individuals, and have them show you the results of each data series that they run with your provided strategy. But there can be some downsides to using an outside programmer. Some of the drawbacks include the additional cost you will incur from having someone else program your strategy. This includes the initial system programming, as well as the subsequent debugging process.  Since you will likely need to tweak your strategy, you should try to determine how you will pay the programmer each time you ask for a change. You will have to decide whether a flat fee or hourly fee arrangement should be used.

Backtesting provides you with a multitude of benefits. You will be able to determine if your strategy meets certain risk criteria and is likely to work in different market environments.  Most importantly, you have the ability to see if the methodology shows a positive historical result, prior to risking real capital. This will not guarantee profitable trading results in the future, but can help reduce the probability of potential losses. 

One of the benefits of programming a strategy yourself is that by doing so, you will gain intimate knowledge of how the system works and how robust your back testing results are. This will provide you more confidence when trading the system live.

As we pointed out earlier, the system that you develop, is only as good as the data that you use.  If the data is faulty, you will have errors in your results.  Bad quotes or prints, can generate false trading signals.

If you download your own data, from a free software provider, you should go through the data to see if there are any prices that look suspicious.  While closing values are usually consistent, high and low values can be choppy and lead to faulty results.

Purchasing a Trading System

There are dozens of commercial trading systems that are available in the market. Many have been back tested by their developers and some will advertise the spectacular returns of their system. Regarding commercially available trading systems, you should always work on the premise that if a claim is too good to be true, it’s usually too good to be true. Many times these “spectacular” systems are over optimized and curve fitted so they appear to be highly profitably based on historical data, but tend to fall apart when traded in real time.

There are reviews of trading systems that you can find throughout the internet, which describe how various systems perform in real time.  One reputable resource for reviewing trading systems is Futures Truth. If you cannot find a review, make sure you test the trading system on a demo account before you employ the strategy using real capital.

Issues and Pitfalls with Back Testing

As mentioned, one of the issues with back testing, and therefore purchasing a trading strategy that only shows historical results, is that there are techniques that can be used to make the strategy look good on paper but fail in real-time.  By fitting the curve, or over optimizing, you can produce a system that has been back tested and looks very good over a specific historical period.

A system designer can slightly alter the criteria that is used to achieve outstanding performance.  For example, a designer might back test a trend following strategy optimizing a moving average crossover system for a period of 2-years. 

Once they find the result that looks good, they test to see if the strategy works over a longer period.  Most of the time, the results will be fair at best, over the long term, but they will not tell you this when you purchase your system.  You could find out only later than the moving average crossover strategy that returned 100 % over the past 2-years, loses 20 % when you test it over the past 10-years.

What you want to be able to do is see how that system performs in a forward test or better yet in a real-time trading environment.

In addition, many novice traders sometimes assume that a trading system should have a very high percentage of winning trades.  With this in mind, an unscrupulous designer can create parameters that can be adjusted to create an amazing win rate of over 90% for example. This may seem attractive to the untrained eye, but in the vast majority of cases, this type of system will eventually blow up, because the losses will be many multiples of any winning trade the system generates.

Removing Negative Emotions from Your Trading

A system that is backtested helps remove some of the human emotion from a trade.  Many investors are calmed by the notion that a trade has worked well in the past.  This is especially helpful when a trade is moving against you and you are losing money.  You are more likely to hold on and let the trade play out, as opposed to cutting bait, assuming that is what your system calls for doing.

An important metric that a backtested trading strategy or system will provide you with is the maximum drawdown.  This calculation tells you the largest peak to trough decline in a portfolio.  When you back test your strategy you should calculate the maximum drawdown to see the largest drop that the strategy has experienced.  Past calculations of maximum drawdown will give you an idea of what you can expect if you experience an adverse market condition, and will allow you to better plan on this experience as the potential worst case scenario. But in most cases, keep in mind, that your worst drawdown is ahead of you not behind you.

If you backtested a system for 10 years where you are investing 10K and your maximum drawdown was $1,500 which is 15%, then you would typically not expect to lose more than 15-20% on your system during the years to follow.  If you back tested your system in multiple market environments, this type of analysis will help you determine how carefully you need to monitor your system, when a position starts moving against you in a way that was unexpected.  If your system has a new maximum drawdown that is 2-times the prior maximum drawdown, you may need to re-evaluate the backtest history or adjust your risk parameters.

While negatively charged emotions can be somewhat minimized when you begin to trade a system that has been back tested, it can still play a role in your decision processes.  You need to give a new system the appropriate amount of time to determine if it works.  Given the results of your system, you should plan in advance what you are expecting, and what you think you should do if the results in real-time are not as you planned.

You should also spend time forward testing your strategy using a practice account as opposed to real capital.  Do this for a few weeks or months and make sure that the backtested system is generating the returns you expected before attempting to use real capital with your strategy.

If you developed the system yourself, and backtested it, you might become attached to your strategy and fail to pull the plug on it even if it does not perform as planned.  Make sure you stick to a game plan and have benchmarks that describe your goals.

Summary

Backtesting is an excellent was to determine if a trading strategy has the potential to work in the future.  Keep in mind, that just because a system’s past results are positive, does not necessarily mean your strategy will work in the future. But it should provide you more confidence in your execution. And that is the best that we as traders can hope for. We are not executing on certainty, we are executing on probabilities.

Make sure the data you use for the backtest is clean, and does not have false highs and lows.  Be particularly careful if you are trading a system that relies on intra-day data.  Calculate the maximum drawdown so you understand the most you could expect lose from peak to trough, and be sure to test your strategy with demo money before you decide to risk real capital.  

Download the short printable PDF version summarizing the key points of this lesson…. Click Here To Download

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×

Listen UP….

Take Your Trading to the Next Level, Accelerate Your Learning Curve with my Free Forex Training Program.