Alexandre Sousa Bezerra
Alexandre Sousa Bezerra
  • Information
2 Jahre
Erfahrung
0
Produkte
0
Demoversionen
0
Jobs
1
Signale
0
Abonnenten
CEO in Indra.Ventures
Market Trader + Statistician + Programmer = Algotrader.
Alexandre Sousa Bezerra
Alexandre Sousa Bezerra
>> Por que os EAs falham em conta real? Vai aqui uma dica muito importante, mas ignorada por quase 100% dos usuários do MetaTrader <<

Você já se perguntou porque a grande maioria dos EAs apresentam um backtest fantástico, desempenham muito bem na conta Demo, mas falham em contas reais, não é mesmo?

Há várias razões para isso, mas há duas muito importantes que podemos destacar:

1. Estudo estatístico pobre ou errado: já abordei esse ponto aqui no Fórum. Primeiro de tudo, temos que deixar bem claro que o MetaTrader não disponibiliza ferramentas suficientes para realizar uma análise estatística completa, ok? Qualquer ser humano com conhecimentos básicos dessa matéria não consegue tirar conclusões de indicadores como "Balanço Máximo", "Fator de Lucro", "Índice de Sharpe", "Rebaixamento Máximo" etc. Lógico que tais números são úteis, mas somente quando estamos avaliando um estudo estatístico que REALMENTE se provou adequado.

Antes de partirmos para análise desses números, é necessário realizar um estudo estatístico verdadeiro, que passa pela análise de distribuição de probabilidades (Normal, Weibull etc), com tratamento de dados, verificação de outliers, checagem do desvio padrão, VAR etc. Por acaso, vocês já viram alguma ferramenta aqui no MT5 que aborda isso? Certamente que não, e há um motivo para isso que não vou abordar aqui senão meu post sairá de cena...

Sem tais análises, não importa o tamanho do histórico do backtest. Ele pode ter bilhões de trades, backtest com 100% de acerto e, ainda assim, fadar ao fracasso. Há um paradoxo que fala do vencedor do campeonato mundial de par ou ímpar às cegas que, após vencer bilhões de vezes na competição, continua tendo apenas 50% de chance de vitória após receber o troféu. Ou seja, você pode encontrar um EA lindo, mas ele pode te levar ao prejuízo logo após a sua compra.

Não quero entrar nesse assunto, já abordei esse ponto nesse post e talvez ele te ajude a explicar melhor: https://www.mql5.com/en/forum/389324

Vamos à segunda razão.

2. Taxas, comissões e spreads da corretora não são considerados nos backtests: vamos supor que você encontrou um EA realmente bom, com um estudo estatístico completo e correto. Ele realmente desempenha bem na conta Demo com o mesmo comportamento previsto pelo desenvolvedor. Você fica louco de felicidade, "finalmente encontrei um EA que vai me deixar rico", então paga US 1.000 e começa a perder dinheiro na conta Real... frustrante.

Muitas vezes, repito, MUITAs vezes, o desenvolvedor publica o resultado sem as comissões e spreads. Dá para entender o motivo, afinal, ele não sabe quais são os custos das corretoras de cada cliente que compra o EA. Por outro lado, há formas de incorporar isso de forma conservadora para que os resultados do Testador de Estratégia sejam mais aderentes à realidade, mas não o fazem. Por que?

Bom, seja qual for o motivo, vejo que o Metatrader também não disponibiliza conteúdos para este assunto. Há algumas discussões no fórum, muito pobres, há desenvolvedores que respondem perguntas, muito rabugentos, e há também um desconhecimento geral. E quem ganha com isso, bom, de propósito ou não, os Desenvolvedores e também o MetaTrader. Quem perde? Você, o pagador!

Vamos falar de forma prática:

Você tem encontrou um EA fantástico:

* Capital inicial: USD 1.000;

* Histórico Total (100% de qualidade): 2 anos;

* Total de trades: 1.000;

* HitRate (Trades com acertos/Total de Trades): 80%, logo, 800 trades que tiveram TP;

* TP = 2%

* SL = 3%

==> Balanço Máximo = USD 1.000 * (1.000*(80%)*2% - 1.000*(1-80%)*3%) = USD 10.000. Portanto, você investiu apenas 1.000 e teve um resultado de 10.000 em apenas 2 anos. Sensacionais 10% de rentabilidade ao MÊS!!!

Agora, vamos incluir a comissão da corretora. Não vou considerar spread, apesar da maioria cobrar (exceto ECNs verdadeiros), pois quero simplificar o problema:

==> Balanço Máximo = USD 1.000 * (1.000*(80%)*(2% - 2*0,5%) - 1.000*(1-80%)*(3% + 2*0,5%)) = USD 0,000000000000000. Logo, vc desperdiça 2 anos da sua vida operando um EA "fantástico" para ganhar nada.

