either in tester or live chart EA/indicator/script, I would like to know how long it takes for a section of code or the entire EA to run through complete sequence.
I checked a thread here which had a speedtest.mq4 attached, but I could not ascertain how to apply it to my situation. Could use MQ's sample code to demonstrate.
either in tester or live chart EA/indicator/script, I would like to know how long it takes for a section of code or the entire EA to run through complete sequence.
I checked a thread here which had a speedtest.mq4 attached, but I could not ascertain how to apply it to my situation. Could use MQ's sample code to demonstrate.
use GetTickCount().

- www.mql5.com
I'm not sure the built-in profiler can run in the tester. Yet profiling in the tester can collect more data than while debugging on a chart. For this case you can implement a kind of profiler in MQL - here is an example in my blog.
Looks like it cannot run in tester mode (built-in profiler). And you need the market to be open (with ticks coming in). But it doesn't provide other statistics like how many loops took place, how long it takes to loop through to different major sections (onTick, OnInit, etc).
But I want something that I can inject into the beginning and end of my code to verify how long it is taking to complete the sequence. So do you store getTickCount() at the beginning and end of the code and then subtract the difference?
It doesn't need to.
|
If you run an EA with the profiler it may be skewed towards the startup costs leaving the tick based costs a little buried in the stats.
To improve the results I would recommend leaving it running for a few minutes in active markets to give you a decent number of ticks to work with
But it doesn't provide other statistics like how many loops took place, how long it takes to loop through to different major sections (onTick, OnInit, etc).
But I want something that I can inject into the beginning and end of my code to verify how long it is taking to complete the sequence. So do you store getTickCount() at the beginning and end of the code and then subtract the difference?
If you use MQL-based custom profiler you can measure all you want. And do it in the tester, which brings better coverage of code execution.
Take a look into the code to understand how to insert profiling objects in order to update tick counts automatically (GetTickCount is used behind the scene). I'm afraid this will require 1-2 additional lines for every scope (function, cycle, etc) which you need to measure.
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Как вы ищете ошибки в программе?
Renat Fatkhullin, 2017.05.30 21:39
Для информации: мы в следующем билде выпустим профайлер на исторических данных, что позволит оптимизировать программы оораздо легче.Do you know whether Metaquotes will reveal the formate of the hist. data so that we would be able to create tickdata from our own database?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
either in tester or live chart EA/indicator/script, I would like to know how long it takes for a section of code or the entire EA to run through complete sequence.
I checked a thread here which had a speedtest.mq4 attached, but I could not ascertain how to apply it to my situation. Could use MQ's sample code to demonstrate.