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. Paper Trade

    Using simulated trading to practice buying and selling securities ...
  2. Prime Of Prime - PoP

    A brokerage that provides service to traders (especially Forex ...
  3. Digital Currency Exchanger - DCE

    A market maker who exchanges legal tender for electronic currency, ...
  4. Bid And Asked

    A two-way price quotation that indicates the best price at which ...
  5. No Dealing Desk

    A way of forex trading that provides immediate access to the ...
  6. Micro Account

    A forex trade made up of contracts for 1,000 units of currency. ...
RELATED FAQS
  1. What are the maximum Social Security disability benefits?

    The average Social Security disability benefit amount for a recipient of Social Security Disability Insurance (SSDI) in 2 ... Read Full Answer >>
  2. How do I calculate the future value of an annuity?

    When planning for retirement, it is important to have a good idea of how much income you can rely on each year. There are ... Read Full Answer >>
  3. Have hedge funds eroded market opportunities?

    Hedge funds have not eroded market opportunities for longer-term investors. Many investors incorrectly assume they cannot ... Read Full Answer >>
  4. Are high yield bonds a good investment?

    Bonds are rated according to their risk of default by independent credit rating agencies such as Moody's, Standard & ... Read Full Answer >>
  5. What is the relationship between the current yield and risk?

    The general relationship between current yield and risk is that they increase in correlation to one another. A higher current ... Read Full Answer >>
  6. What is a 'busted' convertible bond?

    In finance, a convertible bond represents a hybrid security that offers debt and equity features and risks. While a convertible ... Read Full Answer >>
Hot Definitions
  1. Short Selling

    Short selling is the sale of a security that is not owned by the seller, or that the seller has borrowed. Short selling is ...
  2. Harry Potter Stock Index

    A collection of stocks from companies related to the "Harry Potter" series franchise. Created by StockPickr, this index seeks ...
  3. Liquidation Margin

    Liquidation margin refers to the value of all of the equity positions in a margin account. If an investor or trader holds ...
  4. Black Swan

    An event or occurrence that deviates beyond what is normally expected of a situation and that would be extremely difficult ...
  5. Inverted Yield Curve

    An interest rate environment in which long-term debt instruments have a lower yield than short-term debt instruments of the ...
  6. Socially Responsible Investment - SRI

    An investment that is considered socially responsible because of the nature of the business the company conducts. Common ...
Trading Center