Download MetaTrader 5

thankfull holy grail

To add comments, please log in or register
Gabriel Mejia
Gabriel Mejia  
I present you guys.... the holy grail......tataaaaa

no...just joking. this is a crappy EA that converts 900 USD into 4.000.000 USD in about 5 years in testing. EURUSD 5 min.

its a Martingale EA. 

Obviously  I know that this is imposible.  And test results dosen´t mean anything.   forward testing with a live account is needed.  But as an intelectual exercise I want to understand the reason it produces those results on backtesting. I want to understand what is the mistake done by the code or by metatrader history data  that produce this kind of results. This EA works on EURUSD 5 minutes everythick. Can you guys please educate me where is the catch. This code was writen by me but those are not the results I was expecting. As a matter of fact, I was just doing a intelectua excecise when I writed the code.  

The history data was dawnloaded from I downloaded de 1M information for EURUSD (5 years of data) since 2010 and then used the periodconverter script to generate all the timeframes (M1,M5,M30,H4)


Someone can help me to find the error and how is it generated?.


(I suspect is a problem with the history data) 



                                                                       Strategy Tester Report

ETXCapital-Live2 Server (Build 910)

SímboloEURUSD (Euro vs US Dollar)
Período4 horas (H4) 2010.10.06 00:00 - 2015.11.27 20:00 (2010.10.06 - 2015.11.28)
ModeloCada tick (el método más preciso basado en todos los períodos menores disponibles)
Parámetrosprecio_entrada_largo=0; precio_entrada_corto=0; volatilidad=1; riesgo=3; max_perdidas_consecutivas=1; val=101; alturaMacd=0.0004; promedio_ganancia_macd=0; activatendencia=1; tipo_metodo="Metodo_convencional"; tipo_sistema="Directo"; distancia=110; s1=9; s2=3; s3=3; m1=1642; m2=50; metodo=0;
Barras en la prueba7365Ticks modelados28234174Calidad del modeladon/a
Errores de gráficos mal agrupados666247
Depósito inicial600.00Diferencial16
Beneficio neto total317964.93Beneficio bruto341797.33Pérdida bruta-23832.40
Factor de beneficio14.34Rentabilidad esperada27.62
Disminución absoluta0.00Disminución maximal5080.20 (2.30%)Disminución relativa11.07% (1382.57)
Total de operaciones11512Posiciones cortas (ganado %)11478 (99.77%)Posiciones largas (ganado %)34 (55.88%)
Operaciones de beneficios (% del total)11471 (99.64%)Operaciones de pérdidas (% del total)41 (0.36%)
MayorOperaciones de beneficios2038.56Operaciones de pérdidas-2936.00
MediaOperaciones de beneficios29.80Operaciones de pérdidas-581.28
Máximoganancias consecutivas (beneficios en dinero)2090 (46549.95)pérdidas consecutivas (pérdidas en dinero)5 (-1687.55)
Máximobeneficios consecutivos (número de ganancias)52640.00 (672)pérdidas consecutivas (número de pérdidas)-2936.00 (1)
Mediaganancias consecutivas441pérdidas consecutivas2

thankfull.mq4 32 kb
Carl Schreiber
Carl Schreiber  

ahem - were you asking what is the mistake because your EA is so successful?

In your case it might just because you have chosen a 'lucky' data window!

Do you see the first big volume peak between 3882 and 4360? Start your EA right before that peak! I guess your account will be wiped out!

One advice if you close a bunch of orders one by one - you HAVE to count down!

// wrong way: for(cnt6 = 0; cnt6 < abiertas_este_activo6; cnt6++) {
for(cnt6 = abiertas_este_activo6-1; cnt6>=0 ; cnt6--) {
   if ( !OrderSelect(cnt6, SELECT_BY_POS)) { Alert("???"); continue; } // check the outcome of the functions!!
   if(OrderType() == OP_SELL) {
        Alert("cerrando 3");
   if(OrderType() == OP_BUY){ 
        Alert("cerrando 4");

BTW for historic data you can use "Tickstory Lite" or Birt's "Earview" sccript or "Strategy Quant's Tickdownloader" (google)


I think you did not made a each tick backtest, on M5

7365    Ticks modelados 28234174        Calidad del modelado    n/a

Período4 horas (H4) 

It would have been too long to backtest several years tick  by tick

The tick by tick backtest is usefull for scalper, but for other stategies like M5 strategie, M1 Bars are ok, and the data from  metatrader are sufficient.


edit :

ok this is the problem, i don't know what's the origin of it

Errores de gráficos mal agrupados       666247
Doerk Hilger
Doerk Hilger  

Normally an unadjusted martingale does not even survive a year, assuming you´re doubling at every percent of the underlying symbol, e.g. in EURUSD you´d double on every cent of the EUR the last position size - which means you have a progression factor of 2.0, that's real martingale then.

I am curious, which settings you have used? Distance, take profit etc.?


To add comments, please log in or register