How to print #property value?

945 views Asked by At

How do I access #property values from the code?

For example I'm having these:

#property description "Foo"
#property copyright   "bar"
#property link        "http://www.mql4.com"
#property version     "1.0"

I've tried to print it as follow:

Print(description);

but I've the error that it's undeclared identifier. Any ideas?

1

There are 1 answers

1
jlee88my On BEST ANSWER

WORKAROUND: You cannot access/retrieve the #property values in MQL (not that I know anyway). However, there is a workaround with #define. For example:

#define propDescription "Foo"
#define propCopyright   "bar"
#define propLink        "http://www.mql4.com"
#define propVersion     "1.0"

#property description propDescription
#property copyright   propCopyright
#property link        propLink
#property version     propVersion

... and later, in your code, you can access it with:

Comment( "Current Version: " + propVersion );

Hope this helps.