Backtesting

Which parameters for Simple Moving averages crossover to choose?


or how can changing of a moving average’s period parameter by 5 can make you profitable strategy a losing one.

If you have ever tried to back test Forex strategies based on indicators then certainly, you stumbled upon one of the most common problems: which parameter of the indicator to select in order to maximize your profits.

We have tested the 2 Simple Moving averages crossover on a randomly chosen broker, currency pair and data and received the following results of the testing:


Net profit SMA1 period SMA2 period Max drawdown
263.39 20 40 875.57
104.22 21 40 706.98
56.29 22 40 908.61
11.08 23 40 770.03
-39.7 24 40 1110.66
-66.91 25 40 954.39
-72.95 20 41 792.38
-75.91 21 41 1051.76
-80.48 22 41 1060.23
-88.05 23 41 808.96
-97.25 24 41 816.58
-98.16 25 41 1117.63
-113.08 20 42 844.78
-115.88 21 42 765.51
-128.25 22 42 1029.5
-133.61 23 42 936.16
-188.15 24 42 1031.7
-215.53 25 42 970.38
-244.75 20 43 840.69
-259.38 21 43 978.19
-264.68 22 43 758.11
-271.25 23 43 823.98
-282.35 24 43 793.79
-288.31 25 43 1192.23
-290.33 20 44 884.17
-293.65 21 44 795.09
-295.23 22 44 782.37
-311.21 23 44 834.24
-295.14 24 44 851.18
-344.85 25 44 1011.18
-357.23 20 45 1090.45
-373.6 21 45 836.31
-404.98 22 45 902.2
-413.38 23 45 1042.68
-502.85 24 45 1167.32
-517.71 25 45 1151.48
-617.04 20 45 1150.39

This strategy is a well-known one on the Internet but no one suggests which parameters a trader should choose for a profitable trading. This table shows that you can’t choose just random parameters because it will affect your trading significantly. Does this table mean that you need to choose the “20” and “40” parameters for your Simple moving averages? Of course not and we do not suggest you to do this. These parameters were working on GBPUSD currency pairs on 155 random days on the Forexite broker. The results may vary a lot depending on the currency pair, period and broker. So what is the solution?

Make your own research

I assume that you already have Forex Tester 2 installed on your computer. If no, please visit this page: www.forextester.com/download. There you will be able to download the free trial of the software in just one click.

Go to the “Tools → Strategies list” menu the “List of strategies” and then check the SimpleSMA checkbox. Double click on the strategy’s string and make sure that the timeframe value in the pop-up window is just the same as the current timeframe as well as the currency pair in the setup window is the same with the symbol you will test you strategy on. If it is not, then select the necessary one from the dropdown list here and click “Apply”. Close the window and go to the “Testing → Enable Strategy execution” menu, and start the test.

When you unpause the button and go on with the test you will notice that trades will be open on their own. Let’s take a look from where all those trades come. In our “Strategies list” setting, we can see that the SMA parameters are set to “16” and “32”. Let’s draw these lines in order to get some visual comprehending.

How to back test a trading strategy

As you see now, the trades were open just when the red moving average (the one with the period of 16) crossed the blue moving average (the one with the period of 32). When the red line crossed the blue one upside down, the sell order was opened automatically. When the red Moving average crossed the blue one upwards, the buy order was opened.

Strategy optimizer for simulation (Forex)

There is a wonderful tool within the Forex Tester that is called the “Strategy optimizer”. It allows to back test tons of different parameters of the same indicator in a really fast and easy way. Let me show you how it works: select “Tools-> Strategy optimizer” and you will see this window. Choose the “SimpleSMA” strategy in a dropdown list, go to the “Test options” and change the SMAs’ periods. Let’s say we want to know which parameter brings the biggest profit from 20 to 25 for the red SMA and from 40 to 45 for the blue SMA.

We need to go to the “Test options” and select the “Strategy parameters” tab. There you can set 20, 1, 25 parameters for the first moving average and 40,1,45 parameters for the second line. These parameters mean that Forex Tester will begin with testing the 20 and 40 moving averages, then switch to 21 and 40, 22 and 40 until it reaches 25 and 45. At the end of the test we will export results to MS Excel or csv file and take a look, which parameters gave the best result.

The most important column of the entire file is the N column that stands for the “Net profit”. At the end of the day, the only thing that matters is whether you earned money or not. That is why all other columns are not that important. Let’s sort the values in this file from largest to smallest. We now see that on this currency pair, on this broker and on this period of time of 155 random historical days, the biggest profit gave the 20 and 40 parameters of SMAs – the total net profit is 263 dollars. In fact, out of 37 different results that we’ve tested, only 4 of them gave a positive result. Do you see now how powerful this feature is: 20 and 40 values will provide you with $263 profit and changing the first value from 20 to 23 would make you earn just $11. Simple changing of the parameter of one Moving average by 3 would make you lose all of your profit. Let’s go even further and notice this fascinating thing: what if you do not change the first MA and change the value of the 2nd line from 40 to 45? You will end up with -$617 on your deposit.

Now, when you see how important it is to set the right parameters of the indicators for any strategy, when you understand that back testing is a must for a profitable trading you can find your own parameters. Please do not try to use the 20 and 40 parameters as those that perfectly match – they matched on this particular broker, on GBPUSD currency pair and on this time period of 155 random days. Use Forex Tester instead and make your own research.

Subscribe for our updates and get a 10% discount on Forex Tester
X
Comprehending Forex analysis with the Forex charting software Forex Copier 2 - software for copying trades between MT4 accounts A Forex currency trading simulator and yet another market analysis tool Software that opens trades in a fraction of a second with a built-in risk management calculator.
Forex
Tester
Forex
Copier 2
Forex
Smart Tools
Forex Speed Up
(free)

Forex Tester is a software that simulates trading in the Forex market, so you can learn how to trade profitably, create, test and refine your strategy for manual and automatic trading.

Software to copy trades between MT4 accounts. Supports all brokers, has plenty of features such as Lot/Risk Management, Filtering trades and Reverse Trading, Lifetime Support.

We'll help you become intelligent Money Managers and gain you entry into the elite group that actually makes money trading Forex.

Software that opens trades in a fraction of a second with a built-in risk management calculator. Set predefined Stop Loss & Take Profit values for instant entries. Compatible with Forex Tester and MT4.

More info More info More info More info