Morning all
I have an EA with an `include.mqh` file attached, all working as expected, however I getting the `macro redefinition` warning when compiling the EA.
The include file is as follows;
The EA is as follows
Having read some posts on here, the general consensus is not to define the `__SLEEP_AFTER_EXECUTION_FAIL 400` in the function, only declare this in the Global declarations in the EA, except I get the "undeclared identifier" error when compiling. I put the declaration back into the function (the include file), and I get the "macro redefinition" warning.
It's sending me in a loop ....
How would I solve the "maco redefinition" warning?
One way:
//#define __SLEEP_AFTER_EXECUTION_FAIL 400 void <fuction>{ if(<variable>){ <do a function> #ifdef __SLEEP_AFTER_EXECUTION_FAIL Sleep(__SLEEP_AFTER_EXECUTION_FAIL); #endif }
You may write the following stuff in your EA code:
#ifndef __SLEEP_AFTER_EXECUTION_FAIL #define __SLEEP_AFTER_EXECUTION_FAIL 400 #endif
It is a conditional compilation.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Morning all
I have an EA with an `include.mqh` file attached, all working as expected, however I getting the `macro redefinition` warning when compiling the EA.
The include file is as follows;
The EA is as follows
Having read some posts on here, the general consensus is not to define the `__SLEEP_AFTER_EXECUTION_FAIL 400` in the function, only declare this in the Global declarations in the EA, except I get the "undeclared identifier" error when compiling. I put the declaration back into the function (the include file), and I get the "macro redefinition" warning.
It's sending me in a loop ....
How would I solve the "maco redefinition" warning?