How To Backtest A Forex Trading Strategy (Full Guide)

Testing a strategy is one of the most crucial parts of forex trading. It’s so common to see a few trades work and think you have a market breaking strategy in your hands, only to find that played out over the next few months you’re down 15% on your equity.

A strategy without backtesting is gambling! If you really want to know if you’re wasting your time, you need to backtest your trading strategy over years of high quality data…

To Backtest A Forex Trading Strategy, You’ll Need To:

  • Pick your trading strategy and define the rules you’ll be testing.
  • Select a currency pair to test on.
  • Look for trades that meet your defined trading ruleset.
  • Record all relevant information in a table, including stop losses, take profits and risk to reward.
  • Repeat on every trading setup, until you have completed years of data.
  • Study the results objectively.

What Is Backtesting In Forex?

Backtesting is without a doubt the most important part of forex trading. At the start of my trading career, I would see an entry style or a combination of candles playing out a few times and I would automatically trust this to work. I would change setups and trading styles constantly after seeing a few successful trades.

Once the dust had settled, I’d have taken 30 trades on this new strategy just to find out that it wasn’t actually profitable over the long term. This caused a huge amount of frustration and wasted years of my life trying to trade unprofitable strategies – it sounds familiar, right?

Backtesting is a way to objectively gauge whether or not a trading strategy is profitable. The logic behind backtesting is very simple – if the strategy worked over past market conditions, it will likely continue to work over future market conditions.

You test the trading strategy and ruleset over years of data and thousands of trades, to see the profitability of the strategy. This cuts YEARS of trial and error out of the mix. This is also crucial for forex trading botsOpens in a new tab.

The Benefits Of Backtesting Your Trading Strategy

The benefits of backtesting are endless. You need to know that the strategy you’re dedicating capital to is profitable. No matter how good of a trader you think you are, if you’re trading a strategy with no edge in the markets then you’re doomed to fail – you just won’t realise it yet.

Backtesting allows you to:

What Is Needed For A Successful Backtest?

A backtest done wrong is absolutely useless to a trader. You need to make sure that you have a few things in place first before beginning to test any kind of trading strategy.

Most importantly, you’ll need to ensure that your trading strategy is objective. What does this mean? In essence, you need to have established rules when doing a backtest, as to avoid human error or bias playing any part. When I was an unprofitable trader, losing on live markets, I would somehow always be profitable in a backtest.

This was because I didn’t have any fixed rules and I was just making it up as I went along.

To backtest properly, you’ll need fixed and preset rules for:

  • Stop losses
  • Risk
  • Take profits
  • Partials
  • Entry signals
  • Exit signals
  • Directional bias
  • And more!

If you don’t have these already, then spend some time figuring out a set of rules to create a trading strategy. If you need help creating a trading strategy, I would take a look at this Investopedia articleOpens in a new tab.

What Options Do You Have For Backtesting?

Backtesting a trading strategy can be done in 2 ways, both with differing levels of success. This can be broken down into either performing an automated backtest, or manual backtest. Let’s find out more…

Automated Backtesting

Automated backtesting is when you’re using a tool to screen years of data, in the space of a few seconds. Now this will only work for very objective systems as you’ll need to input exact criteria into the back tester. The majority of automated backtests are performed using EA’s on MetaTrader 4’s strategy tester feature.

The benefit of this way of backtesting is the fact you have no manual intervention, meaning you cannot interfere with the results. This typically provides a much more accurate data set and results.

Automated backtesting relies on a high quality of data, so you’ll need to ensure that the quality remains high. There’s a huge amount of different tools you can use for an automated backtest, the most common being MT4 and Forex TesterOpens in a new tab.

Manual Backtesting

Manual backtesting is a lot more common and the majority of retail forex traders like to use this as their primary method of testing. This entails a trader looking over years of data manually and taking trades based on what they see.

This should still be done with a fixed set of rules and should not differ too much in results from an automated backtest.

The issue with manually testing is human bias. Traders typically will say ‘I wouldn’t take that setup’ or find some kind of reason to justify a loss, resulting in backtests appearing much better than reality.

TradingViewOpens in a new tab.

Backtesting Your Forex Strategy On TradingView

TradingViewOpens in a new tab.

