How to get #property version from EA?

 

Hi, 

within the EA it is simple to get the name of my EA using following code:

MQL5InfoString(MQL5_PROGRAM_NAME)

But I couldn't figure out to get the version number of the version #property field. Is there a similar way to get the version number? My workaround at the moment is a #define after the version number but that's not really satisfying and looks like this:

#property   version     "1.32"
#define     VERSION     "1.32"

 Kind Regards

 
#define VERSION "1.32"
#property version VERSION
string strategyName = "My Indicator V" + VERSION;
string shortStrategyName = "MI" + VERSION;

My problem is that I name my files like "My indicator 1.32.mq4" and then this is readable in properties as "My Indicator 1.32 1.32".
Of course i keep sources of different revisions, so they must have logical names..... 

Any help for that? :) 

 
graziani:

My problem is that I name my files like "My indicator 1.32.mq4" and then this is readable in properties as "My Indicator 1.32 1.32".
Of course i keep sources of different revisions, so they must have logical names..... 

Any help for that? :) 

I add version number to a file name only for outdated versions, while latest version is always without a version suffix. For example, if version 1.32 is being released, I change existing (old) file to "name1.31.mq*" and save version 1.32 under "name.mq*". When 1.33 will be released, this "name.mq*" will go to archive under "name1.32.mq*" and so on.
 
graziani:

My problem is that I name my files like "My indicator 1.32.mq4" and then this is readable in properties as "My Indicator 1.32 1.32".
Of course i keep sources of different revisions, so they must have logical names..... 

Any help for that? :) 

Your code is a great idea to start with - thanks. 

Regarding the EA file version numbering I switched to MQL5 storage so I don't need the manual file-name based numbering anymore. Versioning is done by SubVersion now. Great advantage is that I can compare differences of my source files very easily.

 

What a productive thread, 2 quoestions, 3 answers!

Thanks guys! 

 
MrGrey:

Regarding the EA file version numbering I switched to MQL5 storage so I don't need the manual file-name based numbering anymore. Versioning is done by SubVersion now. Great advantage is that I can compare differences of my source files very easily.

Yes. Also it's possible to install a version control system locally, for example, Git. Some people may be worried about "sharing" their code with 3-rd parties. You know, sometimes even great and secure services get hacked and then we see, for example, nude celebrities photos from their private albums ;-).
 
marketeer:
Yes. Also it's possible to install a version control system locally, for example, Git. Some people may be worried about "sharing" their code with 3-rd parties. You know, sometimes even great and secure services get hacked and then we see, for example, nude celebrities photos from their private albums ;-).
You are right. I installed VisualSVN on my local computer and it works great.
 
MrGrey:

Hi, 

within the EA it is simple to get the name of my EA using following code:

But I couldn't figure out to get the version number of the version #property field. Is there a similar way to get the version number? My workaround at the moment is a #define after the version number but that's not really satisfying and looks like this:

 Kind Regards

Resurrecting this dated thread because I, too, would like to do just that -- read the #property version for using dynamically inside my MQL programs... Is that possible? If so, how?

 
Dima Diall #: Resurrecting this dated thread because I, too, would like to do just that -- read the #property version for using dynamically inside my MQL programs... Is that possible? If so, how?

Just as explained in post #1, use macro substitution instead. This is my rendition ...

//---------------------------------------------------------------------------------------------------------------------
#define     MName          "Renko Cross"
#define     MVersion       "0.5 alpha"
#define     MBuild         "2022-06-15 13:30 WEST"
#define     MCopyright     "Copyright \x00A9 2022, Fernando M. I. Carreiro, All rights reserved"
#define     MProfile       "https://www.mql5.com/en/users/FMIC"
#define     MCommentCode   "RC1"
//---------------------------------------------------------------------------------------------------------------------
#property   strict
#property   version        MVersion
#property   description    MName
#property   description    "MetaTrader Expert Advisor (Build "MBuild")"
#property   copyright      MCopyright
#property   link           MProfile
//---------------------------------------------------------------------------------------------------------------------