MQL4 Reference Language Basics Preprocessor Program Properties (#property)

MQL4 Help as One File:

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.

#property identifier value

The compiler will write declared values in the configuration of the module executed.

Constant

Type

Description

strict

 

Compiler directive for strict compilation mode (see Updated MQL4)

icon

string

Path to the file of an image that will be used as an icon of the EX4 program. Path specification rules are the same as for resources. The property must be specified in the main module with the MQL4 source code. The icon file must be in the ICO format.

link

string

Link to the company website

copyright

string

The company name

version

string

Program version, maximum 31 characters

description

string

Brief text description of a MQL4-program. Several description can be present, each of them describes one line of the text. The total length of all description can not exceed 511 characters including line feed.

stacksize

int

MQL4 program stack size. The stack of sufficient size is necessary when executing function recursive calls.

When launching a script or an Expert Advisor on the chart, the stack of at least 8 MB is allocated. In case of indicators, the stack size is always fixed and equal to 1 MB.

When a program is launched in the strategy tester, the stack of 8 MB is always allocated for it.

library

 

A library; no start function is assigned, functions with the export modifier can be imported in other MQL4-programs

indicator_chart_window

 

Show the indicator in the chart window

indicator_separate_window

 

Show the indicator in a separate window

indicator_height

int

Fixed height of the indicator subwindow in pixels (property INDICATOR_HEIGHT)

indicator_buffers

int

Number of buffers for indicator calculation

indicator_minimum

double

The bottom scaling limit for a separate indicator window

indicator_maximum

double

The top scaling limit for a separate indicator window

indicator_labelN

string

Sets a label for the N-th graphic series displayed in DataWindow

indicator_colorN

color

The color for displaying line N, where N is the number of graphic series; numbering starts from 1

indicator_widthN

int

Line thickness in graphic series, where N is the number of graphic series; numbering starts from 1

indicator_styleN

int

Line style in graphic series, specified by the values of ENUM_LINE_STYLE. N is the number of graphic series; numbering starts from 1

indicator_typeN

int

Type of indicator drawing style. N is the number of graphic series; numbering starts from 1

indicator_levelN

double

Horizontal level of N in a separate indicator window

indicator_levelcolor

color

Color of horizontal levels of the indicator

indicator_levelwidth

int

Thickness of horizontal levels of the indicator

indicator_levelstyle

int

Style of horizontal levels of the indicator

script_show_confirm

 

Display a confirmation window before running the script

script_show_inputs

 

Display a window with the properties before running the script and disable this confirmation window

tester_file

string

File name from <terminal_data_folder>\MQL4\Files\ to be sent to a virtual server

tester_indicator

string

Indicator file name from <terminal_data_folder>\MQL4\Indicators\ to be sent to a virtual server

tester_library

string

Library file name from <terminal_data_folder>\MQL4\Libraries\ to be sent to a virtual server

tester_file, tester_indicator and tester_library properties are necessary for describing the list of the files required for working in virtual hosting.

Indicator files called in iCustom() function with a fixed name, as well as all library files used in MQL4 programs are copied automatically during the migration.

Find out more about migration of programs in the article "How to Prepare a Trading Account for Migration to Virtual Hosting".

Sample code for moving files to a hosting

#property tester_file "trade_patterns.csv"    // file with the data to be read by an Expert Advisor
#property tester_indicator "smoothed_ma.ex4"  // file with a custom indicator specified in iCustom() as a variable

Example of an implicit indication of an indicator name in the code

string indicator_name="smoothed_ma.ex4";
double val=iCustom(NULL,0,indicator_name,13,1,0);

Sample Task of Description and Version Number

#property version     "3.70"      // Current version of the Expert Advisor
#property description "ZigZag universal with Pesavento Patterns"
#property description "At the moment in the indicator several ZigZags with different algorithms are included"
#property description "It is possible to embed a large number of other indicators showing the highs and"
#property description "lows and automatically build from these highs and lows various graphical tools"

Example of displaying description and version at program startup