Backtesting on TradingView (Step By Step)

  • Open the currency pair you’d like to test on. I’d recommend a major pair with good volume and liquidity, like EURUSD or GBPUSD.
  • Click the bar replay tool and zoom out (or scroll back), to where you’d like to start the test from. I’d recommend having a few hundred trades, so scroll back years on H1+, or maybe 1 year of data if you’re trading the lower time frames.
  • Press play or use the next bar button to see candles appearing, as they would do in the live markets.
  • Pause when you see a trading opportunity.
  • Add your risk to reward tool on the screen and set your stop loss and take profit.
  • Play the chart, to see the trade unfold.
  • Journal the outcome of the trade.
  • Repeat this a few hundred times.

This is all you need to know about backtesting on TradingView! It’ll take a few sessions to get used to, but once you’re a bit experienced on the platform it is extremely user friendly. I find it by far the easiest platform to backtest on, manually.

Backtesting Your Forex Strategy On MetaTrader 4

MetaTrader 4 is the most common choice of retail traders looking to effectively backtest a forex strategy. This isn’t for any reason in particular besides the fact that it’s also the most common trading platform.

When testing on MT4, you’ll need to make sure that you have data. If you’ve just downloaded the platform, you will have little to no data. Even if you’ve used the platform for years, you’ll still not have enough tick data stored to make the backtest worth doing. Luckily, MT4 have a Data Center! Let’s walk through the steps…

Backtesting on MetaTrader 4 (Step By Step)

  • Go to Tools, then Options. Once in options, click on Charts and set the max bars in history to 500,000.
  • Go in Tools again, then click on History Center.
  • Click on the currency pair you’re looking to test, then click import to bring the data onto your platform. (This will take a few minutes)

Manual Backtesting:

  • Open the currency pair you’re looking to test.
  • Turn off auto scroll (Green arrow at the top of the chart)
  • Scroll back as far as you’d like to backtest.
  • Start scrolling forward again looking for setups that meet your trading plan. Or press F12 to skip just one candle at a time.
  • Journal the trading setup.
  • Rinse and repeat.

Automated Backtesting:

  • Make sure that your EA is installed in the MQL4 folder, in Experts.
  • Refresh your EA’s. You should see your new EA in your EA’s folder on MT4.
  • Click on View, then Strategy Tester.
  • Add your EA into the strategy tester window.
  • Edit the expert properties, as per your requirements.
  • Set the symbol, model type and date range.
  • Click start.
  • View report and graph to look at results of the backtest.

Backtesting Your Forex Strategy With Advanced Programs

If you aren’t a fan of MetaTrader or TradingView, there are a range of other programs and tools out there to help traders in testing their strategies. I have actually tested each and every tool and compiled a handy listOpens in a new tab.

The best backtesting tools in 2023 are:

Is It Possible To Backtest An EA/Robot?

EA’s and robots are rapidly becoming a very popular way to trade forex markets. They’re especially popular with part time traders that don’t want to/cannot dedicate a huge amount of time to the charts.

Although hard to code, developers are able to make a huge amount of different EA’s with different perimeters so they’re often being sold for fairly cheap on various market places. For example, I recently purchased an EA from ForexKingsOpens in a new tab.

You can backtest an EA over years of data very easily using the MT4 backtesting feature. Although this feature is fairly limited, if you’re looking to test an EA over 5+ years of data, this is going to be the best option in my opinion.

I have used the feature hundreds of times and although the data isn’t 100% accurate, you will get enough of an idea of the metrics you’re working with to decide if the project is profitable or not.

Once you have run the backtest program on your EA, you’ll be given a lot of metrics, charts and data for you to work with, which allows for optimisations and tweaks to the system.

As shown here, the modelling quality was 90.00%. This really isn’t great and the results cannot be taken as gospel. I would personally need to combine this backtest with a demo forward test for a few months, to be sure that the strategy is even viable. Every percent is very important when you’re looking at modelling quality.

In Conclusion – How Do You Backtest A Forex Strategy?

In summary, backtesting a forex strategyOpens in a new tab.

Backtesting a forex strategy, step by step:

  1. Choose a currency pair to test (I would recommend EURUSD or GBPUSD).
  2. Go to historic data and look for trades that meet your ruleset.
  3. Record all information in a table.
  4. Repeat until you have over 200-500 trades.
  5. Study the results and tweak your criteria.

This is backtesting in a nutshell! If you have any experience backtesting forex strategies or any tips and tricks, please do leave a comment down below – I’d be very curious to see how you approach this!

Kyle Townsend

Kyle Townsend is the founder of Forex Broker Report, an experienced forex trader and an advocate for funding options for retail forex traders.

Recent Content