Pois bem, uma comissão pequena de apenas 0,5% por trade destruiu um EA que parecia fantástico. Se fossem TP=1,5% e SL=2%, o balanço iria para o campo negativo a -2.000. E se a comissão fosse maior então ou houvesse cobrança de spread? Daí nem se fala, difícil encontrar um cenário com lucro.

----------------

Eu resolvi postar esse texto porque caí na realidade há pouco tempo. Sempre foquei nas análises estatísticas, pois tenho um certo domínio, mas percebi que não era suficiente... foi que, por sorte, encontrei um comentário singelo a respeito e resolvi explorar.

Portanto, antes de comprar um EA, se informe sobre as taxas da sua corretora e faça essa conta simples. Se o resultado não ficar satisfatório, nem perca tempo, parta para outro EA.

Espero que ajude.

Boa sorte e bons trades.
maubpro
maubpro 2023.06.12
Boa tarde Alexandre, como vc está mandando a MqlTradeRequest: para a Corretora Clear?
Alexandre Sousa Bezerra
Alexandre Sousa Bezerra
WIN$N/WDO$N muito lentos no testador de estratégia? Segue aqui uma possível solução simples:

Muitos aqui já devem ter enfrentado esse problema ao testar a estratégia do WIN$N e WDO$N (ou @) em períodos muito longos. Tive conhecimento que isso depende de corretora para corretora, mas, no meu caso, corretora Clear, esse é um problema real e frustrante... Leva horas e até muitas madrugadas para encontrar um setup de parâmetros que seja adequado e já cheguei a culpar o meu código achando que tinha algo errado.

Cheguei a publicar tópicos aqui e ninguém conseguiu esclarecer. Os poucos que responderam de forma solícita atribuiram a culpa ao meu código e outros já sugeriram eu criarar um Símbolo customizado. Ações que eu já tentei e que eu asseguro que não são as razões para o problema.

Foi então que eu testei, sem querer, a opção "Somente Abertura de Preços"... eu já sabia dessa opção, mas nunca tentei porque o meu EA está configurado para operar Fechamento de Preços. Pois bem, testei sem querer e então foi que eu descobri que ele fica muito rápido, tão rápido quanto testar ativos Forex.

Os resultados diferem um pouco da alternativa "Cada Tick". Se pensarmos bem, a diferença tem que ser pequena mesmo, pois a abertura do candle atual tem que ser próxima do fechamento do candle anterior. É um pequeno "prejuízo" que eu aceito diante da velocidade que eu obtive usando a opção "Somente Abertura de Preços". Ficou tão rápido que agora eu faço testes com históricos de 2016 em diante sem problemas. Depois de configurados os meus parâmetros, eu testo novamente com "Cada Tick" para ver se está aderente. Normalmente fica sim.

Logicamente, isso depende do histórico que a corretora disponibiliza para o MT5. No meu caso, e de muitos outros aqui, a Clear disponibiliza de tal forma que fica extremamente lento para "Cada Tick".

Talvez isso não se aplique a você, mas vale a pena o teste!

Boa sorte e bons trades!
Alexandre Sousa Bezerra
Alexandre Sousa Bezerra
Have you ever played Odd or Even games blinded?

Odd or Even is a silly game that we're used to play over our entire lifetime, most common in your childhood and useful in many situations. If you assume a fair play, it becomes a trully lucky game, besides few people may say there are "techniques" to increase the chance of success... that is why a blind game comes to assure it will be nothing but a lucky game.

Imagine a championship with all living human being around the world, 6 billions or more, all of them blinded and certainly assuming a fair play from the first to the last match that will decide the world champion. How many times the winner has play to get the trophy? Doesn't matter how many matches he overcomes, in all of them he has to win, cause there must be a winner.

In an All-Play-All (round-robin) tournament with 6 billion players, the winner must play 5.999.999.999 times! The 2nd, 3rd, 4th.... 1000th must also win billion times. We could go further, for instance to 1.000.000th player, he also needs to win million times. It is interesting how many incredible lucky players this hipotetical silly game would reveal. And even more insteresting is that the winner has the same chance of loosing the next game than the last place in this tournament.



Now, let's come back to MQL5.

When you see a great EA, with a perfect profit curve, without any losses, going straight to the top of the Everest, do you believe it is really reliable? Or you just found an Odd or Even world champion? Winning 5.999.999.999 times doesn't mean the EA will win again the next game. This is exactly what we see here when test the "best" EA in live account.

So, how to avoid such risk of choosing a bad EA? Well, there is no way at all! This is a PARADOX that any person is subjected to. Neither Warren Buffet can scape of this, cause he can also be an Odd or Even winner. Actually, he is still far far far far away of being a world champion of such game cause the 1st should win 6 billion times without any loss.

This Paradox brings us a curious approach to the market: are the 1.000th richest stock market investors the top 1.000 players in the Even or Odd world tournament? Or they can really predict the market? All I know is that statistics can give us a wrong answer.

