Backtesting Trading Strategies Mt4
MetaTrader 5 is a solid automated backtesting platform. But did you know that it’s also a pretty good manual backtesting platform?
In this post, I’ll show you how to use this free software to manually backtest your strategies. This is a great option if you don’t want to purchase software like Forex Tester.
Backtesting means testing a trading strategy or an expert advisor on historical data. MetaTrader 4 provides a very simple and fast way to do it automatically via the Strategy Tester. Make sure to test your strategy before running it on a demo or real account. Also, make sure to use quality historical data or your results will not be reliable. MTrading MetaTrader 4 is a popular tool for backtesting Forex strategies because of its default in-built Strategy Tester feature. But keep in mind that while using the right software can indeed be helpful to you in trading, no strategy or indicator will work unless your broker is reliable.
I’ll give you all the tools that you need and the exact steps on how to do it. If your broker only has MT4 available, then It will work in a very similar way.
Why You Should Backtest
Backtesting is an excellent first step in helping you determine if a strategy has an edge or not. Since you can run through historical data very quickly in backtesting, this gives you a lot more data than if you only traded in a demo or live account.
Testing that might take months or years in demo trading, can be completed in a matter of days or weeks with backtesting.
You can also practice a strategy when the markets are closed, making it an ideal training tool.
So it’s extremely beneficial to learn this skill and MT5 is a good software to start with because it’s free.
This is the beginning of the roadmap to successful trading. To get a copy of the Trading Success Roadmap, read this post.
Here we go…
Download MetaTrader 5
The first step is to download MetaTrader 5.
You can get the software from your broker or you can download it directly from the MetaTrader website. It’s usually best to get it from your broker, but if you don’t have a broker yet, the MetaTrader version will do just fine.
Once you have a broker, you can connect to your broker through the MetaTrader version.
When you get the software from your broker, it’s automatically setup for that broker, so it can be a little easier to get started. Either way, you can get the complete MT5 installation instructions here.
Download Your Data
In order to do a valid backtest, you should have as much historical data as possible. Over the years, I’ve tried several backtesting solutions that only allow you to test a couple of years of data.
That’s totally useless because you won’t have enough trades to make a valid decision about a trading strategy.
So get as much data as you can. To download additional data, go to: View > Symbols
Then select the currency pair that you want to download data for. After you’ve selected the pair, click on the Bars Tab.
In this example, I’m going to download the USDCAD currency pair.
On the Bars tab, select the timeframe of data you want to download, then the starting and ending dates of the historical data.
Finally, click the Request button to do the download. I found that I had to click the button several times to get the data.
So if you don’t get it on the first try, keep trying.
If you have your own data, then you can upload it with this button.
Once the data is downloaded, you will see it in the window. You can scroll through the data to see how far back it goes.
That will give you the data you to do your backtesting.
If there isn’t enough data from your data source, then consider downloading additional data from this provider.
Open Your Spreadsheets
Trade Tracker Spreadsheet
Before you get started, you’ll need a spreadsheet to record your results. One of the biggest benefits of other software is all of this information is automatically recorded for you.
But if you would like to continue using MT5, then create a spreadsheet with the following columns:
- Open date
- Open time (if day trading)
- Currency pair
- Long or short
- Open price
- Close price
- Stop loss price
- Take profit price
- Pips result
- Pips risk
- Pips to profit target
- % Risk on trade
- Risk multiple result
- $ P/L
- Running balance
- Wins/losses
- Win %
TraderEvo members get this spreadsheet as part of their membership. Once you’ve built your spreadsheet, then move on to the next step.
Backtesting Results Spreadsheet
Next, you should keep a spreadsheet that tracks the results of each of your individual tests.
Be sure to track the following for each currency pair:
- System name
- System notes
- Chart timeframe
- Version
- Test number
- Return
- Win Rate
- Trades
Then create a sum and average in the last two columns.
Keep Your Trading Plan in Front of You
When you’re backtesting, it can be easy to deviate from the plan. If you’re like most people, you’ll start tweaking the strategy in the middle of the test.
I’ve done this before too, so that’s why I keep my trading plan in front of me while I’m testing.
It will keep you on track and ensure that you are sticking to the plan.
You can get a free PDF download of the Trading Plan Worksheet I use here.
Once you have your plan in front of you, it’s time to begin your testing.
Start Testing
Now it’s time to get started!
First select the pair and timeframe that you want to test.
Next, add any indicators that you’ll be using to your chart.
Then scroll your charts back to a point in time that you want to start from. If you are testing the H4 chart or higher, I would recommend going back as far as possible.
You can usually test all of the data for a Forex pair on a H4 chart or higher.
When testing lower timeframes, you should pick a few timeframes and test on those timeframes only. Pick a good mix of timeframes that have the following characteristics:
- Strongly trending market
- Strongly ranging market
- Neither strongly ranging or trending
That will give you a good idea of how your strategy will perform in different market conditions.
Do the following to scroll back quickly on your chart:
1. Turn off Autoscroll. This will stop the chart from moving to the most recent candle every time price changes.
2. Hit Enter on your keyboard to specify a start date. A small box will appear in the lower left corner. Enter the date that you want to scroll back to on the chart in dd.mm.yyyy format, then hit Enter again. You can also manually scroll back to the date on the chart that you want to start from.
Once you have scrolled back to the historical data that you want to start at, then hit F12 on your keyboard to move the chart forward, one candle at a time.
Record Your Results
Every time your setup fires off, place a trade and record it in the spreadsheet. You don’t have to take screenshots at this point because you don’t even know if the strategy works or not.
So just keep testing as fast as you can, so you can get as much data as possible. Creating screenshots will only slow you down.
Review Your Results
Now take a look at your spreadsheet and calculate the following:
- Win Rate (%)
- Return (%)
- Number of Trades
This is enough data for now. It will help you understand if you want to pursue this strategy or not.
If you want to be extra sure, do another round of testing to verify your results.
Sometimes you might be distracted or not in the right mindset when you do a test. So if you get the same result with a second test, that will give you much more confidence that a strategy has an edge and you should move forward to the next step in your testing.
Test Another Pair
If you’re satisfied with the results of a currency pair, then move on to testing another currency pair.
Not all currency pairs behave in the same way, so you can’t assume that it will work on other pairs too.
Some pairs are more volatile than others. Each individual currency is influenced by different economic factors.
You might be surprised at how differently a strategy performs with different strategies. This is why you need to test each pair individually.
Be sure to record all of your rounds of backtesting on a separate spreadsheet.
Things to Avoid
Here are a few things to be aware of when doing backtesting with MetaTrader 5. These tips will help you get the most out of your MT5 testing sessions.
Moving Too Fast Through the Charts
When you move too quickly through a chart, there’s the tendency to move past an entry point on the chart. That leads to hindsight bias because you already know what’s going to happen.
If you already know how a trade will turn out, then you’ll have biased data.
So find the testing speed that will allow you to get a lot of testing in, but also won’t give you advanced knowledge of each trade.
Changing Your Strategy in the Middle of a Test
It’s really tempting to start tweaking your strategy in the middle of a test because you see a new advantage. But stick with the strategy, or you won’t have a valid test.
When you change a strategy in the middle of the test, you won’t know how good the original rules really are. You also won’t know how good the new rules are either because you are only doing a partial test with them.
So finish a test with one set of rules. Then create a new test with your new testing idea.
Otherwise, your testing data is useless.
Stopping Too Early
If you win 10 trades in a row in the beginning of a test, you might be tempted to stop the test and call it a success.
Don’t.
The strategy may have just hit a really profitable streak that isn’t normal for that strategy. Stopping early won’t allow you to see the entire picture and can lead to losses later.
Giving Up on a Low Return Strategy
It can be tempting to give up on a test if it’s only returning 1% per year. However, consider what would happen if you compounded that return with multiple pairs or timeframes.
If the strategy has a high win rate, it’s certainly worth considering.
You might give up on an otherwise profitable strategy and find yourself jumping from strategy to strategy, when the first strategy would have met your goals.
Don’t Keep Testing if the Results are Obvious
On the other hand, if it’s obvious that the system doesn’t work, then quit and save your time. For example, if your strategy has lost 80% of the account, then it’s probably time to stop.
There’s no way you would continue with that strategy in real life.
Forcing the Strategy to Work
People also tend to be too optimistic about a trading strategy. So they will subconsciously pass on losing trades and only take the winning trades, just to prove that the strategy works.
I was guilty of this when I first started backtesting. When I reflect back on this, I did this partially because I wanted to get the backtesting process over with (and trade live) and I didn’t like being wrong.
I’m not sure why others do it, but those were my reasons. They’re very odd reasons in hindsight, because they didn’t help me become a better trader.
But our actions aren’t always logical and we need to continually reflect on our behavior to progress.
Conclusion
Although backtesting can be very beneficial, not all strategies can be backtested. Learn more about this limitations of manual backtesting in this blog post.
But if you can backtest a strategy, it’s a great way to test a trading idea, get hard data and build confidence in your skills.
This tutorial will give you a good starting point, be sure to read the Complete Backtesting Guide for more details. Once a strategy tests well, the Forward Testing Guide will show you how to take your trading strategy into the next phase of testing.
Backtesting Trading Strategies Free
If you would like help with anything mentioned in this post, be sure to sign up for the TraderEvo Program. It will take you through this process and provide the support you need to get through it.
Related Articles
Welcome to this video on backtesting trading strategies. The irony is that using trading backtesting software may be the absolute worst way to design trading strategies.
Backtesting Trading Strategies Mt4 Login
Learning how to backtest a trading strategy using excel, MT4 or another software program seems like a good idea at first. But it’s not. This video and article will walk you through the logic of exactly why, and what to do instead.
Was this video on backtesting trading strategies, helpful to you? Leave a message in the COMMENTS section at the bottom of this page.
PLEASE “PAY IT FORWARD” BY SHARING THIS VIDEO & ARTICLE ON FACEBOOK OR TWITTER by clicking one of the social media share buttons.
BACKTESTING TRADING STRATEGIES
Welcome to this video on backtesting trading strategies I share with you my experience with backtesting which I have done for well I did do for many many years. I don’t do it anymore and I’m going to share with you why. I have very sophisticated software very high powered computer system and I was trained in how to do this I’d find a few strategies that were viable historically.
Then what you do typically is you understand that’s curve fitting. So then you take the successful strategies and you apply them to data that is separate from the data used historically that’s called out of sample forward testing. So most of them when I took them and use them on out of sample data they failed the night. Ninety five percent of them. So then that last 5 percent which is very hard to find.
TRADING BACKTESTING SOFTWARE
I would then start treating real live markets in current time and none of them were successful over the long period of time someone worked for a little while and then ultimately fail. So why is that. I started to wonder because I spend a lot of time on that and I was very disappointed. So I started thinking about it. I realized you know there are some real problems with the whole idea of backtesting. Here’s the first one.
You’ve seen this legal statement everywhere. Go ahead and fill in it just in your mind just fill in the the end of the sentence. Past performance is no guarantee of what you know the end of this. Most people do. We see it everywhere in websites and on documents that people send to us brokerage firm software whatever. Past performance is no guarantee of future results. This is why trading backtesting software isn’t reliable for futures profits.
HOW TO BACKTEST TRADING STRATEGIES IN MT4
So we’ve seen it everywhere. You knew that. That’s a problem. If that’s a legal statement that all these companies put on their documentation that means that that’s a very significant issue and it is in fact that many studies have been done on this Couple of a moment or in 2014 a Wall Street Journal study found that only about 14 percent of Five-Star funds retained their reading 10 years later.
Past performance was not indicative of future results. In 2013 a Vanguard study reported that the one stars and now we’re looking at the other end The Wall Street Journal analyze the Five-Star at Vanguard study the one stars and they had the actual greatest excess returns what they call when compare it against a benchmark. So wow. What the heck’s going on. Yes I hate the opposite of what you would expect especially when most people make decisions on funds to buy based on their past performance. If this is true, then learning how to backtest trading strategies in mt4 may be futile.
HOW TO BACKTEST A TRADING STRATEGY USING EXCEL
Well to me what that indicates is there’s probably a reversion to the mean. We all know that very very few people ever outperform just the benchmark the S&P 500. And so therefore if it does outperform for a while it reverts back to the mean if it underperforms for awhile revert back to the mean. So that’s one huge problem.
Another one is that markets change over time. Back when I started trading which is decades and decades and decades ago I’d have to call my broker on a rotary phone of all things my kids don’t even know who the rotary phone is anymore. They see it in a museum. But yeah we didn’t I mean we had a black and white TV. So learning how to backtest a trading strategy using excel may not be applicable to today’s markets when using long-term historical data.
BACKTESTING TRADING STRATEGIES FREE
We certainly didn’t have computers. And so there’s no direct access. You know there were no low commissions commissions or high cost me 50 bucks to get in 50 bucks to get out decimalization wasn’t around. There was no mobile devices didn’t even have a computer. Bottom line was trading was slow slow and expensive and therefore chart patterns trended more today. People use all this technology to get in and out of the market real fast. That creates choppier chart patterns.
The patterns today are different than they were back then. Now that’s on the retail side. Now on the professional side you’ve got Elgood trading high frequency trading. It got dark pools. So the speed of what’s going on here in the retail around the professional sites even faster. And so again you get different type of chart patterns than you did in the past so. Add to that, the fact that many traders want to use backtesting trading strategies that are free and well, you get what you pay for!
FREE BACKTESTING
Okay that’s great. Now that all begs the question of all day what do we do. So the first thing to acknowledge is are no certainties in the market. Part of that reason we do free backtesting is we’re looking for some certainty as to what’s going to work in the future. And so acknowledge that there’s always risk in the market. You know back in the days of Jesse Livermore they used to call it speculation. I still prefer the term speculation to trading because it reminds me that there’s always risk in the market.
Here’s how I trade here the principles I use two things. Number one market logic and mathematical logic. So what do I mean by these. Well let’s take emerging market logic first. So I’m referring to the market profile model where the market is seen as an auction place and in an auction place you’re beating on memorabilia and so forth art whatever it might be and that that item that’s going to sell for whatever someone is willing to pay for it.
BEST WAY TO BACKTEST TRADING STRATEGIES
And that’s how the markets work too. We’ve got this global auction place essentially. But the logic of the markets not always logical. Sometimes people pay more than many people would think that a piece of art is worth because they have sentimental connection with that. And the same thing happens in the financial markets. So and we see that with bubbles. We’ve seen it in the real estate bubble recently. Before that we saw in the technology bubble before we even start with tulips. If you go back farther and of tulips of all beings and of course this is what Alan Greenspan referred to is as irrational exuberance.
The market logic is the logic of well logic in quotes of people and psychological studies have shown that people generally. Even though we don’t admit it to ourselves we generally make decisions based on emotion and justify them with logic. And so the market logic is not individual psychology but mass psychology that plays a major role in how markets move. Thus, there may be no best way to backtest trading strategies.
FREE BACKTESTING SOFTWARE
The second part of the larger equation that is the mathematical and got to include this too. Because over half of the shares in the New York Stock Exchange aren’t traded by human beings Well I should say they aren’t. The decisions the trading decisions are made by computer models and some of these don’t really affect you in your trading and you certainly can’t compete against them.
You and I cannot compete against these. You’re not going to get free backtesting software or a forex robot on the Internet for $19 that it is going to compete with Goldman Sachs or Merrill or Bank of America. So here’s what I do. I combine these two types of logic. And the bottom line is that mathematically measuring what the market participants are doing now. So again remember it’s market participants globally and I’m taking a treat now.
I need to know what’s going on in the market right at the second entering the trade. Now what happened you know six months ago 12 months ago 40 years ago I trade in the present bar by bar and manage my risk and then I use indicators to objectively and mathematically measure the money flow in and out of the market. Now that’s what we’re looking for the money.
GET MY FREE MARKET ENTRY TIMING INDICATOR
BTW, if you’re interested in the indicator that I use personally for very precise entries and exits. I’m happy to share that with you. Just send me an email at support@topdogtrading.com, and I’ll show you how to get access to that indicator.
What did you think of this tutorial on backtesting trading strategies? Enter your answer in the COMMENTS section at the bottom of this page.
PLEASE PAY IT FORWARD BY SHARING THIS VIDEO & ARTICLE ON FACEBOOK OR TWITTER by clicking one of the social media share buttons.
FREE GIFT!
Also I’m giving away one of my favorite backtesting trading strategies that works in trading the markets. Just fill out the yellow form at the top of the sidebar on the right. Once you do that, I’ll personally send you an email with first video.
Those interested in the backtesting trading strategies also showed in interest in this video:
http://www.topdogtrading.com/heiken-ashi-strategy-trend-trading-unique-japanese-candlestick-chart-pattern/
Subscribe to my YouTube Channel for notifications when my newest free videos are released by clicking here:
https://www.youtube.com/user/TopDogTrading?sub_confirmation=1