efficiency of EA

 

Dear all

Does anybody know, if I put most calculation into reference section (i.e. below return() of start() ), the efficiency of EA can be improved or not? (for example, shorter time used during running of backtest)

Wing

 
If you place code below the return() in start() the code will not be executed unless it is part of a custom function . . . is that what you mean by "reference section" ?
 
RaptorUK:
If you place code below the return() in start() the code will not be executed unless it is part of a custom function . . . is that what you mean by "reference section" ?


yes!

In fact, I don't know what it is officially named.

For instance, I put a complex calculation in reference section and place a line of command inside start() to call it when it is necessary.

Instead, I put the calculation itself inside the start().

Which one is more efficient for running of an EA? or there is no different between these two methods?

 
wing:


Which one is more efficient for running of an EA? or there is no different between these two methods?

OK, you are talking about Custom Functions . . . . . I don't think there will be a noticeable difference, there might be a very small measurable difference that will show that the Custom Function method is very, very slightly slower.
 
RaptorUK:
OK, you are talking about Custom Functions . . . . . I don't think there will be a noticeable difference, there might be a very small measurable difference that will show that the Custom Function method is very, very slightly slower.


So, the question is,

1) if the command line is hided by putting "//",

2) if the command line is not executed because it can't satisfy the "if" or "for" condition,

3) if it is an empty line

4) a line below return() of start(), etc

Will EA still uses resources to "read" the line, to "handle" it, or just skip it?

In fact, as my EA becomes more complicated, the efficiency of doing backtest is greatly going down, so I'm trying everything to improve it.

 

1. & 3. Comments ( // and /* */ ) and blank space are stripped out at compile time.

2. not certain

4. Custom Functions are handled just like the rest of the code . . .

Reason: