Advanced Guide To MetaTrader 4 - Scripts
  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

Advanced Guide To MetaTrader 4 - Scripts

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

  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
RELATED TERMS
  1. Expert Network

    A group of professionals who are paid by outsiders for their ...
  2. Click Fraud

    Click fraud is the act of illegally clicking on pay-per-click ...
  3. Manager Of Managers - MOM

    A class of financial intermediary that hires professional investment ...
  4. Aggregate Function

    A mathematical computation involving a set of values rather than ...
  5. Functional Currency

    The primary type of money that a company uses in its business ...
  6. Economist

    An expert who studies the relationship between a society's resources ...
RELATED FAQS
  1. Do you have to be an expert investor to trade put options?

    Learn about investing in put options and the associated risks. Explore how options can provide risk, which is precisely defined ... Read Answer >>
  2. If I have only a limited amount of time to study for the Series 6, what should I ...

    Learn what to focus on when studying for the Series 6 while reviewing important aspects of the exam, including its content ... Read Answer >>
  3. What is the utility function and how is it calculated?

    Learn what the utility function is in microeconomic theory and how it is calculated based on a functional form that represents ... Read Answer >>
  4. For what reasons are electronics stocks commonly purchased by a value investor?

    Learn about the breakdown of subjects on the Series 6 while reviewing important aspects of the exam, including its content ... Read Answer >>
  5. What are some common functions of business intelligence technologies?

    Understand the common functions of business intelligence technologies, and learn how business intelligence is used to increase ... Read Answer >>
  6. What does high open interest tell you about an option?

    Learn about the open interest of options contracts and what a high and a low open interest indicate about the liquidity of ... Read Answer >>

You May Also Like

Hot Definitions
  1. Cost Of Debt

    The effective rate that a company pays on its current debt. This can be measured in either before- or after-tax returns; ...
  2. Yield Curve

    A line that plots the interest rates, at a set point in time, of bonds having equal credit quality, but differing maturity ...
  3. Stop-Limit Order

    An order placed with a broker that combines the features of stop order with those of a limit order. A stop-limit order will ...
  4. Keynesian Economics

    An economic theory of total spending in the economy and its effects on output and inflation. Keynesian economics was developed ...
  5. Society for Worldwide Interbank Financial Telecommunications ...

    A member-owned cooperative that provides safe and secure financial transactions for its members. Established in 1973, the ...
  6. Generally Accepted Accounting Principles - GAAP

    The common set of accounting principles, standards and procedures that companies use to compile their financial statements. ...
Trading Center