If you have heard of Forex backtesting, but always wondered how to do it, then this guide is for you. Just like everything in trading and in life, there is no one-size-fits-all.
Backtesting will not work for every trader or every trading system.
However, there is nothing that I have seen that has universally helped more people become successful in trading, than backtesting.
I consider it vital in your learning process.
So I have put together what I consider the definitive guide to backtesting Forex trading strategies, to help get you started.
This guide is the result of my personal experience with backtesting and talking to dozens of professional Forex traders over the years.
I hope that it helps you get started and see the value in the process. More importantly perhaps, I also hope that it is something that continues to help you take your trading game to new levels, even when you have become consistently profitable.
Table of Contents
In this post, I will answer these common questions that traders have. Click on a link to skip to the section you need, or if you are just starting out, begin from the top.
- What is backtesting?
- How can backtesting help me?
- What is curve fitting?
- What's the difference between manual and automated testing?
- Do professional traders really backtest trading strategies?
- How to backtest a Forex trading strategy for free?
- What is the best way to get started with professional backtesting?
- How do I analyze my backtesting results?
- Other backtesting resources
I would recommend getting out a notebook or opening Evernote to take some notes and write down questions that you want to research later. Also open your favorite charting program, such as Metatrader 4, so you can follow along.
What is Backtesting?
Backtesting is the process of testing a trading strategy on historical data, to see how it would have performed in the past. In theory, if a system worked well in the past, it will continue to do so in the future.
Of course, market conditions can change, but we will get into that in the section on the limitations of backtesting.
For now, just think of it as a way to have a reasonable level of certainty that a trading strategy will be profitable into the future.
For example, let's say that you wanted to test a simple Relative Strength Index (RSI) trading strategy. Your trading strategy may look something like this:
- Enter a trade when the indicator crosses back from overbought/oversold
- But the stop above/below the most recent high/low
- Set a 2X risk profit target
- Risk 1% per trade
Here are a couple of examples of sell signals.
In order to find out if this is strategy might be profitable, you would test it on as much historical data as possible. A common backtesting period would be from 2001 to the present.
Testing over a longer period of time like this allows you to see how the strategy performs during different market conditions. If you only test in one type of market, you will get a very skewed look at the performance of the system.
For example, if you test a trend following system in a trending market, then of course it will do well! But if you also test it in a choppy market, then you get a much better idea of how much money it will lose.
Makes sense, right?
How Can Forex Backtesting Help Me?
We have established that backtesting can show you if a trading method has the potential to be profitable over a long period of time.
But it also has other huge benefits that you may not be aware of.
Just like a professional basketball player practices simple things like free throws, a professional trader also has to practice routine parts of their game.
That means practicing spotting opportunities. Backtesting can give you that practice, even when the markets are closed.
You may think that this is not necessary, but if you don't keep your skills sharp, it can be easy to enter a trade that doesn't meet your criteria.
Especially if you trade multiple strategies or markets.
This video will give you a good illustration of how much more practice you can get with backtesting, compared to live trading.
This video demonstrates Forex Tester, but you can use whichever software works best for you.
Of course, with practice, also comes confidence. This is probably the most important result of backtesting.
When you understand how often your system will win, your maximum drawdown and more, you will be able to pull the trigger on trades. You will not be so hard on yourself when you lose a trade.
Because you know that it is all part of the system.
You have an advantage. If you apply that advantage enough times, you should come out ahead.
By knowing what your advantage is, you also know when your advantage has stopped working or at least when you might be in market conditions that are not ideal for your trading system.
Knowing this will give you the confidence to stop. To learn the entire process of testing and optimizing a trading system, sign up for the TraderEvo Program.
Sounds great right? Well, it's not all sunshine and rainbows.
What is Curve Fitting?
Before we go any further, let's define a very important term associated with backtesting…curve fitting. This is when you backtest a system over a short period of time and over-optimize it for that time period.
Obviously, that system will look great on paper, but will perform terribly in real trading.
Example of Curve Fitting
To illustrate this point, let's take a look at a historical chart of the EURUSD monthly chart. If you created a trading system by only using the data in the green box, then you would have undoubtedly created a trend following system.
This trend following system probably would have been insanely profitable…during this time period. You may have been so convinced that this is the “holy grail” that you might take more risk than usual.
Hold on there cowboy…
But if you tested the same trend following during the time period in the blue box, you probably would have chopped to bits.
A regression to the mean or counter trend trading system probably would have worked better there.
See what I mean?
You Need A Robust Trading System
So your trading system has to work in all types of market conditions. But that doesn't mean that you have to make money in all markets.
I know of some trend methods that take a lot of small losses in ranging markets, but get super aggressive in trending markets and make all that money back, and more.
At this point, you might be asking:
Why not trade only when there is a trend?
The reality is that nobody really knows exactly what will happen next in trading. Therefore, your trading system has to be ready in all trading environments.
In time you should be able to identify certain clues that will tell you when your system has the advantage. But if you are wrong, you need to get out with a small loss.
Curve fitting can give you false confidence that a trading system is much better than it really is. That is why forward testing is necessary too. To learn more about forward testing read this guide.
What's the Difference Between Manual and Automated Testing?
Some people think that there is only one type of Forex backtesting. They think that you have to know how to program and you have to write an automated trading system like an Expert Advisor (EA).
The reality is that anyone can backtest.
This is because there are two types of backtesting: manual and automated. Here are some options that you can start to explore, depending on which one you are more drawn to.
Automated Forex Backtesting
Automated testing is when you create a program that automatically enters and exits trades for you. There are programs that you can purchase, rent, download for free, or you can create these programs yourself.
Read our automated backtesting guides here:
- Make money in your sleep!
- Removes the emotions from trading.
- No money at risk in the testing phase.
- Can be leveraged on a copy trading service, to make more money.
However, before you start developing an automated system, you need to take into account the downsides.
Here is what you need to be aware of, when developing an automated system:
- One misplaced comma in the code and you could lose your entire account. It has to be tested extensively.
- You need to know the exact parameters of the trading system, so you know when it stops working.
- Even though the system is automated, you still need to check it on a regular basis. Is the technology working? Has the market changed?
- No guarantee that it will work in live trading, has to be forward tested first.
- The system needs to fit your personality and risk tolerance. The system might be awesome over a long period of time, but if you cannot stomach a 30% loss, then you are going to turn it off before it has a chance to make that money back.
- You have to understand coding (can be time consuming to learn) or you have to hire a programmer (which can get expensive).
- Not all trading methods can be properly translated into an automated system.
- Curve fitted trading programs look great in testing, but will fail miserably in live trading. Test accordingly.
On the whole, I believe that automated trading is only for a small portion of independent traders. I could be wrong, but in my experience, most people are better suited to manual trading.
Now let's take a look at manual testing. It might not be what you think.
- You really get a feel for how a trading system works because you execute every single trade. This can help you improve the system or even create an automated version later.
- Anyone can do it.
- It will simulate live trading mechanics: entering/exiting trades, using proper risk, etc.
- No money at risk.
Even if you want to do automated trading, I believe that most people are better off starting with manual backtesting because it is easier to start and you get a better feel for a system.
However, if you are a programmer or engineering type to begin with, then you may be better suited to automated trading.
- It can be time consuming.
- No guarantee that it will work in live trading, it has to be forward tested also.
- You need to be able to handle the drawdowns. The system might look good in backtesting, but if you cannot handle a system that has a 30% drawdown, then the system won't work for you.
- You need to be able to follow a set of rules during your testing. If you keep changing your rules in the middle of a test, you will not get accurate results.
Time to Decide
Now that you understand automated and manual backtesting, it's time to decide which one is best for you. I would recommend choosing just one and becoming and expert at it.
You can always switch later. But if you do both at the same time, you are less likely to succeed. If you have tried a million different trading systems and none of them seem to work, then there is a reason for that. Our training program teaches how to fix that.
Do Professional Traders Really Backtest Trading Strategies?
The short answer is yes.
But skeptics will need more than that, so I'll give you a few concrete examples.
The Backtesting Pioneers
First, let's go ol' school…
Really old school.
Back to the time of computers. No, not like the computer that you are reading this on.
Computers that used take up whole rooms. Computers that were programmed with punched cards.
Like this one…
Yes, physical paper cards that had holes in them. From this seemingly archaic mess, came the first system traders.
He used these crazy punch cards to test some trend following trading systems. And guess what, they worked!
In one of his actual client accounts, Seykota was able to turn an initial $5,000 investment into $15,000,000, in 12 years. After his success, a long line of successful automated systems traders followed, including Michael Marcus and Dr. David Druz.
Forex Traders Who Backtest
Now let's take a look at some Forex traders that I have interviewed that backtest their strategies. Listen very carefully to what they did and the types of systems that they tested. You will get some great ideas.
How to Backtest a Forex Trading Strategy For Free?
We live in a great time. Technology is getting better and cheaper. So if you have a very limited budget, then I have some great news!
You can start backtesting for free. Here are the simplest ways that I would recommend getting started.
If manual trading and testing is your thing, then I would recommend starting with TradingView. I like TradingView because there are no setups.
Simply go to the site and start using the charts.
Metatrader 4 is also free, but you have to install it and there can be some trouble with getting it to work right, especially on Mac or Linux. So start with TradingView and see if it works for you.
This video will show you how to do it. The written instructions are provided below the video.
To get started, setup a testing spreadsheet. Start by listing the following:
Now, what else do you need on the spreadsheet? I'll leave it up to you to figure it out.
I can't give you all the answers, you have to work for it too 🙂
But some ideas might include: lots traded, running balance and take profit. Add whatever makes sense for your trading and analysis methods.
Then setup a risk calculator to help you compute lot size when opening a trade. This will ensure that you are not risking too much on each trade.
Now scroll the TradingView chart back to the point when you want to start backtesting. Add any necessary indicators.
Then hit the right arrow on your keyboard to advance the chart candle-by-candle. Enter your trades on the spreadsheet.
Once you are done backtesting, you are ready to analyze your results. Refer to the section in this guide on analyzing backtesting results.
If you want to do automated trading, then I would start with Metatrader 4. It's widely used and has a ton of documentation.
To learn more about the MQL programming language, start here. I have found that when it comes to programming, the best way to start is to get some code that you already know works, then make small changes to some of the parameters or functions.
This will help you understand how the code works, without having to start from the very beginning. After you are comfortable with that, then you can start making bigger changes and even writing EAs from scratch.
What is the Best Way to Get Started With Professional Forex Backtesting?
Free options are great, but when you are ready to get real, then you will have to spend some money. This will save you a ton of time and headache.
Don't worry, it doesn't have to be a lot of money.
To get started with manual backtesting, I would recommend using Forex Tester. It is the most widely used manual backtesting software on the market.
It will set you back about $200, but it is totally worth it. This will allow to test quickly and see your results, without a lot of manual calculations.
If you want to take advantage of the 10% discount that I have worked out for Trading Heroes readers, use this coupon.
Forex Tester looks like MT4, so it is easy to use. You will still want to create a risk management spreadsheet, so you calculate your risk and lots per trade.
Forex Tester can be used for automated backtesting, but I have found that it is hard to find programmers who can code for it. So stick to it for manual backtesting only.
In automated backtesting, I would still recommend using Metatrader 4, but I would also suggest hiring a programmer to help you with testing.
Even if you are proficient in coding, an additional pair of skilled hands can help tremendously. So does a second pair of eyes.
You can find qualified programmers on our list of trading programmers.
There are also other paid backtesting platforms out there that can make your job much easier. Although I recommend that you look at MT4 first, there is a list at the end of this post that might help you.
How Do I Analyze My Backtesting Results?
Alright, now it is time to reap the benefits of your hard work.
The method that you will use to analyze your backtesting will really depend on what you used to backtest with.
You Went Old School
If you opened a chart in MT4 or TradingView and manually moved through each bar on the chart, then wrote down your trades in an Excel spreadsheet, then first of all…wow!
Congrats, you are officially hardcore.
This isn't the most efficient way to do it, but you got it done, and I respect that tremendously.
But in order to analyze your results, you will need to sharpen your Excel skills too. There are a lot of Excel resources to learn from, but I'll give you a quick lesson here.
The first thing that you probably want to do is to figure out the winning percentage of your system. To do that, make two extra columns on your spreadsheet, one for wins and one for losses.
In the wins column, use a formula to tally the wins. Do the same in the losses column.
- Wins: =if((net profit/loss)>0,1,0)
- Losses: =if((net profit/loss)<0,1,0)
Then add all of the wins and losses…
Then divide the wins by the total number of trades…
Now you will see the win rate.
You can uncover similar statistics, using this technique.
You Used Manual Testing Software
There are a few backtesting software packages out there, but since I recommend Forex Tester, I'll show you how to analyze your trading results for that software.
There are some built-in stats in the software, but they are very basic. You could go the Excel route, but that is very time consuming.
A better way to go is using software like Tradingrex. You can get the complete tutorial by reading this post.
It will give you a ton of great information, including profit and lost by day of the week. The best part is that it is free.
You Went Automated
Again, you have quite a bit of choice when it comes to automated solutions. But most people will use Metatrader 4 because it is free and you can use your broker's data.
Metatrader's reports are limited, so you will need more. Tradingrex is a good option for MT4 reporting because you can upload files and analyze them.
Other Backtesting Resources
Backtesting Tools (Automated)
- Metatrader 4 MQL4 and MQL5
- TradingView – Pine scripting language
There are many options out there and these are just a few of the top products. If you don't like anything on this list, feel free to do your own research and find something that works better.
Backtesting Tools (Manual)
- Forex Tester – The best Forex backtesting software
- Soft4X – MT4 Backtesting plugin
- Metatrder 4 – Scroll bar-by-bar
- TradingView – Scroll bar-by-bar
If you are using Metatrader 4, 5, or TradingView, you need to use Excel or a similar spreadsheet program to track your trades. This will allow you to compile meaningful stats later.
Here's a video on how to do it with MetaTrader 5:
That is how to get started with Forex backtesting. I hope that I have cleared up any confusion that you may have had.
If you want to learn the entire process, from beginning to end, join TraderEvo.
Test often and you should start to see the benefits.
I firmly believe that the only habits you will stick to, are the ones that are easy to do. So make backtesting as easy as possible and it is a habit that you will keep doing.
Make no mistake, this will be work. But almost everything worthwhile is 🙂
Got any more questions about backtesting? Leave them in the comments below…
Disclaimer: Some links on this page are affiliate links. We do make a commission if you purchase through these links, but it does not cost you anything extra and we only promote products and services that we personally use and wholeheartedly believe in. A portion of the proceeds are donated to my charity partners.