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.
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.
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.
Good comments so far, I want yet add:
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.
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?