How To Install Custom Indicators Into Metatrader 4 (MT4)

Although Metatrader 4 already comes packed with the standard ‘out of the box’ MT4 indicators –  trader’s and developers have had the ability to create their own custom indicators for many years now.

Now there is literally a pool of thousands of free indicators out there to download.

If you want to try them, but don’t want to keep asking that friend ‘knows computers’ to help you, you’re really going to need to master the installation process for yourself – which is exactly what I am about to show you.

In this tutorial, I am going to show you how you can easily install custom coded indicators into your MT4, revealing some other tricks and tips other people might not tell you.

First I am going to list the steps in point form, then discuss them in more detail through the rest of the article.

Note

I will be using my Battle Station indicator for MT4 for the example indicator I am going to install with you in this lesson.

 

MT4 Indicators Installation Video Tutorial

 

How to Load Custom MT4 Indicators - Quick Steps

  1. Open Metatrader, then open the data folder by selecting File->Open data folder
  2. Copy .ex4 and .mq4 indicator files to the /mql4/indicators folder
  3. Copy any .dll files to the /mq4/libraries folder
  4. Enable .dll files inside MT4 by selecting Tools->Options, select the ‘expert advisors’ tab, and checking ‘Allow DLL Imports’ (Only if indicator is using .dll files)
  5. Refresh MT4 by closing, and re-opening it, or select indicators in the navigator->right click->select ‘refresh’
  6. Select, or open the price chart you want to load the indicator onto, then double click, or click-and drag the indicator to apply it to the chart.
  7. Check the expert tabs for any errors that occur on indicator load, and act accordingly
  8. Enjoy your awesome holy grail, 10,000 pips a month super indicator

 

Understanding The MT4 Indicator Files

This section may be a little basic for some, but from my experience with an earlier version of the Battle Station – some people aren’t as savvy with computers and need the basics covered.

If your computer knowledge level is over 9000, and you don’t need to read this part, you can skip to the next section.

First thing you really need know is what the indicator files looks like – and to do that I just need to explain file extensions for a moment.

A file extension allows the operating system, such as windows, to identify what type of file is it. That way it knows what program to open the file in – like when you double click on the file, the OS knows what program to open it in.

Some examples:

  • A .txt file is a text file, and the OS knows to open it in a text editor
  • A .jpg (‘myAwesomeSelfie.jpg’) for example, is a common picture file, which will be opened by the default photo viewer
  • A .mp3 file is a music file (‘Justin Bieber – Baby.mp3’), which the OS knows to open it in your favorite music player

The file extension for an indicator is either .ex4 or .mq4

  • a .ex4 file is a compiled version of the indicator which only the computer can understand
  • a .mq4 file is the source code, which is human readable text that is eventually converted into the .ex4 complied version for the computer to read

file extentions explained windows examples

Pro Tip

By default, Windows will hide file extensions. If you want to make them visible (which I always do), follow these steps.

  • Open the control panel, and search for folders
  • Look for ‘File & Folder Options’, or ‘File Explorer Options’. The description will vary with what version of Windows you have.
  • Click on the ‘view’ tab
  • Uncheck ‘Hide extensions for known file types’

If you have the MT4 Indicator source code file (.mq4),  then you can: view the indicator’s code, make changes to it, change its behavior etc… you can basically do anything you want with the source code.

If you only have the .ex4 file, then you won’t be able to ‘customize’ the way it works internally, because a complied file is the final binary file, something only a computer understands.

I only release my Battle Station price action indicator in the format of an .ex4 file only.

The reason being is the source code is basically my intellectual property. Giving away an awesome program’s source code is like asking a chef for their secret recipe – sometimes you might get it, but most times they will just want to keep it to themselves.

You will find that many high end indicators will only be released in the .ex4 ‘compiled format’, where the creator doesn’t want the secrets of the program exposed to the public.

I should make an important note here…

Metatrader uses exactly the same file extensions for

  • Indicators
  • Trading Robots (expert advisors)
  • Scripts

So that means you can’t really tell if the .ex4 file is a robot, indicator, or script – as they all come as .ex4 files (or .mq4 if you’ve got the source code).

In that case, it is obviously up to the person who created the tool to tell you what kind of metatrader 4 plugin it is, so you can install it in the correct place. This is rarely an issue though.

Another Important Note – About .zip Files…

When you download your indicator, you might not receive it in .ex4 or .mq4 format.

