MetaTrader 4帮助
MetaTrader 4帮助Auto TradingExpert AdvisorsCreation

Creation

To create experts, one has to use MetaQuotes Language 4 (MQL4) and MetaEditor. To launch the expert editing program, one has to execute the "Create" command of the "Navigator – Expert Advisors" window context menu, or the "Tools – MetaQuotes Language Editor" menu command, or press F4 or the MetaEditor button of the "Standard" toolbar.

ea_create_navigator

After that, the Expert Creation Wizard will be opened automatically that allows to immediately start working at a new MQL4 program. One has to flag the "Expert Advisor" as a type of object to be created and fill out the following fields:

  • Name – expert name;
  • Developer – the developer's name;
  • Link – link to the developer's site;
  • Inputs – the list of expert inputs. To add a new parameter, one has to press the "Add" button or the "Delete" button to delete a parameter.

After that the new expert window with the defined inputs will open in editor. The source file (*.MQ4) of the expert will be saved in the /EXPERTS folder of the client terminal automatically. At this moment, one can start to write the expert code.

After the expert development has been completed, it must be compiled. To do so, one has to execute the "File – Compile" command in the expert editor, or press F5 or the Compile button of the toolbar. As a result of successful compilation an executable program file with *.EX4 extension will be created and saved in the /EXPERTS folder automatically. The list of compiled experts can be viewed in the "Navigator – Expert Advisors" window in the client terminal. If the expert has not been compiled successfully, its icon will be gray. This means that this expert cannot be used.

Editing of Experts

To start editing of the existing expert from the terminal, one has to execute the "Modify" command of the "Navigator – Expert Advisors" window context menu. At that, the experts editor will open where the source code of the selected expert. After the expert source code has been modified, one has to recompile it and get a new executable EX4 file. Otherwise, terminal will use the previous version of the expert, the non-modified one.

Attention: If the expert has not been compiled successfully, its icon will be gray. This means that this expert cannot be used.