Some things you should know about Metatrader Scripts
Running a MT4 script is easy. Simply double click the Metatrader script or drop it on the chart of your choice.
Unless a particular property called
If you wish to add a confirmation box (example show_confirm picture above) to your MT4 script when it runs so that you don't accidentally undo the work of several months in a single double click, copy the code below into the top section of your MT4 script. To comment out the line put two double forward slashes
By default in a MT4 script, there are no editable inputs from the Metatrader terminal. There is an exception that can be added to a MT4 script if you would like to have a box pop up that includes the inputs after you double click before the script runs. It is the show_inputs property and use of this property disables the show_confirm property. You can include this property as follows:
Unlike an MT4 indicator or expert advisor where you can edit the inputs by right clicking on your forex chart, with MT4 scripts, you may need to get your hands dirty and edit the code if you aren't using the
If you wish to edit inputs for a particular script (if it has inputs) then you will need to right click on the script from the Navigator window and select Modify.Once the MetaEditor opens up you will see something like the following snippet. The thing to keep in mind is that the editable inputs are placed BEFORE the
Tip: To make a confirmation box pop up every time you double click a MT4 script or drop a script on a chart to run, simply comment out the line
One final thing to keep in mind is the variable type.
As a result, you will need to make sure to enter your numbers as a double type. Best practice states that the double type requires a decimal place in MQL4. If you wanted to trade a 1 lot, you would write it as
If you enjoyed this MT4 help tutorial, you might also enjoy reading a MQL4 Code Tutorial for Metatrader. Every trader needs to learn at least some MQL4 in order to perform the simple operations of modifying code inputs, commenting out a line of code and understanding how to read the code to know if it is executing your MT4 Indicators, Metatrader expert advisors and MT4 scripts properly.