It is so true that if you use statistics to predict the next game of the winner of Odd or Even game based on 6 billion winning matches, you will have only 50% of chance to succeed…

Therefore, always when you find a famous investor or fantastic EA, ask yourself: is it an Odd or Even great player?
Tan Ek Kun
Tan Ek Kun 2022.03.05
Yes. You are right. Moreover, if you look closer on forex pair to pair, you know the connectivity of forex pair is multiplication. There are predictable trend pattern for each combination of 3 currency pair. There are 9 patterns. The chance of predict the trend is even less than the 50% chance.
Alexandre Sousa Bezerra
Alexandre Sousa Bezerra
HOW TO CHOOSE A GOOD EA - A PRACTICAL WAY

People just think that a good backtest, excelent winning rate and many other indicators of Tester are enough.

However, the most important thing here (I mean in the entire MQL5) is not even discussed or worried about. Which is strongly related to the most common question in this Forum: why most of EA fails in live trades? The answer is quite simple, but ignored: most of them doen't take into consideration a proper statistical analysis.

You may think the backtest report when is good is enough, but it is not good at all!! It doen't provide all answer you need. And here, I also complain to MQL5 cause a lack of data is actually worse than NO data: no data leads you to study more, worse data may confuse you.

Trully, there are infinite equations that fit well to a cloud of points or, on the other hands, show profitable results in backtest. Some of them are really good on pictures, others go up and down consistently and others just go down. The developers, when decide to sale an EA, just choose the good looking one and ignore the others... and the buyer simply believe, cause he runs the same "cloud of points" in Tester and get same result.

---

Think of climbing a hill: there are many ways to do it: with or without tools, with or without good shoes, running, jumping, crowling. You can be fat, skinny, bodybuilder, child or adult... The difference between all of them is how much time and energy it takes from you. And how is the chance of failure.

Earning money with EA is just the same: you have a mountain of profits to climb and specific conditions to be on top. How will you do this? With great tools? (indicators), with good shoes, climbling rope and hat(protection), running? (frequency)? Some EAs go straight to the top like a falcon, others go up all around the mountain with very low inclination and most part falls into abysm in between...

OK, let's focus on the "best one", those ones that looks good, the falcons: 500 trades, no losses, exponential profit growth. Fantastic. Purchase price >= USD 1.000.

Have you ever got noticed of someone that climbed Hollywood hills in 10 minutes running fast? Probably yes. Do you believe he's prepared to climb Everest? If someone who climbed Hollywoods and tries just after Everest, will likely dies on camp base... You can make same comparison between Mont Blanc and Everest. One doesnt prepare you to another.

If you consider all professional climbers that succeeded in Mont Blanc and tried Everest just after, I guess 10% succeeded again. These are the EAs that MAYBE work in real time. I mean MAYBE because part of them might dies on the top of Everest.

There are infinite paths, climbers, amateurs, tools, indicators (and its combinations) that fit perfectly well onto a mountain of profits (backtest) but fail in the next step (live trading). Only statistics can identify which one will leads to real profit with a high probability. MQL5 doens't help you to choose, cause as many time you try to find it, as much time you waste/$$ and as much money MQL5 wins.

How to find a good EA so? Is it possible to do it through backtest? Yes it is!

---

1. First thing: keep in mind that YOU HAVE TO USE EXCEL to help you to do it;

2. You need to run Tester considering all parameters all together, at same time, with a WIDE RANGE, from the bottom to the top level. For instance: if you have a parameter that vary from 0 to 100, consider it. If you have 100 parameters with same range, consider it too all together in same Test. It will take a lot of time, but certainly less than trying in real time for months loosing money.

3. Export all gererated data to Excel;

4. Create a gaussian normal distribution or a histogram. If it is smooth (https://en.wikipedia.org/wiki/Normal_distribution), than you got a good EA and the median offers you a good combination of parameters. If not, maybe cracked, certainly it is a fake EA. Also, 90% of entire distribution must be with positive results, it meas you have 90% of probability to earn money with this EA. Finally, the median must be high, cause you want to earn a lot of money, right?

5. Suposing you found a smooth distribution, get the combination of parameters and come back to MQL5. Run backtest and see how it looks like. How many trades per week you found? What is the Profit Factor, Positive Hit Rate, Drawndown etc. Must also be good.

6. Come back to the first step and start over again, but now with a forward test with 30% of all history. Did you find quite similar parameters? Yes? Than you have a good EA with a good probability of success.

7. Try in real account, the shape of profit curve and behavior should be alike to the backtest.

---

This is a practical sequence of tests, there are many technical concepts behind. There are other ways to test, but this one will reduce the chance of failure.

Hope it helps you (and sorry all guys for my bad english).

Alexandre
Alexandre Sousa Bezerra
Hat sich auf MQL5.community registriert