Occasionally the indicator authors will compress the file first, usually as a .zip file. A zip file is a ‘compressed storage container’ that can hold many files at once, while reducing their size at the same time.

This makes the download process simple, you just download one zip file and it contains all you need.

Windows naturally supports .zip files, so if you download an indicator and it is ‘zipped up’, it is only a small extra step to ‘unzip the file’.

Just double click on the zip file, and a window should open revealing what’s inside. In very rare cases, the .zip file can be password protected, and you need to know it to gain access.

Once you’ve ‘opened’ the .zip file, your custom Metatrader indicator files should be inside. You need to extract them first before you can use them. A simple click-and-drag will usually do the trick.

You might also receive the file in .rar format – which windows does not support. It is another type of compressed storage file, but you will need to download winrar to be able to work with .rar files.

Summary

Indicators come in two file formats – .mq4 and .ex4, but ultimately the .mq4 file is converted to the .ex4 version as that is the final file format MetaTrader needs to load the indicator. ‘.mq4’ files are converted automatically when placed in MetaTrader. Also note that the other type of MT4 plugins share these file formats, so make sure you know you’re dealing with an indicator file, not a trading robot or script.

 

The Step-by-Step Guide Installation Process For Custom Indicators

Now hopefully you have a better understanding about file extensions, so let’s take those indicator files and install them into MT4.

The process is simple, you really just need to move a few files around, and on occasion, adjust a few settings in Metatrader 4.

It doesn’t matter if you have either the .mq4 or .ex4 file, the installation process is the same.

 

1. Open The MetaTrader 4 Data Folder

Your metatrader is going to be looking in a specific place for it’s files. This location can change depending on a few factors like:

  • If you installed Metatrader for the local user
  • If you installed Metatrader for any user access
  • If you’re running Metatrader in portable mode

Regardless of what state your MT4 is running in, getting to the data folder is very easy.

Open MT4, the select file->open file location

open-data-folder mt4

A folder will pop-up – this is the working data folder your MT4 wants it’s files in. If you ever need to install any files into Metatrader 4, use this method.

 

2. Copy The MT4 Indicator Files Into Their Appropriate Folders

The .mq4 and .ex4 indicator files need to be placed in the /mql4/indicators directory. So open the ‘mql4’ folder you see, then open the ‘indicators’ folder, dump the appropriate files here.

installing-indicator-files

Some of the more advanced indicators will come with a .dll file type.

A .dll file extends the functionality of MT4, it allows the indicator to perform tasks which Metatrader cannot handle. The Battle Station comes with a file called TFG_tools.dll, so we need to also place that in the appropriate folder.

Metatrader looks for .dll files in the /mql4/libraries foler.

Repeat step 1 to get into the data folder – but this time open the mql4 folder, then open the libraries folder. Now place the .dll file of your indicator here, in this case copy TFG_tools.dll to this location.

The Battle Station will not work without that .dll extension file.

A warning about .dlls

As I mentioned, .dlls allow Metatrader to extend it’s ‘reach’, and tap into windows functions. That means an indicator utilizing a .dll could potentially have malicious code in it.

Don’t use .dlls from untrusted sources. Any malicious code in a .dll would hopefully be blocked by a good virus scanner, but just to be on the safe side – don’t use .dlls from suspicious places.

 

3. Enable .dll Functionality In MT4’s Settings

If you’re indicator is using .dll’s then you will need to give Metatrader permission to use them.

There are two ways of doing this.

  • Through the global options, so .dll calls are enabled automatically every time you load the indicator
  • On ‘per indicator’ basis, where you have to enable .dll calls for that indicator in it’s local settings when you load it

If you’re going to be using the indicator a lot, I recommend enabling .dlls using the global options. But I will show you both ways.

 

Enabling .dll Calls Globally (Recommended when using trusted tools only)

Simply select tools->options from the menu, or simply use the keyboard shortcut CTRL+O

This will bring up the global options menu, select the ‘expert advisors’ tab.

global-dll-options-mt4

Check the box that says ‘Allow Dll Imports’. You will also notice Metatrader also gives the same warning as I did above about .dlls

Press OK, and that’s it – you don’t have to worry about it anymore, dlls will be enabled automatically when you load your indicators and other tools on your MT4 charts.

 

Enabling .dll Calls on a per Indicator Basis

This method is a little tedious, but someone might want to use this method as they want to give permissions for some tools to be able to load .dlls and others not.

