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.
![Documentation on MQL5: Language Basics / Preprocessor / Conditional Compilation (#ifdef, #ifndef, #else, #endif) Documentation on MQL5: Language Basics / Preprocessor / Conditional Compilation (#ifdef, #ifndef, #else, #endif)](https://c.mql5.com/36/61/documentation-on-mql5-language__2.png)
- www.mql5.com
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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?