MetaTrader 4のヘルプ
MetaTrader 4のヘルプAuto TradingScriptsCreation

Creation

To create a script, one has to use MetaQuotes Language 4 (MQL4) and MetaEditor. To launch the experts editing program, one has to execute the "Create" command of the "Navigator – Scripts" window context menu, or the "Tools – MetaQuotes Language" menu command, or press F4 or the MetaEditor button of the "Standard" toolbar. At an MQL4 program creation, Expert Creation Wizard will open automatically that allows to create new MQL4 programs promptly. "Script" must be selected in it as the object to be created,

script_create

and all necessary fields must be filled out:

script_create_name

  • Name – script name;
  • Developer – developer's name;
  • Link – the developer's web-site.

After that, the new script window will open in the editor. File containing the script source code (*.MQ4) will be placed into the /EXPERTS/SCRIPTS folder of the client terminal automatically. Then one can start to write the source code of the program.

After the script has been created, it must be compiled. To do so, one has to execute the "File – Compile" menu command in the experts editor, press F5 or the Compile button in the toolbar. After the script has been successfully compiled, the executable file with *.EX4 extension will be created and placed into the /EXPERTS/SCRIPTS folder automatically. The list of all scripts can be viewed in the "Navigator – Scripts" window of the client terminal.

Editing of Scripts

To start editing of the existing script from the terminal, one has to execute the "Modify" command of the "Navigator – Scripts" window context menu. At that, the experts editor with the selected script source code already downloaded will open. After the source code has been modified, one has to recompile it and get a new executable EX4 file. Otherwise, the previous, non-modified version of the MQL4 program will be used in the terminal.