MQLLock & Performance

UPDATE 30.Oct.2012 : We have improved this problem with MlEngine Version 056. If you are running a project with MLEngine lower then 056, please consider to update using reprocess function

ORIGINAL POST 04.Oct.2012
Of course performance is a very important factor in ML development. To explain this its essential to understand how ML works. ML doing several operations with original MQL file. First of all it tries to convert as many functions as possible to native c++ code. This has the reason to hide the algoritm behind a protected environment, second obfuscation. Beside this ML also does obfuscate remaining source code to make it very hard to understand. ML even obfuscates obfuscated parts several times. ML also has several anti-debugger, anti-crack, anti-hack protection layers to provide best possible protection.

All those slows down ML. MQL does not have a native protection and ML secures it from external in most effective way as possible but still the security is highest priority. Thats why performance is in second spot then security. Its a game between security and performance.

ML does not slowdown every EA. It varies a lot based on programming style of coder. Sometimes EAs are even faster depending on programming style or used functions. ML does generate different outputs everytime you send your code to ML servers, this causes that every DLL is protected and designed differently and this also cause that performance may be different on every iteration. So we cannot say every EA is slowed down nor we cannot say you % of slowness. Those factors vary a lot based on factors mentioned above.

The fact is that there will be almost everytime a small slowdown and this may be feeled by persons who have low hardware resources. On a new hardware this will probably never be feeled because c++ is faster than MQL but on an old-hardware this may be look like slow.

Especially the backtests may be slower than normal because of reasons mentioned above and this is totally normal. In a backtest processor must manage 5-10 ticks a second, so it must call the EA 5-10 times a second. In real environment this number is usually 1 in average. So speed in backtest should not be mixed with speed in real forward test. This is very important fact to understand.

On a computer which has low-resources ML may be slower then normal and it may also use more CPU, RAM then usual because ML is using much more resources then original version.

What can you do to speed up?

You as developer know what you are coding, try to remove all unneeded lines and even include files is a good start. Beside this try to use functions instead of using coding blocks again and again.

Improve your coding style

We promise all our clients that ML can convert your code without requiring any change in code, but to ensure more speed you may consider to optimize your code. Imagine you have an indicator and this indicator is calculating everything from scratch on every Tick. This means that big calculation routines will be called on every Tick. You may not feel this overhead under normal conditions (without protection) but if we protect you, your code will be more heavy. Its very easy to code very inefficient in MQL because MQL is designed to cover mainstream and people without any programming language. MQL does tolerate many mistakes and its sometimes frustrating. Imagine you write for(int i=0;iHardware matters

End-clients hardware matters a lot. We are using very high tecniques to protect you and your code. But there is also hardware. Many traders are using VPS and VPS dont have huge CPU power nor RAM. Converting your source code with ML costs you speed and the amount how much speed is suffered will be depending on clients hardware. Some of your clients may not feel anything but other may feel much slower.

Posted in MQLLock Updates