💥 MT4 Strategy Tester | The Backtest That Blew My Mind! 💥

Alan Solarsh backtests his Rule 2 EA on gold using MT4's Strategy Tester, optimizing variables like moving average reversals and money management across 1m, 5m, 15m, and 30m timeframes. He tests a two-month period covering a gold drop and recovery, then filters results by drawdown and trade count to find parameter sets that won't blow accounts.
Chapters
This video tutorial explains to you how to do an optimized backtest. What is an optimized backtest? Basically what it is is we're going to test a strategy over a few different settings. Let me show you how we get to the strategy tester. So you click on View and then you click on Strategy Tester. This is to open up the strategy tester. You should arrive on this page. This is the basic setup stage of the optimization. What you need to do is you need to drop this down and then choose what, what you want to test. Either you want to test an EA or you want to test an indicator. So we want to test the Rule 2 EA, which is already chosen, and then you need to choose what pair you want to be testing. I'm going to be testing on gold. The next thing that you need to do is you need to drop down this and this is the fastest test. Then it goes. If you choose that one, it's a little bit longer. And if you want the most accurate results, you choose that one. But we're just going to choose this one to get a rough idea if the strategy works. This is where you're going to choose your date. So I'm going to choose a date of the 1st of January and I'm going to do it for two months. So the reason I want to do it over January and February is because there was a big drop in gold during January and then it started to recover in February. So I want to see what my drawdown is going to be during that period so that I can get a good indication of whether the strategy is actually going to function well in a bearish market. At the moment, we're only trading gold with the longs, so we want to see how the robot fares in a bearish market. Okay, over here is where you click on the optimization and I'll show you what that's about in the next few minutes. And then I want to check it on a one minute chart. So the robot is going to be trading on a one minute chart. Then over here you can click on the expert advisors. Over here we need to put in your capital that you've got here. So whatever your capital is or your equity, that's the amount of money that you need to put in there, exactly how it's showing on your account. So if you've got a thousand dollars, then it is 100,000 cents. Okay, so we're just going to leave it on 100,000 cents for now and then we're going to click on the inputs and over here with the inputs, you can actually load your current preset. And how you do that is you click on the numbers, you click on MQL4 and then you click on the presets. And then here would be your presets. I'm just going to choose my Allen presets, which is over there. Okay. And then what I'm going to do is I want to test the MA reversal. I want to see which time frame is the best for my MA reversal. All right, so I'm going to only be testing the one MA reversal because I've got multiple MA reversals down here which I'm going to switch off in a few minutes. Now, how you optimize, you need to click and put a tick in one of these checkboxes here. So I want to be testing the MA reversal. All right, Starting on a one minute chart. These are drop down. So if you click it, obviously you get to the drop down. So I want to be testing it, the MA reversal where the second candle opens below the 8 EMA on a one minute chart. And then I want to test it over all the time frames, stopping at four hours. So it's going to basically do four different tests. Then I'm going to just switch off all my other settings. So reduce lots two is off. Reduce lots three is paused. Reduce lots four is also paused. And then deactivate. Reduce lots is true. And we want to deactivate this. We also want to change this to the different time frames. So we want to deactivate it and we want to do it on the 1 minute chart and then we want to deactivate it. We want to test it over the four hour chart. So it's going to be quite a comprehensive test that's going to do it over multiple time frames, the deactivation, not just on one time frame. Okay. I'm going to switch off my hedge functionality as well because I don't want the robot to hedge. So the take profits will be automated. Hedge settings is over here. I want to set this to false. I want to set all my hedge settings to false. I don't want the robot to hedge at all. So I've got multiple different hedge settings which I'm trading with, which I'll share with you as well. Remove hedge. Okay. Remove hedges. Well, there won't be a hedge, so I don't have to worry about that. And then insurance hedge, I'll switch off false. Disable hedging. Okay. My equity protector is off. So I just want to see that my lots that I've chosen is correct before we get started. Right. So we're going to do mm and it's going to be a one lot. Okay. Then I'm going to click on OK at the bottom here we don't need visual mode and we can start the test. So what I'm going to do is I'm going to start the test and explain to you what's going to happen. So it takes a bit of time for the test to actually start at the bottom here. It'll tell you when it's ready, how many tests it's going to do. So I'm just going to pause the video and then we'll resume it in a few minutes. Right. So as you can see, it's going to test 36 different strategies to see the optimization results. You can click over here for the optimization results and then over here the all the results will start populating in rows. So it actually tells you what's going on here. So with the Strategy, over a two month period the robot has made $33. Remember we're working in cents. So we need to move the decimal place to spaces from right to left to get to dollars. So it's $32.42. Okay. Then you can see what the drawdown is on this one it is one, the drawdown is $1.66 and we reducing the lots we reducing on a one minute time frame. So when the second candle opens below the ATM on a one minute time frame, that is when it is activating and it is deactivating also on a one minute time frame. So what we're trying to achie, we are trying to achieve the most amount of profits with the most amount of trades and the lowest drawdown. So why do I say the most amount of trades? And the reason is, is because I want the robot to be opening up a lot of trades so as to give me an opportunity to make more money. Because the test is working in past, it's can't. This is a backtest working on what's happened in the past. It doesn't tell you what's going to happen in the future. So if I'm dollar cost averaging, which is as the robot is trending up, what's happening is, is that it's scalping the market, it's placing buy trades. But when the price starts to retrace or starts to come down, the robot starts to open dollar cost averaging trades. It starts to open up buy trades on the way down. All right. And then when the second candle opens below the atma on a one minute chart, my lot sizes will be reduced and I won't have that much exposure. Okay, if you don't understand this point, then you need to go and watch the video that explains to you about the inputs, the MA reversal in the input section so that you can better understand about the setting that we're trying to strategy test. Okay. So what you can do is you can organize this by your profits, by dropping this down or putting the arrow, just clicking this down arrow or up arrow to order it into the biggest number to the smallest number. Okay. So here you can see that another test has come out successful. We've got a $66 profit with a 3.56% drawdown. So as you can see here, this is a reduce, reduce the lots on a 15 minute time frame and then it deactivates on a one minute time frame. So that's very interesting. And this placed 202 trades. So I think you're getting the picture here. So what I'm going to do is I'm going to pause this test and then I'm going to resume once the results are done. And then we're going to run one more test, which is we're going to test different lot sizes once we find good settings. Right. So we finished the test and as you can see here, that this was the winning Strategy. It's got $66 of profit, 202 trades, and it has a drawdown of 3.56, which is absolutely fabulous. Now what we're going to do is we're going to test it on a different time frame. So we're going to test this the exact same thing on a five minute time frame. But before we do that, what you can do is, okay, you can take the best one and you can say set inputs. Now the robot, okay, the strategy has been saved in the strategy tester in this section over here. So what you can do is you can save this preset as a test, you can call a test, and you can put their test on a one minute chart. And it had $66 profit with a drawdown of, I think it was 3.56%. Okay. And that you can save this as is. So now you know, okay, what happened in that strategy. Alternatively, what you can do is you can just take a screenshot of this and you can just save it. So I'm going to save it in my program, why it hasn't come up there. Okay. And then we can just label this exactly the Same as what we called it. Okay. So it's a one minute chart and it had a profit of. Oh, well, I don't need to. It's just on a one minute chart. Now I know what I was doing. Okay, now what we're going to do is we're going to go back to the strategy test and we're going to change this to a five minute chart. Okay. And then I'm going to open the expert advisor and I'm just going to test. I'm just going to go down and see what my MA reversal is. My reduce lots one is because we're testing the reduced lots, remember? Okay, so we. That is ticked and I think we're testing one more thing. So what we can do now is before we do that, okay, I'm actually going to run another test where I'm going to test the different lot sizes. So over here. So I want to test the different lot sizes. I'm going to check it and then I'm going to start in a 0.03. I want to go up by each. Each test is going to increase by 0.03. Okay. And then I'm going to stop at two lots. Okay. So it's going to run the test and it's going to check different risk settings, different money management settings, as well as the reduced lots that we put in below because we've also got that ticked. So reduce lots one. All right. Over here. And then we're going to click on. Ok. When I click on the start button, it'll take a little bit of time. It'll be a lot more tests, probably 1800 or so tests that it needs to go through 1800 different parameters. So I'm going to pause this and then we can go and check. Maybe it's already started. It has. So I'll pause this and then when it's finished, I'll resume the video. All right, so we can see here that the test has started. What's interesting is this number in the bottom left hand corner. So it says here that there was 2412 tests that the robot could perform. But out of the 2412, only 1280 would be successful. The rest of those would be unsuccessful. It means that you would have blown your account. So this is very interesting. And this is why the strategy tester is such a fantastic tool that you can see exactly what strategies will work, what strategies are going to blow your account and what strategies you don't really want to use. So if we go to the optimization results, we can see here that we've already got results here. But you can see here that we've got a 59.64% drawdown. Now, this would not be a good setting for you to use. So it says here that the risk is 1.92. That is your mm, what the robot is going to use as a calculation to work out your lot sizes. So each trade will open up as 1.92% of your equity. That is high risk. Not a great decision. So this setting we can't use. So we'll just wait for the test to finish and then we can come back and we can see exactly which strategy would be beneficial for us to use to maximize our profits. Right. So the test is complete. 1088 out of the 1280 tests were successful. And we can go through the optimization results and then let's just order it in profit. And as you can see, this setting made $1,072 profit. Well, let's go to the top. Okay. And you can see a 62% drawdown. So all of these results, it's just high risk. I wouldn't be trading that. I need to be looking for a lower risk, a lower drawdown, something below 10% with a nice profit. So let's actually do this in drawdown from the bottom and we can go to, let's say the 10% values and can start seeing what is worthwhile here. Okay, so here we go. Actually, 3 to 5% drawdown, max drawdown. That's looking good. Okay. With high trade volume, $185 profit. So you can see here, like, I mean, even if you went to this one over here, it's a $5 drawdown and $105 profit. So you need to decide which one you want to run. Okay. Once you've chosen a strategy, you can then decide to. So let's, let's choose a strategy here. Let's choose this $150 one over here. All right. It's a risk of 18 lots, which is fair. So we're not going to be using like a high lot size of 0.27. It's a little bit less, and we make a few dollars less per month. So we set the parameters, we set the inputs. Then we can change the time frame to a different time frame. All right? And we're going to run the test again and we're going to see what results happen on a five minute time frame and see if we can get better results, see if we can find better profits. Lower drawdown, and I'll resume the Video once we've got answers on the test. Now we've completed the test on the five minute chart. So the robot would be sitting on a five minute chart. And now we can organize our data and you can see at 36% on the five minute chart, we can scroll down. Let's rather organize it in, in order. You can see here that we've got here a 4.66% drawdown with a lot size of 0.24. It's not bad. And you've made $218 profit, which is brilliant with 256 trades, which is absolutely phenomenal. So I want to try and see if we can find the same sort of profit with a lower risk. But I mean this is fantastic. That one over there. So let's, let's save that one, let's save the inputs. And now we're going to try it on a 15 minute chart and we're going to rerun the test.
Now we've run the test on a 15 minute chart and we go to the optimization results. We can just do it in drawdown. We could scroll down to where we've got like a 3 to 5, 5% drawdown. Something good there. There we go. Look at that. 18 risk of 18, $122. 186 trades. Very good. If we go up a little bit, I mean we can just increase it over here a 0.3. It's quite a high risk setting there. Just remember that this is going to be trading on one chart. So if you're going to be using these settings on a 15 and 30 minute chart, on two charts and then another 15 and 30 over the other two charts, then you need to add an extra, extra, let's say 10% drawdown. And I would be very careful with your lot sizes. Okay, so this looks very good. Let's set this up as a default. Set it as a default. And now we can run this on a 30 minute chart and we can see what the results are. We've run the test on the 30 minute chart. Let's check out the optimization. Let's put this in order of drawdown. And now you can start seeing the value of what we're trying to achieve here. So here again, $214 profit, 0.45 risk drawdown of 5.73. Absolutely amazing. So now I think you can start seeing the value of the strategy tester. Now what I'm finding is, is that most people that start the robot, that use the robot, they don't use this tool. What they're doing is they use the presets that I've supplied and then they rely on that. I don't recommend that you do that. I recommend that you go through the strategy tester, find settings, tweak your robot so that you can better understand how the robot's working, and you could probably increase your, your profitability, which is the ultimate and the end game. And that's what we're trying to achieve here. So I hope that you found this video interesting and if you want more insight into this, you can ask on the EA Strategies group and, and we'll answer your questions there. I'll see you on my next video.
More from Alan

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









