MT4 Strategy Back Test | The Best Forex EA Bot

Alan Solarsh walks through backtesting a forex EA bot on MT4, showing how to test trading strategies and optimize them. He covers the setup process and what the results tell you about whether a strategy actually works.
Chapters
Alan Solosh here, the passive income guru, in this video tutorial explains to you how to do a strategy backtest.
Right? So the first thing you need to do is you need to log into your VPs. So please pause the video, go and log into your VPs. Now, once done, you can come back to this video and resume the video now that you're on your VPS and you can see MT4 open on your screen. And I just want to explain to you that a backtest, basically what it does is it takes history from previous trading results and loads up your strategy to check if the strategy that you're using is profitable or is not profitable. Now, a backtest is not necessarily 100% accurate. It's impossible to to make it 100% accurate due to the leverage and, and the spread that.
Is used. So anything with the result of about 90% accuracy and above is pretty good. Anything less than 90% accuracy is basically a waste of time and you can't use or rely on those results. Okay? So it's quite important for you to do a backtest, a strategy backtest before you start trading with your strategy so that you know with a fair amount of accuracy if your strategy is going to be successful and is going to be profitable. Okay, so I'm going to share with you now exactly how to set up your MT4 that you get an accurate result of 90%, right? So what you need to do is, is you need to click on the View button and then click on where it says Strategy test. So please pause the video, go and do that those steps. Now, once done, you can come back to this video and resume the video. So you'll probably be on the settings page, which is over here. And what you need to do is you need to drop down this menu and you need to select whatever.
Expert Advisor or indicator you're going to be using. If it's an indicator that you're going to be using, just click on the where it says Expert Advisor. Here it'll drop down and will say indicator and then you can choose the indicator that you want to use. We're using an expert advisor. We're using our expert Advisor. So the best forex ea robot. So we're going to click that. So please pause the video, go and choose whatever you want to do the strategy test on and then come back to this video and resume the video. The next step is choose your currency that you want to that you want to test the.
Do a test on. So in my case, I've only got one currency Loaded. So how you would change that is if you just go to your currency section at the top here. Mine's a little bit hidden so I've only got one currency there. So to get more currencies you would just go to symbols and then let's just choose Aud. We can we that's it's highlighted there. So I've double clicked to highlight it and then I'm going to close it and then you can see that AUD shows and when I drop down this menu, if AUD is not there, let's just restart MT4 and then we'll restart. We will get it going again and then it should load that currency. There it is, AUD USD. So you'll need to restart MT4 to show that other currency. So I'm going to do a strategy backtest on Euro US dollar okay. And what I'm going to do is I'm going to do it on a five minute chart. So to change your time frame you can just drop down your menu here and choose whatever time frame you want to choose. I'm going to use a five minute chart. Okay. And then I'm going to choose the date for my strategy test. So I'm going to use this date. I'm going to use the 1st of January 2019 to today's date and I'm going to choose today's date over there. Right. Now that we've done that, this is the critical step that you need to take note of. So please pause the video, go and do those steps. Once done, you can come back to this video and resume the video. So the critical step now is to load the the correct prices from your broker into your MT4 platform. And how you do that is is you click on the F F2 button. Now the F2 button will open up the history center. Okay, so please pause the video, go and click on if to now get to the screen, come back to this video and resume the video. What you need to do is you need to choose the currency that you want to do the currency that you want to download the data for. So in our case I want to download the data for Euro US dollar and I want to do it on the one minute time frame. So please go and choose your currency in the 1 minute time frame, pause the video, go and do that step, come back to this video and resume the video. Right. So the next thing you want to do is you want to click on the download button and then you want to click on the OK button and it'll it'll say yes, you want to overwrite, so click on yes, overwrite and then click on OK again. And you can see that it's downloading and the, the bar was very short that it downloaded. So you actually need to click on the download button again, say okay. And then you can see that the, the information is downloading correctly on the second time. So it's very critical that you do the download twice. Once you've done the download twice, you can click on the X button to close the window. So please pause the video, go and download the data. Now once you, once done, you can come back to this video and resume the video. Cool. So the next thing we want to do is we want to set up the expert advisor.
According to the parameters that you want to, that you want to test. So over here under the testing you can choose your equity. So I'm going to choose US$500 and then under the input section I'm going to choose a lot size. So I'm going to use everything standard as per what the engineers have actually set up rea for. And we're going to do a strategy test to see if, if this strategy is going to yield a profit or fail. Right. So the most important thing to do while when running your strategy test is what we need to do is we need to firstly resize this window. And as you can see here, okay, at the bottom it says equity. Let's leave the equity protector off. And in the bottom here we need to add your license key. Okay, without the license key, the back test can't, can't work. So you need to go and find your license key from the email that I sent you and then paste it into this block provided. Right? So I think pause the video now and go and find your license key. Once you've got your license key, you can copy it and then paste it into that field provided. So go and do that now and you can paste it into that field. Make sure that when you do copy it, there is no space before and no space after the license key. So please pause the video, go do that step. Now once done, you can come back to this video and resume the video. The next step that you want to do is you want to change your lot size to whatever lot size that is recommended. So for medium risk account we recommend a 0.5 lot size. So you for low risk account it is point one and, and for a high risk account it is 1.0. And those lot sizes are based on an account of between $500 and $1,000. Okay, so once you've done your lot size and you've added your, your license key, I recommend that you save your backtest. You'll have to hit the save button twice, once to get out of the field. So let's take you back there. You're in the field there. So you click save, which takes you out of the field and then you click save again to save the preset. Okay. And then you can just save it in this folder, in the state, in the default folder that has come up and you can call it, I'm just going to call it Alan 0.5, no equity protector. And I'm going to put there, my equity is on 5, $500. Okay, so now I know. Okay, so now the next time you want to do a test, all you need to do is you need to click on the load button and, and then you'll choose your.
Your preset that you've saved. So let me cancel this and let's go to the expert advisors and load it and you'll see. Let me do that again. The expert advisors in the bottom here, you'll see that everything has returned back to its default. Okay, because we've canceled the settings. So what we need to do is we need to load the preset and you'll see here the standard is 0.1 and there's no license key. So let's go and load and that preset that we saved. And you'll see that my settings have now been adjusted according to my preset. So it's 0.5 and there's my license key. Please pause the video before you click on the OK button. Please save your preset, give it a name, and then you can come back to the screen and then click on the OK button. So I'm going to click on the OK button and then what I'm going to do is I'm going to do a visual mode. Now if you can't see this visual mode here it means, what it means is, let me show you, is that you just need to.
You see, you're probably looking at it like that or let's do it again like that where you can't see the visual mode. So if you just mouse over, hover over that horizontal line until you get a diagonal line with the two, with the two arrows left mouse click down and then drag that window up and you'll be able to see the visual mode. Now the visual mode is a slower way of doing the strategy back that the back test. And because you're going to see another graph, another chart, another chart window appear in the chart section so that you can actually see the charts in real time. So I'm going to leave this on. I'm going to click it on and then to speed up the test, you can, you can move your slider to maximum and then I'm going to start it. So what's going to happen now after I've started it, you can see here's the, here's the chart that has appeared. It says there euro US$5 minute and you can see that it's doing the backtest live. While we, while we watching it now, you can also check the graph. The graph here will tell you what's happening. Remember, we started on $500, not even January 14th yet and we up and we're already up $2800. So this strategy seems to be working now to speed up the strategy. The, the strategy, what you can do is you can stop the strategy by hitting the, the X okay. On the chart. This will then close their chart and it will stop the strategy, the strategy test. And if you want to speed it up and do it within like 15 seconds, the whole test, you can just uncheck the visual mode and then click on Start and then it'll, you can see here it's actually a hell of a lot quicker. You can go to the graph and you can see the graph is actually a hell of a lot faster than watching the visual mode. So to do it quickly you can just get, to just do that, just switch off the visual, the visual mode section so that you can do the strategy test fast. And then obviously over here in the report section, it will give you the whole report, okay. Of, of what's going, of what is actually what actually happened in that strategy test. So as you can see over here, we had a 90% accuracy. That's the most important part is the accuracy. Okay. The second most important part is the drawdown. That's the amount of capital that was used at any one time to generate the profits that were generated. So 65%. The drawdown is actually quite high. So to get a lower drawdown we would need to reduce the lot size or other parameters which I'll, I'll do for you in the next, in the next strategy test in a moment. So we started on $500 and we made a profit of $26,605. That this is over a period of from January the first to today, which is the 19th of June. So over a six month period, which is, which is excellent. So we know with a fair amount of certainty that this strategy works. Okay, now if you increase the lot size, so let's go and increase the lot size, we're going to increase it to 0.2. Let's make it 1.0. Let's not do that. Let's make it 0.7. Okay, so now we're going to use a bigger lot size and we're going to try to do the strategy test and we're going to see if it actually fails. And it has failed because you can see that the graph, the chart, the progress bar has stopped. So if we look at the chart, you can see that actually failed on day two. So we know now that the lot size that we used was actually not the correct lot size. It was too much. We had over leveraged and the chances of us blowing our account in is pretty high. So using a lot size of 0.7 is not a good idea. So now what, what's great about this is that you don't have to do a six or seven different lots of strategy tests to find the correct lot size. What you can do is you can, you can use the optimization part of, of the strategy backtest. And what that means is you, it will, it will take various different variables and do multiple tests very quickly for you. So how you do that is as follows. Okay, to get many different tests and many different results very quickly Instead of going backwards and forwards, doing, doing the tests over and over again. So let's just run it once and get six or seven different results. So what we're going to do is we're going to check the optimization check mark over there and then we're going to click on the expert advisors. And then over here I'm just going to change the lot size. So I'm going to change the lot size from a 0.01.
Let's do a 0.1 and we're going to increment it at 0.01 and step is 0.01. And then we're going to stop it at 0.0.6. We know that 0.7 fails. So what it's going to do is it's going to start the test, it's going to do a test on 0.01 with all these parameters, see? And then it's going to do another test on zero point, increase the lot size by 0.01. So the next test is going to be 0.02. So this, so the more variables you change, the more tests it's going to be. So this I think is going to be about 70 tests, if I'm not mistaken, or 60 tests. So when I click the start button, okay, it will tell me how many strategy tests it's going to be doing in the bottom left hand corner. So the more variables you change in, the more variables you give it to, to check, then obviously this number will go up. So you don't want to do too many, change too many variables because you know, you, it can only do 10,000, 10,000 tests at any one time. So don't change too many settings that you, you actually can't get an accurate picture. So what I'm going to do is I'm going to pause the video, I'm going to wait for this test to finish, and then I'm going to go through the results with you. Right. So while it's doing its test, as I said, it's there with 60 different variables, 60 different strategies that it's going to test. You can actually see here the optimization results. And here are the different optimization results. As you can see, it started on 0.01 lot size. All the other variables stayed the same. Okay, here's 0.2, 0.3, and it's going up and it's going to go up to a lot size of 60. And over here, this is what we want to see. We want to see the profit and we want to see the drawdown. Okay? And the drawdown is the important part. That's the amount of capital used at any one time. And you want to, like, you want to play it safe. You don't want to use a lot of your capital, but you do want to make a lot of money. So instead of like just using any strategy and just doing this blindly and without any foresight, rather do a strategy test and check what strategy best suits your, your investment style and your risk profile. Okay. So I mean, here is a drawdown of 39%. Some people say that's too high. You know, maybe you only want to risk 21, 20%. But then, you know, if there's the low, the lower your drawdown, the lower your profit is going to be. The higher your drawdown and the higher your lot size, the more profit you're going to make. So yes, a, quite a, quite a good one, which is 33% and you made, you know, you started with $500 and we made a profit of $29,000. So that's. Am I looking. No, that, that's. Sorry, it's, it moved. So let's go Back here. So here's a 33. Here's a 33% which is a 0.05 lot size started with $500 and you made a profit of $12,587 in six months. So that's, that's pretty good. In any anyone's books, I'd say that's pretty good. So I'm going to pause the video and we'll wait for the results and we'll see what kind of profits we can actually make with this. With this ea. Okay, so this, the, the test is finished and let's go back and check the, the, the results. So it ran the test on 60 different strategies and only 15 of the strategies returned results. But three of these strategies. Okay. Or you can't use them because the drawdown was 85% and above. And usually your broker is going to do a margin call at 80%. So I wouldn't use these, I wouldn't use any of these from 11 to and above. I wouldn't use. So 64 is, that's a high risk account which is a lot size of, of 0.1. And this is on a, this is on a capital of $500. So if you actually go back and you change your, your capital to a thousand dollars, obviously and you click ok, obviously and you press start, firstly your results will be voided. Okay. And it'll do a new strategy test on the 60 different strategies that you, you've set in the under the optimization. And your drawdown now will be a hell of a lot less because you've got more capital in your account. So the more capital you've got, the lower your drawdown and obviously the higher profit you will make. So let's wait for the strategy to finish. I'll pause the video now and I'll resume the video when the strategy has completed. Right. So let's go and have a look at the results. We've done six of them and, and you can see here that the drawdown is a hell of a lot less. So previously the drawdown I think was on 33% on a 0.5 and it's dropped to 29% for the same results, 12,587. So here's another one, 39%. You're gonna make $20,508. So even that I would, I would even use that strategy. I would use this strategy as well. 0.09. And let's see what number 10 looks like.
There's number 10. So number 10 is 34% still. I would I could also use lot size of 0.1 and get a result of $26,000. Even 36%. Anything below 50%, I would use. If you've got two accounts, you know, you can run a strategy on one account on medium risk or and on. On another account you can run high risk or third account, you can run a low risk. There's various different ways that you can set up your bot and, you know, and different risk strategies on different accounts, which is what I recommend. Right. So the test is complete. So let's have a look at the optimization results. And as you can see, let's do it in descending order. So we got to. Let's just move this up a little bit. Okay, so here's 50%. I would even, you know, go to 56%. I'd stop at 56%. So 18, anything from 18, and the results after 18, I wouldn't even attempt as it's. It's high risk unless you've got capital.
Aside that you can fund your account to bring down your lot size. Okay, so here are the different strategies that you can utilize, which is great. So you can also check out optimization graph of the different strategies. And.
You can also check out the results here. The different results. And here's the graph. I don't think there'll be anything on it because it's an optimization. It was an optimization, which means that we did multiple different scenarios. So the graph would. Would be null and void and the report would also be null and void. So now you know how to do a number one backtest on a single strategy and number two, a backtest doing multiple strategies. Now to include another variable of your. What you would do is you click on the Modify the expert advisor.
Sorry. Over here you click on the expert properties, you go to the inputs and then you can click on, let's say lot exponent and you can say, start at it, say 0.9. You want to go up at 0.1 and you want to stop at 1.4. So this would probably be 200 or so different strategies. So if we click on the start, it'll now use different. It'll do different lot sizes and it'll do the different that different that other variable that we asked it to check. So as you can see, it's more than that. It's 12, 80 different scenarios. So I'm gonna let it run and I'm gonna pause the video, let it run, and let's see the type of results that we get for changing those two variables. So it did 360 strategy tests out of the 1280 because the others failed and it knew it would fail. So let's go to the optimization report. Let's click on the drawdown in least from lowest drawdown to high straw down. And you can see the different.
The different amounts of money that you could make on a 57%. You could make 46,000. So let's actually do it.
On the, on the, on the profit rather than on the drawdown. So we want to look at the profit and then we want to look at the lowest drawdown. So here's $40,000 profit with a 50% drawdown. Here is, and then obviously it goes, goes down. So here's the best one, which is $40,000 with a exponent of 1.4 and the lot size of 0.15. Okay, so if you want something a little less, a little less risky, then maybe the 48%, which is an exponent of 1.3 and a lot size of 0.17. Or you'll, you'll decide what you want to use on what strategy you want to use. So that's basically now how you do your backtest and your strategy test. And I highly recommend that you use this before you start trading and make sure that the strategy that you have implemented on your live account is going to yield profits rather than losses and you blowing your account. So I hope you enjoyed this video and I'll see you on the next video.
More from Alan

Double bottom forming - Gold ready for $4000 #trading #technicalanalysis #xauusd