Every time you load a tool, like an indicator or robot onto your charts, you will first see a input box pop up.

on-load-dll-enable-for-mt4-indicators

When this box pops up, select the ‘common tab’, then check ‘Allow DLL imports’ here.

This gives the tool permission to use .dlls only for that session, next time you load it, you will probably have to keep checking that box.

 

4. Refresh Metatrader 4 to Load the Indicator Into Its List

Once you’ve placed the files in right places, and enabled DLL calls (if you needed to), the next step is to refresh your Metatrader to make the custom software available in the indicator list.

There are two ways to refresh MT4

  • Close MT4, then re-open it (old skool way)
  • Use the refresh command (takes one second)

The refresh command is like a soft re-initialization of Metatrader 4, without having to restart it. This allows any new MT4 installed indicators to be loaded into the system.

To send the refresh command, find the ‘Navigator’ window, which is usually in the bottom left corner.

If it’s not there, click view->Navigator, or press CTRL+N to make the navigator window pop up. The navigator window is where you will load all your custom indicators from.

To send the refresh command:

  • Click on indicators within the navigator window
  • Make sure it is highlighted blue to show it is selected
  • Right click on the mouse
  • Select ‘Refresh’

refresh-indicator

Now you should see the list flicker for a second as it reloads. Next expand the indicator tree by double clicking on the same indicators object we selected before.

If you’ve done all the following steps correctly you should see the indicator in the list ready for use.

 

5. Load the MT4 Indicator Onto a Chart

Before you do anything else, make sure you’ve got a chart open. Indicators will only work when attached to a chart.

If you’ve got multiple charts open, first select the chart you want to load the indicator onto, so it is ‘in focus’.

Double click on the indicator from the navigator window, or click-and-drag it onto the chart. That tells Metatrader that you want to load this indicator on this chart.

loading-indicator-on-chart

Once you do that, the indicator will start by bringing up the standard popup window, where the Metatrader indicator has input options you can customize if you want.

The price action Battle Station has many input options you may want to tweak to your liking before continuing. More on that later.

Once you press OK, your indicator should appear on your chart.

 

Something Went Wrong? Checking for Common Problems

From my experience, most of the errors are user related, when all the steps are not followed correctly.

This is especially true when dealing with an indicator that uses a DLL files, like the Battle Station does. Make sure you always check .dll files are enabled if they need to be.

Most of the time, you will get a better understanding of why your MT4 indicator is not working by checking the experts, and journal tabs, which are located down the bottom of Metatrader 4.

Here are a few things to check:

  • If the indicator is not in the list, double check you placed it in the correct folder. Otherwise close MT4, and re-open it – check the experts tab to spot any errors when MT4 tries to load the indicator.
  • Make sure DLL files are enabled, I’ve found this to be a common problem
  • Check the Expert Tab when you try to load the indicator on the chart, you may see an error message like ‘Array Out of Range’ – which is a flaw in the coding, and you will need to report the error to the author
  • Make sure your MT4 is up to date with the latest version. If the indicator was compiled in a later version of MT4 than yours, then it might not work in your older version. Check with the creator what version is needed. These days MT4 does auto updating anyway.

Summary

If your indicator is refusing to load, the best place to check why is the experts tab. Most errors are picked up and reported here by MT4. It may not be your fault, it could be a bug in the code which the creator will need to fix.

 

No Errors – But Can’t See Anything on the Chart?

Quite often, an indicator will load with no errors, but you can’t see anything on the chart. This is usually caused by a setting inside MT4’s drawing rules.

Normally an indicator should draw on top of the chart, but for some f**ked up reason, some MT4 broker installs set by default for the chart to be drawn over the top of the indicator, making it hard to see.

To fix this, do the following

  • Right click on your chart, to bring up the sub-menu. Click properties, or simply press F8
  • Select the ‘Common’ tab
  • Uncheck ‘Chart on foreground’
  • Press OK

chart-properties-fix-mt4

Summary

Now the MT4 indicator will actually draw on top of the chart, and your frustrations are now alleviated.

I hope this tutorial has shed some light on how MT4 really works, and smoothed out the installation process for you.

Installing indicators into Metatrader 4 should be a painless process for you.

If this guide was helpful, please let me know in the comments below.

Best of luck with your new custom indicator.

3 Comments

  1. sinuthi October 23, 2016
  2. martin January 21, 2017

Please Leave Your Comment Below...