Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
I dont understand, but you cannot include the same file multiple times. The compiler will remove all subsequent includes and only consider the first mentioning.
Redifinition of an already existing defined constant can be done like this:
#define MY_BASE_STR "test-str" printf("%s", MY_BASE_STR); #ifdef MY_BASE_STR #undef MY_BASE_STR #define MY_BASE_STR "subsequent definition" #endif printf("%s", MY_BASE_STR);
include files usually have the ".mqh" extension, not ".inc".
You have been told to edit your first post
You have added additional posts without using the code button. I have deleted them. Please post code properly.
Sergey Golubev #:
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
To Mr Dominik Christian Egert, top secret.
<Deleted>
Solved:
// TestDefine void OnStart() { #define String_PM "A" #include "PrintMacro00.mq5" #ifdef String_PM #undef String_PM #endif #define String_PM "B" #include "PrintMacro01.mq5" PlaySound("expert.wav"); } /* File "PrintMacro00.mq5": Print(String_PM); File "PrintMacro01.mq5" Print(String_PM); Tne same file, without changes. Only change name for 00, 01... and use many times. The same "function" - macro, input/output parameters are redefined. For example: // Calculate bar color based on Data Aquisition #define TabWeKVSZ_VSZ MojaTabVSZ #define TabWeKVSZ_DaqMin MojaTabDaqMin #define TabWeKVSZ_DaqTim MojaTabDaqTim #define TabWeKVSZ_DaqAsk MojaTabDaqAsk #define TabWeKVSZ_DaqBid MojaTabDaqBid #define TabWyKVSZ_Kol MojaTabCOL #include "Koloruj_VSZ.inc" Thanks a lot. */ PlaySound("expert.wav");
![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
Hello.
Why can't we redefine #define preprocessor directive?
For example, very usefull...
Well. The same function. Just redefine names of input tables.
It can't be done.
Today is an naightmare, for example:
the copy of the same funcion, different by name, internal names, sorry...
Please do not type "Read documetatnion"
The same function #include "FunctionName.inc"
and redefiniction of input/output static tables by changing #define
Thanks a lot.
Paolo_ecn