Download MetaTrader 5

declaring

To add comments, please log in or register
Take active part in the life of the community. Improve your rating!
Dua Yong Rew
5423
Dua Yong Rew 2013.08.31 12:16 

is it better to do this

void OnTick()
  {
   CTrade   m_Trade;
  }

 or

do it as global?

Which is better for performance? 

Alain Verleyen
Moderator
30742
Alain Verleyen 2013.08.31 12:37  
doshur:

is it better to do this

 or

do it as global?

Which is better for performance? 

Certainly a global, but I haven't tested it. You can create a little EA and test both solutions with the Strategy Tester to see which is better for performance.
Dua Yong Rew
5423
Dua Yong Rew 2013.09.01 05:55  
I think it should better perform. How can I test the performance in the strategy tester? 
Dua Yong Rew
5423
Dua Yong Rew 2013.09.02 08:44  
Testing with CTrade declared inside OnTick()
2013.09.02 14:37:33 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 21360 ms (total bars in history 9856, total time 21500 ms)
2013.09.02 14:38:57 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 20156 ms (total bars in history 9856, total time 20297 ms)

Testing with CTrade declared on Global
2013.09.02 14:40:22 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 16343 ms (total bars in history 9856, total time 16484 ms)

2013.09.02 14:41:07 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 15015 ms (total bars in history 9856, total time 15156 ms)

 

Seems to be faster. So does this save me some money if I optimize my EA with the Cloud services? 

Alain Verleyen
Moderator
30742
Alain Verleyen 2013.09.02 09:30  
doshur:
Testing with CTrade declared inside OnTick()
2013.09.02 14:37:33 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 21360 ms (total bars in history 9856, total time 21500 ms)
2013.09.02 14:38:57 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 20156 ms (total bars in history 9856, total time 20297 ms)

Testing with CTrade declared on Global
2013.09.02 14:40:22 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 16343 ms (total bars in history 9856, total time 16484 ms)

2013.09.02 14:41:07 Core 1 EURUSD,H1: 11915905 ticks (3645 bars) generated within 15015 ms (total bars in history 9856, total time 15156 ms)

 

Seems to be faster. So does this save me some money if I optimize my EA with the Cloud services? 

You will probably save 1 cent.
Dua Yong Rew
5423
Dua Yong Rew 2013.09.02 14:13  
What else can I do to optimize performance? 
Alain Verleyen
Moderator
30742
Alain Verleyen 2013.09.02 15:20  
doshur:
What else can I do to optimize performance? 
Your question is too wide. What's your real problem ?
Dua Yong Rew
5423
Dua Yong Rew 2013.09.02 16:14  

no problem

just trying to optimise my EA performance in terms of optimization 

Dua Yong Rew
5423
Dua Yong Rew 2013.09.02 17:28  

can anyone try print vs printf?

I notice using print is much faster 

Documentation on MQL5: Common Functions / Print
Documentation on MQL5: Common Functions / Print
  • www.mql5.com
Common Functions / Print - Documentation on MQL5
To add comments, please log in or register