1. Advanced Guide To MetaTrader 4 - Introduction
  2. Advanced Guide To MetaTrader 4 - Automated Trading
  3. Advanced Guide To MetaTrader 4 - Expert Advisors
  4. Advanced Guide To MetaTrader 4 - Custom Indicators
  5. Advanced Guide To MetaTrader 4 - Scripts
  6. Advanced Guide To MetaTrader 4 - Strategy Testing And Optimization

Scripts are programs that are intended to perform a single action. Unlike an indicator or Expert that works continually, a Script stops functioning once it has completed its function one time. Like Custom Indicators, Scripts are created, setup and launched in much the same manner as Experts. When launching the Experts Wizard, select "Scripts" as the object to be created. Continue in the same manner as creating an Expert or Custom Indicator (see the Expert Advisor Creation and Custom Indicator Creation sections of this tutorial).

To set up Script parameters, open the Options window and select the "Expert Advisors" tab. To open the window:

  • In the Main Menu > Tools > Options; or
  • Pressing CTRL + O on the computer keyboard.
Five options influence the operation of Scripts:

  • Allow live trading - to enable Experts in real-time mode (rather than testing an Expert on historical data).
  • Ask manual confirmation - to send trade confirmation prior to submitting the order.
  • Allow DLL imports -to use DLLs to enhance Expert functionality.
  • Confirm DLL function calls - to allow control over the execution of each called function.
  • Allow external experts imports - to allow the Expert to access functions from other Experts or MQL4 libraries.
Removing a Script
A Script automatically shuts down once it has completed its function one time. Traders can, however, remove a Script manually. To remove a Script from a chart, right-click on the chart and select "Remove Script," as shown in Figure 20.

Figure 20 - To remove a Script from a price chart, right-click on the chart and select "Remove Script" from the chart context menu.

Options for Non-Programmers
People who are not interested in learning how to program in the MQL4 language can still take advantage of Experts, Custom Indicators and Scripts. A growing number of commercially available products can be purchased at various trading-related businesses online, and MT4 users can also hire a qualified MQL4 programmer to perform the coding.

It is important to note that when working with a programmer, all ideas must be quantifiable and objective. For example, if the trader wants to enter a long position when price goes above a moving average, he or she will have to specify the moving average length, the precise entry point (next bar on open, for example) charting interval and even the trading instrument. Most programmers will not accept jobs that entail a lot of guesswork on the part of the programmer, and so project specifications need to be absolutely clear.

In general, if a commercial Expert, Custom Indicator or Script has been purchased, it will come with specific installation instructions. Similarly, a programmer will typically include instructions for installation. It is always valuable to read the instructions before attempting the installation to avoid any complications.

Advanced Guide To MetaTrader 4 - Strategy Testing And Optimization

Related Articles
  1. Trading

    Advanced Guide To MetaTrader 4 - Expert Advisors

    Expert Advisor CreationExpert Advisors are programs that allow automation of the analytical and trading processes in the MT4 platform. To create an Expert Advisor (or "Expert"), the expert editing ...
  2. Investing

    This Leader Is 18% Undervalued... And That's Just the Beginning

    Trading on headlines can be some of your best investments on the long- or short-side. Investors get so caught up in the herd mentality that even headlines with little real fundamental importance ...
  3. Trading

    Advanced Guide To MetaTrader 4 - Custom Indicators

    Custom Indicator CreationIndicators are used to analyze past and current price information to help traders predict future price movement. In addition to a wide variety of technical indicators ...
  4. Trading

    Beginner's Guide To MetaTrader 4: Advanced Features

    By Jean Folger Connecting MT4 to a Mobile DeviceAs people are becoming more dependent on electronic devices, many forex brokers now offer applications to support MT4 on mobile devices. The ...
  5. Markets

    Drug Prices: Name Brands Doubled in Last 5 Years (ESRX)

    Express Scripts' Drug Trends Report, released Monday, revealed that the average price of brand name drugs rose 16.2% in 2015, with over one third of brand name drugs seeing price increases over ...
  6. Trading

    Advanced Guide To MetaTrader 4 - Strategy Testing And Optimization

    MT4 enables traders to test Expert Advisors prior to using them in a live market. This allows traders to evaluate the Expert's efficiency and to confirm that it operates as expected.Tester WindowMT4's ...
  7. Trading

    How To Place A Trade With MetaTrader 4 - Main Screen

    MT4's main screen is comprised of five primary sections. It is helpful to become familiar with each section prior to placing any trades. The center of the screen is where the various price charts ...
  8. Trading

    Beginner's Guide To MetaTrader 4: Setting up a Trade

    By Jean Folger Connecting to Data Centers/Live Accounts and Historical DataOnce MetaTrader 4 has been launched, an account opened (even a demo account), and the connection confirmed, traders ...
  9. Trading

    Beginner's Guide To MetaTrader 4: Basic Navigation

    By Jean Folger MetaTrader Navigation/Main WindowBy default, MT4 opens with four chart windows, each representing a different currency pair. The toolbars, populated with many icons, are located ...
  10. Trading

    Beginner's Guide To Fidelity's Active Trader Pro: Charts And Settings

    Charts can be customized to suit each trader's individual needs and preferences. To open a chart, from the Main Menu select "Tools" and then "Charts." From here, traders can choose "Symbol Lookup" ...
Trading Center