very basic #define question

 

stupid question, how do I do the following in MQL4?

#define f(x) x^2

if I can't do this, can I create a function pointer? It seems that function calls are very expensive with the MQL4 compiler

 

You know that double f(double x) {return x*x; } or using MQL's MathPow(base, power) does the job.


Although good programming skills are required for making good EAs, I woud think that the focus here is not programming style, but research and implementing strategies to make profit.

 

The problem is that I have several nested function calls that are slowing down the EA @ runtime. I would like to solve this @ compile-time, by using the pre-processor. Otherwise I have to maintain several different EAs with cut&pasted code, which leads to a mess when I make bug-fixes :)






 
vgoklani:
function calls that are slowing down the EA

do you have some numbers, a real-world example, a benchmark?

I don't believe that function calls are overproportional slower in relation to the rest of the code compared with other languages.

Reason: