# has anyone found a way to test all combinations of moving averages?

926

if i want to develop a system with 20 different moving averages, that goes from 2 to 20 periods, and try to find the best configuration, i have to

try  at least aprox  10 500 000 000 000 000 000 000 000 different possibilities or i'm wrong? The fastest supercomputer today

calculate only around 100 quadrillions operations per second, so he would take years to calculate all these possibilities,

my question is:1- there is a way to test all these possibilites using some kind of approximation that really works, or it's impossible? 2- if it's impossible how can one say that moving averages

doesnt work, if its impossible to test all combinations of even small periods? 3- what's the best way to think in create systems if you deal with so big numbers?

2155

mrluck1:

if i want to develop a system with 20 different moving averages, that goes from 2 to 20 periods, and try to find the best configuration, i have to

try  at least aprox  10 500 000 000 000 000 000 000 000 different possibilities or i'm wrong? The fastest supercomputer today

calculate only around 100 quadrillions operations per second, so he would take years to calculate all these possibilities,

my question is:1- there is a way to test all these possibilites using some kind of approximation that really works, or it's impossible? 2- if it's impossible how can one say that moving averages

doesnt work, if its impossible to test all combinations of even small periods? 3- what's the best way to think in create systems if you deal with so big numbers?

You can buy MQL5 cloud network to speed up the backtest process.

However, it does not mean it will be profitable in the future even if you manage to find a combination that works because you are basically curve fitting it. Given the amount of possible combination, some of them will definitely make good money.

Infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare (source: wikipedia). If some signal providers who use tens or hundred of accounts with different indicator settings can eventually find one of them making big money hence selling as a signal, then you could definitely find some of your MA combinations making big money too.

Just like given enough number of people playing slot machines, some of them will eventually hit a jackpot. But that does not mean they found a way to hit a jackpot and keep repeating it. They are just lucky.

Distributed Computing in the MQL5 Cloud Network
• cloud.mql5.com
Connect to the MQL5 Cloud Network (Cloud Computing) and earn extra income around the clock — there is much work for you computer!
17943

mrluck1:

if i want to develop a system with 20 different moving averages, that goes from 2 to 20 periods, and try to find the best configuration, i have to

try  at least aprox  10 500 000 000 000 000 000 000 000 different possibilities or i'm wrong?

Yes you are. Use the value of 21 for invalid and return INIT_SUCCEEDED only if Ma1 < MA2 and MA2< MA3 ignoring all that are invalid. It makes no sense to test MA2=2 and MA3=3 and then test MA2=3 and MA3=2. Nor does it make sense to use the same period for both.

36058

mrluck1:...

2- if it's impossible how can one say that moving averages doesnt work, if its impossible to test all combinations of even small periods?

You don't need to test all combinations, you need to think. A moving average is a lagging indicator, it can work sometimes, sometimes not, it will never say anything about the future.

926

whroeder1:

Yes you are. Use the value of 21 for invalid and return INIT_SUCCEEDED only if Ma1 < MA2 and MA2< MA3 ignoring all that are invalid. It makes no sense to test MA2=2 and MA3=3 and then test MA2=3 and MA3=2. Nor does it make sense to use the same period for both.

yes i see what you mean, so its easy to test on this hipothesis
1220

Alain Verleyen:

You don't need to test all combinations, you need to think. A moving average is a lagging indicator, it can work sometimes, sometimes not, it will never say anything about the future.

To add to what Alain said, the difference between all those moving averages is not so big. If 15 works, then 13,14 and 16 and 17 will work too. And even wider than that.

And if you find one that worked more in the past, it says absolutely nothing !!!

But, you can always try to build a super-computer for your private needs.
2709

What do you mean by best configuration? I hope that it is not doing combinatorial search over 20 different moving average parameter values and then pick the parameter set that results best profits. Why? Because that way you get parameter set that is curve fitted to test data and doesn't work in real time trading.

It is important to note that optimization parameters (in this case 20 different moving averages? + something else?) that produce best profits on past data,
don’t necessarily produce good results in real time trading. This is because price data (that MAY contain repeatable price dynamics that is predictable),  contains random price movement that is called noise. And optimization process curve fits BOTH price dynamics AND noise. But noise is not predictable because it is random. That is why there is no point to check all possible parameter combinations. What you really are looking for is repeatable price dynamic that cuold be traded profitable.

I don’t know how you apply those moving averages but do you really need 20 moving averages? Try to change algorithm so that only couple of averages are needed. That way you much reduce risk of falling in curve fitting trap. And you shoud divide your testing period in in-sample and out-of-sample periods (that is, use walk forwad optimization). And when you optimimize on in-sample period, do not test all possible combinations; for example for parameter1 test values 2, 4, 6, 8, etc., for parameter2 values 3, 6, 9 and so on.

1220

to the OP, If you want to make some kind of equivallent to this question, then it is like asking how should I forecast the rate of the world's population growth this year based on the EXACT moving average of it's growth in the last 20 years. You can calculate with all super computers together, and there is one moving average that happened to be the most fitted one for the last 20 years, but still you can't tell what the rate of population growth will be this year.
926

Amir Yacoby:
to the OP, If you want to make some kind of equivallent to this question, then it is like asking how should I forecast the rate of the world's population growth this year based on the EXACT moving average of it's growth in the last 20 years. You can calculate with all super computers together, and there is one moving average that happened to be the most fitted one for the last 20 years, but still you can't tell what the rate of population growth will be this year.

lets rephrase my question, if 1 moving average consists of average of 20 moving averages, and you have 20 of them, with periods from 1 to 20, them you have to test 10 ^ 24 different possibilities, because it's 20x20 twenty times. So a top  supercomputer in the world, to backtest the best moving average by brute force would take decades, then  i question: how can someone could say you can't predict the future, if you can't test all possibilities, what if some special configuration has 99% accuracy, if you cant try all them?

1220

mrluck1:

lets rephrase my question, if 1 moving average consists of average of 20 moving averages, and you have 20 of them, with periods from 1 to 20, them you have to test 10 ^ 24 different possibilities, because it's 20x20 twenty times. So a top  supercomputer in the world, to backtest the best moving average by brute force would take decades, then  i question: how can someone could say you can't predict the future, if you can't test all possibilities, what if some special configuration has 99% accuracy, if you cant try all them?

Because I understand the logic behind a moving average, understanding saves a lot of supercomputer time. And the logic is to average what happened in a specific period in history. But as the name implies, it is a moving average. It moves with time, sometimes higher, sometimes lower. You should provide evidence that moving average has some value to predict the future, because I don't see any.

Why don't you test all these moving averages on a period of one day and that's it? If you are right, then the moving average would be the same on one day and the whole history.
Or take one week. Or one month, one year. Just see that whenever you add a period, the moving averages change. This is enough proof to tell you that it's nonesense even if you add it to 20 years.

You know the story of the supercomputer that worked for years on the question of what is the meaning of life? The answer it gave was 7 (I guess it calculated moving averages).