declaring

 

is it better to do this

void OnTick()
  {
   CTrade   m_Trade;
  }

 or

do it as global?

Which is better for performance? 

 
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.
 
I think it should better perform. How can I test the performance in the strategy tester
 
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

 
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.
 
What else can I do to optimize performance? 
 
doshur:
What else can I do to optimize performance? 
Your question is too wide. What's your real problem ?
 

no problem

just trying to optimise my EA performance in terms of optimization 

 

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