Download MetaTrader 5

Backtest Profiling

To add comments, please log in or register
How to use MQL5.community messages editor? Find out in the article!
Henrique Vilela
1231
Henrique Vilela 2016.09.11 20:42 

The Metaeditor provides this great profiling tool that helps to spot bottlenecks.

Unfortunately looks like it only can be used in real time and not in backtest.

I'm I right or I'm missing something?

Alexandr Saprykin
6389
Alexandr Saprykin 2016.09.11 21:15  
Henrique Vilela:

The Metaeditor provides this great profiling tool that helps to spot bottlenecks.

Unfortunately looks like it only can be used in real time and not in backtest.

I'm I right or I'm missing something?

You can spend backtest in any part of the history of http://www.metatrader5.com/en/terminal/help/testing

Henrique Vilela
1231
Henrique Vilela 2016.09.11 21:22  
Alexandr Saprykin:

You can spend backtest in any part of the history of http://www.metatrader5.com/en/terminal/help/testing

Yes, of course I can but what's your answer has to do with the profiling function?
Stanislav Korotky
17884
Stanislav Korotky 2016.09.11 21:27  
Henrique Vilela:

The Metaeditor provides this great profiling tool that helps to spot bottlenecks.

Unfortunately looks like it only can be used in real time and not in backtest.

I'm I right or I'm missing something?

You're right. Neither profiling not debugging is available in the tester. These are major disadvantages of the platform.

I wrote a profiling library for myself. Of course it requires code modifications (for example, to insert two calls in the source to measure timing between corresponding lines). You can do it as well. I'm afraid this is the only possible resort at the moment.

Henrique Vilela
1231
Henrique Vilela 2016.09.11 21:40  
Stanislav Korotky:

You're right. Neither profiling not debugging is available in the tester. These are major disadvantages of the platform.

I wrote a profiling library for myself. Of course it requires code modifications (for example, to insert two calls in the source to measure timing between corresponding lines). You can do it as well. I'm afraid this is the only possible resort at the moment.

Thank you so much for your answer.

Let me ask you: Your library is pure MQL5 or DLL based?

I'm asking cause I can't find a way to measure real time passed during the backtest using only MQL5 code, once all the time functions (TimeCurrent, TimeTradeServer, TimeLocal...) are all simulated (as expected) during the backtest / optimization process.

Henrique Vilela
1231
Henrique Vilela 2016.09.12 02:55  

Ok, I've found GetTickCount that can be used for this propose. Also used the GetLocalTime from kernel32.dll but both has too high resolution (millisecond).

For profiling I would need something more precise. Any suggestion?

EDIT: Fount it: GetMicrosecondCount(); 

Stanislav Korotky
17884
Stanislav Korotky 2016.09.12 16:37  
Henrique Vilela:

Ok, I've found GetTickCount that can be used for this propose. Also used the GetLocalTime from kernel32.dll but both has too high resolution (millisecond).

For profiling I would need something more precise. Any suggestion?

EDIT: Fount it: GetMicrosecondCount(); 

Yes you can use it (no dll needed). In fact, I used GetTickCount without a problem, because (to maybe a surprise of many people) real bottlenecks consume so much time, that they are marked distinctively even in millisecond resolution (especially when accumulated during the tester run). There was no need to hunt for microseconds.
Alain Verleyen
Moderator
30724
Alain Verleyen 2016.09.12 17:07  
Stanislav Korotky:

You're right. Neither profiling not debugging is available in the tester. These are major disadvantages of the platform.

I wrote a profiling library for myself. Of course it requires code modifications (for example, to insert two calls in the source to measure timing between corresponding lines). You can do it as well. I'm afraid this is the only possible resort at the moment.

Debugging is available with MT5 Strategy Tester.
Stanislav Korotky
17884
Stanislav Korotky 2016.09.13 11:47  
Alain Verleyen:
Debugging is available with MT5 Strategy Tester.
Oh, yes, I forgot it has been finally added some time ago.
To add comments, please log in or register