no-image

How to get version from property

I'm doing strategy development,

Sometimes you want to branch between the advanced version and the normal version within the same module.

As a method, for example, when trying to branch processing depending on whether "prop" is added to the property or not,

#property version “2.4 pro”

If you try to use the version defined inside the program, a compile error will occur.

After a little bit of google,

https://www.mql5.com/en/forum/35914

According to

#define VERSION “2.4 pro”
#property version VERSION

string strategyName = VERSION;

if (StringFind (strategyName, ”pro”, 0)> = 0) {

// pro processing

}

else {
// Process not pro
}

If I did something like that, I knew it would work.

Translate »