In the Build 600 MQL4 Reference it says "Properties described in included files are completely ignored. Properties must
be specified in the main mq4-file." They are talking about the #property statement.
It was allowed in Build 509 but not anymore!!!!
How are we supposed to know this? MetaQuotes change the functionality of the language and expect us to know what they changed? Where can I go to see what has changed in the language from Build509 to Build600? Anybody know the answer? I stumbled on the #property change only after trying to debug why my application was no longer working.
Here is the code in the form of a simple test case. This code can be used to create an empty sub-window into which you can place whatever you want later on. My actual indicator is much more than this and I had my reasons for putting the #property statement into the include file, which it is not necessary to explain in order to illustrate the problem I am talking about:
TestSubWindow.mq4 indicator file:
#include <TestInclude.mqh>
TestInclude.mqh file:
#property indicator_separate_window
int init() { return(0);}
int deinit(){ return(0);}
int start() { return(0);}
Compile TestSubWindow. There are No error messages, not even a warning message from the compiler. When you run it the indicator has no label in top LH corner which should say "TestSubWindow", and the scale on RH side of window is missing. Now try and drop a vertical line from the 'Line Studies' toolbars into the window - it does not take.
If you move the #property statement out of the include file and into the main mq4 file and recompile, then everything works fine.
Here is the code in the form of a simple test case. This code can be used to create an empty sub-window into which you can place whatever you want later on. My actual indicator is much more than this and I had my reasons for putting the #property statement into the include file, which it is not necessary to explain in order to illustrate the problem I am talking about:
TestSubWindow.mq4 indicator file:
#include <TestInclude.mqh>
TestInclude.mqh file:
#property indicator_separate_window
int init() { return(0);}
int deinit(){ return(0);}
int start() { return(0);}
Compile TestSubWindow. There are No error messages, not even a warning message from the compiler. When you run it the indicator has no label in top LH corner which should say "TestSubWindow", and the scale on RH side of window is missing. Now try and drop a vertical line from the 'Line Studies' toolbars into the window - it does not take.
If you move the #property statement out of the include file and into the main mq4 file and recompile, then everything works fine.
It appears to be a behavior which is being phased out of mql4+. You could try keeping a copy of the old compiler to retain this behavior. The above is consistent with the expectation set forth for this new built. Personally, I never taught it made much sense having a #Property Library in the include file treating my Expert Advisor like a Library because I included it. If you believe it's a bug || want to keep this feature then contact metaQuotes via the service desk. The new mql4+ would hopefully implement the ability to include indicators as Services just like in mt5. That way it's all bundled within a single file. If that helps at all.
I am not sure, if "completely ignored" is correct. At least #property strict is not ignored, if placed only within the include file.
I understand, that many properties, like #property copyright, conflict and must be treated by some rule, but I do not understand why declarations should get "completely ignored" when in the include file.
Btw, what is not mentioned in the Documentation is, that #include xxx.mqh works only once on a particular include file; which is fine, but should have been mentioned in docs.
Here is the code in the form of a simple test case. This code can be used to create an empty sub-window into which you can place whatever you want later on. My actual indicator is much more than this and I had my reasons for putting the #property statement into the include file, which it is not necessary to explain in order to illustrate the problem I am talking about:
TestSubWindow.mq4 indicator file:
#include <TestInclude.mqh>
TestInclude.mqh file:
#property indicator_separate_window
int init() { return(0);}
int deinit(){ return(0);}
int start() { return(0);}
Compile TestSubWindow. There are No error messages, not even a warning message from the compiler. When you run it the indicator has no label in top LH corner which should say "TestSubWindow", and the scale on RH side of window is missing. Now try and drop a vertical line from the 'Line Studies' toolbars into the window - it does not take.
If you move the #property statement out of the include file and into the main mq4 file and recompile, then everything works fine.
I am talking about:
TestSubWindow.mq4 indicator file:
#include <TestInclude.mqh>
TestInclude.mqh file:
#property indicator_separate_window int init() { return(0);} int deinit(){ return(0);} int start() { return(0);}
Compile TestSubWindow. There are No error messages, not even a warning message from the compiler. When you run it the indicator has no label in top LH corner which should say "TestSubWindow", and the scale on RH side of window is missing. Now try and drop a vertical line from the 'Line Studies' toolbars into the window - it does not take.
If you move the #property statement out of the include file and into the main mq4 file and recompile, then everything works fine.
Program Properties (#property)
Every mql4-program allows to specify additional specific parameters named #property that help client terminal in proper servicing for programs without the necessity to launch them explicitly. This concerns external settings of indicators, first of all. Properties described in included files are completely ignored. Properties must be specified in the main mq4-file.
Program Properties (#property)
Every mql4-program allows to specify additional specific parameters named #property that help client terminal in proper servicing for programs without the necessity to launch them explicitly. This concerns external settings of indicators, first of all. Properties described in included files are completely ignored. Properties must be specified in the main mq4-file.
![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
In the Build 600 MQL4 Reference it says "Properties described in included files are completely ignored. Properties must be specified in the main mq4-file." They are talking about the #property statement.
It was allowed in Build 509 but not anymore!!!!
How are we supposed to know this? MetaQuotes change the functionality of the language and expect us to know what they changed? Where can I go to see what has changed in the language from Build509 to Build600? Anybody know the answer? I stumbled on the #property change only after trying to debug why my application was no longer working.