The author's nonsense again. Quote:" But there are some directives in C/C++ that are not available in MQL5. One of them is #ifdef, which, although it may seem uninteresting, at some moments helps us a lot to control certain parts of the version we are working on. "
#ifdef has been in MQL4 and MQL5 for a very long time.
#define PRINT int OnInit() { #ifdef PRINT Print("ifdef in MQL5 is"); #endif return(INIT_SUCCEEDED); }
The author's nonsense again. Quote:" But there are some directives in C/C++ that are not available in MQL5. One of them is #ifdef, which, although it may seem uninteresting, at some moments helps us a lot to control certain parts of the version we are working on. "
#ifdef has been in MQL4 and MQL5 for a very long time.
Why are you reading this? 🤦♀️
The author's nonsense again. Quote:" But there are some directives in C/C++ that are not available in MQL5. One of them is #ifdef, which, although it may seem uninteresting, at some moments helps us a lot to control certain parts of the version we are working on. "
#ifdef has been in MQL4 and MQL5 for a very long time.
His nickname in the base is vDev - this is his topic!!!
Lekha - let's scalp test!!!! )
O autor está falando bobagem de novo. Citação: " Mas em C/C++ há algumas diretivas que não estão no MQL5. Um deles é o #ifdef, que, embora possa parecer desinteressante, em alguns pontos realmente nos ajuda a controlar certas partes da versão em que estamos trabalhando. "
#ifdef está no MQL4 e MQL5 há muito tempo.
Sorry. However, it was an error on my part to refer to the directive in the text. My intention was to refer to the #if directive, because the #ifdef directive is the equivalent of the #if defined directive present in C and C++. But to generalise it here in MQL5, we use #ifdef, which is also present in C and C++. Again, the purpose will be to refer to the #if directive, which has a completely different purpose and can even be used to check the values of definitions. But due to my writing mistake, I ended up putting #ifdef and didn't realise it. I apologise for this oversight on my part. 👍
Sorry. However, there was an error on my part in referring to the directive in the text. My purpose was to refer to the #if directive, because the #ifdef directive is the equivalent of the #if defined directive, which is present in C and C++. But to generalise it here in MQL5, we use #ifdef, which is also present in C and C++. Again, the purpose will be to refer to the #if directive, which has a completely different purpose and can even be used to check the values of definitions. But due to my writing mistake, I ended up putting #ifdef and didn't realise it. I apologise for this oversight on my part. 👍
That's okay, everyone has their moments )

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: From Basic to Intermediate: The Include Directive.
In today's article, we will discuss a compilation directive that is widely used in various codes that can be found in MQL5. Although this directive will be explained rather superficially here, it is important that you begin to understand how to use it, as it will soon become indispensable as you move to higher levels of programming. The content presented here is intended solely for educational purposes. Under no circumstances should the application be viewed for any purpose other than to learn and master the concepts presented.
In this article, we will address a topic that can be very helpful to you. Once it is explained, I will be able to start presenting more sophisticated code examples. Until now, it has been quite challenging for me to write code without utilizing certain resources available in MQL5. Even though some of you may think it has been easy for me, writing code without these resources is, in fact, a significant challenge. But now, we will add some new capabilities to the list of what can already be done.
The resource I am referring to is the use of compilation directives. Without these directives, much of what we can do becomes significantly limited, forcing us to write much more code than would be necessary in a real programming scenario.
Compilation directives, contrary to what many may think, do not make the code more confusing. On the contrary, their main purpose is exactly the opposite: to make the code simpler, faster, and easier to handle and modify. The problem is that many beginners either ignore or fail to learn how to use this resource properly. This may be because some programming languages do not have such resources in their toolkit. Some examples of languages that do not feature compilation directives include JavaScript and Python. While these languages are quite popular among casual programmers, they are not suitable for creating certain types of applications. However, the purpose here is not to discuss these languages, but rather to focus on MQL5. So, let us begin with the first topic of this article.
Author: CODE X