MetaTrader 4 Help
MetaTrader 4 HelpAuto TradingScriptsLaunch

Launch

After general parameters have been set up, the script can be launched. To do so, it is enough just to attach it to the chart. At that, of there is a "#property show_inputs" instruction in the program source code, the script setup window will appear automatically.

Script settings

In the "Common" tab of this window, one can:

  • Positions – select direction of position opening:
    • Long&Short – both long and short;
    • Only Long – only to buy;
    • Only Short – only to sell.
  • Enable alerts – enable/disable script alerts;
  • Disable alert once hit – disable alerting after the first alert has been made;
  • Allow live trading – enable/disable live trading. Note that even if this option is enabled, the autotrading for the Expert Advisor may be disabled by the general settings of the terminal.
  • Allow DLL imports – enable/disable importing of functions from DLL files;
  • Allow import of external experts – enable/disable calling of functions from external experts.
  • Allow modification of Signals settings – this option allows/prohibits an MQL4 application subscribing and unsubscribing from Signals as well as changing the settings of signal copying. The functions for working with the base of Signals from an MQL4 application allow performing your own analysis of the quality of signals, dynamically manage the subscription and adjust risks. More detailed information about the functions for managing the signals is provided in MQL4 Reference.

External variables of the script can be changed in the "Inputs" tab. They are variables of extern class. To change a parameter, one has to double-click with the left mouse button on its value and write the new one. At that, one can change the value of each variable or download the set of inputs already saved before (the "Load" button). One can save the current set of inputs with the button of the same name.

The "Reset" button returns all default settings. Parameters defined in the terminal settings are set in the "Common" tab. And parameters set in the source code of the program are defined as inputs. The script with the defined parameters can be confirmed by pressing of "OK" and canceled by pressing of button of the same name.

Attention: Unlike those of experts or custom indicators, special properties of the script are set only at its launch.

Script will be launched immediately after that. Double click with the left mouse button on the selected script in the "Navigator – Scripts" window or execution of the "Execute on Chart" command of the script context menu will attach the script to the active chart. The "Drag'n'Drop" technique will allow to attach the script to any chart. If the "Remove Script" command appears in the chart context menu, it means that script is working. This command is active only while this MQL4 program is working.

Attention: Only one script can be attached to a chart.