MT4 Script Download on MQL4 and more

You are probably already familiar with the MetaTrader 4 platform. Read more about the platform and study Metatrader 4 tutorial.

What is a script in FX trading and how do you use it?

To make the life of traders easier, many programs and different trading assistants have been created. A script is one of such programs.

A script is a simple utility program that helps automate a one-time action. A trader is the one who determines what action needs to be performed.

Scripts are especially useful for scalping and grid trading strategies as they save a lot of time. The thing is, scripts can perform a number of specified actions at once.

Using scripts you can:

  • calculate the lot size;
  • identify the exact spot for placing Stop Loss and Take Profit;
  • set a grid;
  • make a calculation for wave analysis (for Elliotte Waves, for example);
  • close all profitable or losing orders;
  • check data on swaps and spreads;
  • plot trendlines and other patterns on the chart.

All in all, there are more than a hundred different assisting programs serving various purposes, including informative, analytical, or trading activities.

Difference between Scripts and Expert Advisors

As mentioned above, scripts are designed to perform a single action, and this is their main difference from advisors.

Expert Advisors are working non-stop in accordance with an algorithm, while scripts are used whenever needed. In other words, once the process is completed, a script will stop functioning by itself.

There are certain advantages of such a single-action approach since traders have more control over the process along with the assisting program.

MT4 script download and adding to platform

There are roughly four stages of working with scripts:

  • Creating. A script is a program written in the MQL programming language. So, a special editor is required to create it.
  • Setting up. Every program has its own settings. However, there are general parameters that need to be set up on the platform before working with any scripts.
  • Launching. This is the stage when a script is added to the chart.
  • Closing. At this stage, the script is removed from the chart.

It should be noted that MetaTrader 4 provides some standard forex scripts (just like indicators and expert advisors) by default.

They can be found on the Navigator panel in the Scripts tab. This is where all the additional scripts will be placed as well. By clicking“+”, you can view the list of all saved scripts.

MT4 offers the following standard scripts:

  • Close All Buy - closes all buy positions;
  • Close All Sell - closes all sell positions;
  • Close All - closes all positions at once;
  • Period Converter - designed to create a non-standard time frame;
  • Close All Profit - closes all profitable positions.

Adding a script is easy:

  • First, you need to extract the script from the zip file;
  • Then paste the downloaded file into the Experts/Scripts folder linked to your trading platform;
  • Important! The trading platform must be closed;
  • When the file is added to the folder, go to Navigator and then to Scripts;
  • Find the tab named Apply to chart. Done. Here you can also delete or modify scripts.

You can read more about the setup process on the platform itself by pressing F1 and viewing the Auto Trading → Scripts menu.

Useful scripts: expert choice

What makes MT4 so popular is that it can be adjusted to your personal needs. Therefore, a script can become a useful tool for every trader.

You will find numerous trading programs online but not all of them are actually useful.

Below, you will find the scripts that really work:

A clean-up script that speeds up the platform

This script helps you clean up the platform. If you use advanced indicators, expert advisors, and other trading assistants, MetaTrader 4 needs a clean-up from time to time. Otherwise, the platform becomes very slow as it is loaded with unnecessary stuff.

The power capacity of your computer is of little help here because an overloaded platform is unable to switch quickly from one chart to another. Besides, this can lead to failures when adding an indicator to the chart.

And the worst thing is that the platform may malfunction when you open or close orders.

That is why the CleanUp Script is so useful. Run it once to make MT4 fast again.

A script that opens pending orders in the opposite direction

Traders who rely mostly on fundamental analysis, that is, carefully monitor the news before trading, will especially appreciate this script. It often happens that after the publication of important data one of the orders set in the opposite direction is triggered.

By using this script, a trader can stay on the safe side. The main function it offers is the possibility to move the order by a few pips from the current price, set a Take Profit and stop orders, and choose trade size.

A script that closes all open orders

It closes all open orders within a second. This script will be especially useful for those who use the grid trading strategy.

A script that limits losses and risks

Here is another multifunctional trading assistant. It provides additional protection from losses and minimizes risks. The script will be especially appreciated by traders who are always worried about losses.

How does it work? Let’s say, the price is moving in the desired direction and then it suddenly reverses to the other side. Of course, this will trigger the Stop Loss. In this case, the script will move the stop-loss order to the entry point.

The same can be done with a Take Profit.

A script that opens orders quickly

This tool can open any type of orders in one go, bypassing standard windows for opening positions.

When you apply it to the chart, you will see a table that appears below it and that is easy to understand. So, this is where a trader can open/close positions in one click, set the breakeven level, and much more.

Notably, this script works with all types of orders and not just standard ones.

Other rare but good forex scripts:

  • For moving a stop-loss order. It is also called a trailing-stop script and is very similar to an advisor. However, bear in mind that this is a script and it won’t run without activation;
  • For calculating lot size (in %) based on the size of your deposit. It is set at 5% of the deposit amount by default;
  • For reversing open positions. It is used when trading goes against the plan. The program opens new positions when opened trades turn out to be unprofitable.

The idea behind it is that the script reverses a position at the stop-loss level. Besides, it can also open new orders.

MQL4 script language

Scripts, as well as expert advisors and indicators, are written in a special programming language - MetaQuotes Language 4.

If you want to create trading assistants for MT4 yourself, you should learn how to work with this language.

Some traders prefer to ask MQL programmers to create the necessary script for them instead of downloading or writing them on their own.

The basics of script writing

If you feel like writing a script yourself, read the instructions below.

First steps you need to take to create your own script:

  • First, you need to open a special editor for creating scripts - MetaEditor.
    Open the platform and press F4 to launch it.
  • When it opens, find the File tab in the Menu and then click New.
  • After clicking New, you will see the list of trading assistants that can be created. Pick the one you need and click Next.
  • A window will pop up. In the Name field, put the name of the script (any you like). Write your name in the Author field and email or website in the Link field. Then press Done.
  • After that, the main window for writing a script will open. At this point, you need to study the basics of MQL programming.

Getting started: compilation and source code

A source code is everything that you write in MetaEditor. Even an “empty” script will have a source code.

The source code is a sequence of commands that the platform should execute. They go in a particular order, from top to bottom.

However, MetaTrader cannot read this code. For this, the created code must be compiled, that is, translated to the proper language.

To perform the compilation, press F5 in the editor. This will transform the code into a file. Now your code can be read and understood by the MT4 platform.

But how do you write a script? As we have mentioned above, any script that has just been created and given a name already has a code. To make it work, place the source code between the lines Int start(){ and return(0);}.

To learn more about what codes should be written in this field, go to specialized coding resources.

Final thoughts

A script is an important part of technical tools along with expert advisors and indicators.

It is up to you whether to use them or not. Yet, the experience of many traders proves that these assistants can be very effective.

If MT4 script download and used wisely, scripts can make your trading more profitable and stable.

The main thing is to create your own set of scripts by trial and error. This way, you will get the tools that are perfect for you and suit your trading style.

Read more:

MT4 vs MT5: Explaining Difference

Metatrader 4: review from popular sources

Forex MT4 Robot: How to Create and Set Up

MT4 Template Download