Download MetaTrader 5
To add comments, please log in or register
Download MetaTrader 5 mobile version and trade from anywhere in the world!
Derek
42
Derek 2014.02.09 03:39 

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.

Ubzen
Moderator
5394
Ubzen 2014.02.09 04:15  
Hillderek:

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.

Attach the code you're having problems with.
Derek
42
Derek 2014.02.09 07:13  

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.

Ubzen
Moderator
5394
Ubzen 2014.02.09 08:37  
Hillderek:

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.

Ovo Cz
2954
Ovo Cz 2014.02.09 09:01  

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.

Alain Verleyen
Moderator
28671
Alain Verleyen 2014.02.09 12:00  
Hillderek:

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.

Reported to ServiceDesk, please be patient.
Rashid Umarov
Admin
6605
Rashid Umarov 2014.02.10 07:44  
Hillderek:

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.

Are you sure that such directives must be in include files? I am in doubt about it.
Derek
42
Derek 2014.02.19 08:12  
Well it worked fine in Build 509. I do it this way because I don't like duplicating any coding if I can avoid it. The include file gets called by more than one main indicator, so I put the #property statement in the include file once, instead of in multiple main indicator files. It's how I do things.
Ian Venner
2583
Ian Venner 2014.02.19 09:08  

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.

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.19 09:28  
SDC:

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.

From here: https://docs.mql4.com/en/basis/preprosessor/compilation
Ovo Cz
2954
Ovo Cz 2014.02.19 10:16  
I have multiple-level include and the #property strict is submerged in the deepest level file. It definitively applies to the entire source code.
/
To add comments, please log in or register