I ran some benchmarks in MT4 and MT5 and I have some interesting results. Here are the codes I used, scroll down for results.
int i=0;
int max=15000000;
int t0=0;
int a=1, b=2, c=3;
int init() {
//-- test 1
t0=GetTickCount();
for (i=0; i<max; i++) {
c=a+b;
}
Print("test 1: "+(GetTickCount()-t0)+"ms");
//-- test 2
t0=GetTickCount();
for (i=0; i<max; i++) {
c=a()+b();
}
Print("test 2: "+(GetTickCount()-t0)+"ms");
//-- test 4
t0=GetTickCount();
for (i=0; i<max; i++) {
a();
b();
a();
b();
a();
b();
a();
b();
a();
b();
}
Print("test 3: "+(GetTickCount()-t0)+"ms");
}
int start() {}
int a() {return(1);}
int b() {return(2);}
int i=0;
int max=15000000;
uint t0=0;
int a=1, b=2, c=3;
int OnInit() {
//-- test 1
t0=GetTickCount();
for (i=0; i<max; i++) {
c=a+b;
}
Print("test 1: "+(string)(GetTickCount()-t0)+"ms");
//-- test 2
t0=GetTickCount();
for (i=0; i<max; i++) {
c=a()+b();
}
Print("test 2: "+(string)(GetTickCount()-t0)+"ms");
//-- test 3
t0=GetTickCount();
for (i=0; i<max; i++) {
a();
b();
a();
b();
a();
b();
a();
b();
a();
b();
}
Print("test 3: "+(string)(GetTickCount()-t0)+"ms");
return(0);
}
int a() {return(1);}
int b() {return(2);}
I tested what time it takes for an EA to run some functions in a year. I found that there are 11-15 million ticks in a year, at least in one of my MT4 installations (not to mention holes in the history data).
Both codes are identical, so these tests are the same for MT4 and MT5. Here are the results:
MetaTrader 4:
test1: 171 ms
test2: 2886 ms
test3: 12215 ms
MetaTrader 5:
test1: 47 ms
test2: 47 ms
test3: 62 ms
It looks that MetaTrader 4 loses HUGE amount ot time just to call some functions. In comparison MetaTrader 5 is as fast as it can, there is virtually no matter how many functions do you call in the EA. And these functions are just empty functions that does nothing, if they have to do something it gets even worse for MT4!
I decided that my MT4 installation could be corrupted, so I tested this on other installations, on other Windows with fresh MT4 installation, even on older MT4 build - it's the same.
fxDreema is using many many non-empty functions. I didn't expect that MT4 can be so slow in this simple task.
In any case, I really want someone to try this as well, just to compare the results. Maybe my MT4 does not feel good on my PC, I don't know.