The example of creation of a simple script using MetaEditor will be described step by step in this section.
After that one should choose the "Script" option and press the "Next" button.
At this stage one should specify the name of the script and the information about its author and the website address. Once the "Done" button is pressed, the new file of the script will be created in the "Scripts" folder. Further it is necessary to create a separate folder for the script. To do that one should execute the "New Folder" command in the context menu of the "Navigator" window.
The next step is to move the created file of the script (ScriptExample.mq5) to the new folder using the Drag'n'Drop technology. One can start writing the source code as soon as the file is moved:
As soon as the source code is written it is necessary to save and compile it using the " Save" and " Compile" in the "File" menu or in the"Standard" toolbar. The result of compilation will be displayed at the "Errors" tab of the "Toolbox" window:
The executable file of the script ScriptExampe.ex5 will be created as a result of compilation as well, it will be placed to the same folder as the source file.
One can debug the script if it is necessary. In order to do it one should place a breakpoint at the necessary line by double clicking on the grey field located to the left of the line. Then it is necessary to execute the " Start Debugging" command in the "Debug" menu:
As soon as it is done the script will be attached to the temporary chart in the client terminal, and the result of script execution will be displayed at the journal — the "Hello World!!!" inscription:
In order to finish debugging one should execute the " Stop Debugging" command in the "Debug" menu.
As soon as all the necessary steps are passed the script can be used in the client terminal. To open it one should execute the " Trading Terminal" command in the "Tools" menu or use the "F4" key.