It's not documented and I didn't know it was even possible, until I saw the indicator below using the property name as a predefined variable name.
#property copyright "Alexander Elgin" #property link "alexmost113@mail.ru" #define INDICATOR_NAME "Fractal Support Resistance" #property indicator_color1 Green #property indicator_style1 STYLE_DOT ⋮ #property indicator_color5 FireBrick #property indicator_style5 STYLE_SOLID ⋮ int styles[PERIODS_NUMBER] = {indicator_style1, indicator_style2, indicator_style3, indicator_style4, indicator_style5}; color colors[PERIODS_NUMBER] = {indicator_color1, indicator_color2, indicator_color3, indicator_color4, indicator_color5};Unfortunately it doesn't work with version (MT4 1170,) but it's not necessary, either.
#define VERSION "123.0" #property version VERSION ⋮ Print(VERSION);
It's not documented and I didn't know it was even possible, until I saw the indicator below using the property name as a predefined variable name.
I used this method before until MQL upgraded editor to have project. A project has a GUI for version setting. Please see my attached picture. The definition of "#property version" in code is conflict with version in GUI. One have to modify 3 places to maintain the project. It's tired.
I used this method before until MQL upgraded editor to have project. A project has a GUI for version setting. Please see my attached picture. The definition of "#property version" in code is conflict with version in GUI. One have to modify 3 places to maintain the project. It's tired.
From my experience "project" is not usable in practice due to several similar "features". Reported to Metaquotes on Russian forum but no answer.
From my experience "project" is not usable in practice due to several similar "features". Reported to Metaquotes on Russian forum but no answer.
Thank you Alain.
Ha ~ I get same request
If we can make suggest to Metaquotes make this as a new feature?
This can help us.
Only some of the "properties" work that way. Things like Indicator properties ("indicator_buffers", "indicator_label", "indicator_color", etc.) work as you describe but others like "version" or "copyright" do not.
EDIT: This is the case for current builds MT4 (build 1335) and MT5 (build 2940).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Steps:
1. Define the property like this:
#property version "1.00"
2. How can I get version from code? Like Print("Current version: "+property.version)?