The Local Trade Copier v2.1 is the first account copier for Metatrader 4 that allows the filtering of trading signals by using external indicators or Global Variables (GV). If you ever wonder if you can make your trade copier software skip the long positions (buy trades) when a market price is below a Moving Average indicator then the new features in the LTC are exactly what you need. Any MT4 indicator can be turned into a LTC “trade filter indicator” and you can even use this option in your own software in order to control the trade copier.

By using “trade filter indicators” you can also setup the trade copier software in such a way as to not copy trades of certain currency pairs under certain indicator conditions. Say you want long trades to be copied only when the MACD indicator bars are above zero. Or maybe you want the EA copier to skip and not copy any of the trades when the market price is inside the Bollinger Bands channel? The trade filter indicators can be applied to any number of currencies of your choice.

How did I come up with the idea for the ‘’Trade Filter Indicators’’? I encountered a problem when I wanted to copy trades from one account using an investor password. Most of the trades were excellent but some of them were really bad, like going against a very strong trend for example. I noticed that i could use two MT4 indicators to avoid these really bad trades, but the problem was that i had no access to the master account. I didn’t even know if the trades were manually opened or generated automatically. So i had to find another solution to avoid some bad trades like going long when the MACD is below zero and the market price is below a Moving Average.

For this reason I invented the “trade filter indicators”. They are basically the same native MT4 indicators, but they are programmed to communicate with the Local Trade Copier software. The trade filter indicators are using Global Variables to tell the copier EA if long, short or both long and short trades should be ignored and not copied.

To enable this feature please set ExternalTradeFilter=true and make sure that the ExternalTradeFilterPrefix matches the same value in your external filter indicator settings, as shown on the picture below.

External trade filter settings in Local Trade Copier

External trade filter AC settings

In the picture above you can see the “Accelerator Oscillator trade filter indicator”. Note that filter prefix matches with the filter prefix in the Client EA settings. You can use different prefixes for individual instances of the Client EA when using different magic numbers. The indicator can be set to ignore BUY trades when AC indicator bar is below zero. This means that when the AC indicator is below zero only the sell trades will be copied. And reversely, you can set the indicator to ignore SELL trades when AC indicator bar is above zero. In this case only the buy trades will be copied whenever the AC indicator is above zero.

Where can I find the Local Trade Copier trade filter indicators and how can I use them?

The LTC v2.1 comes with several filters pre-installed for you under the „Custom Indicators“ in the Navigator window. Their name usually starts with the „LTC Trade Filter – X“, X is the name of the indicator the filter is added to. For example, „LTC Trade Filter – MACD“ is the trade filter that uses the MACD to determine whether to take a trade or not.

Trade filter indicators in MT4 navigator window

To use an external trade filter indicator you need to click on it and drag it to the chart of your choice. For example, if you want the Client EA to filter trades for the USDCAD currency pair, you should attach a trade filter indicator to a USDCAD chart. Choose the time frame that you will use and then drag the indicator on the chart. The Client EA will then start using this trade filter immediately.

Local Trade Copier trade filter MACD on usdcad m5

In the picture above you can see the “trade filter indicator for MACD” attached on a USDCAD 5 minute chart. The indicator displays the regular MACD indicator bars and constantly reports its status to the LTC Client EA. You can also see a “BUY ONLY” message in the right-top corner of the MACD window. This means that only buy trades are allowed at the moment because the MACD bars are above zero.

How does the trade copier software read trade filter indicators?

The trades are filtered at the client’s end as this feature is incorporated into the Client EA. The indicators are applied for each MT4 platform individually. At the moment trades can be filtered by using the Accelerator Oscillator, Awesome Oscillator, Bollinger Bands, MACD and the Moving Average indicator. There will be more indicators added in near future, but you can also create your own indicators if you have some MQL4 programming skills. More about that later.

When a trade filter indicator is attached to the chart it will scan the currency price and will display the indicator lines and/or bars like a regular indicator would. Additionally, the indicator will set one or more Global Variables (GV) in the MT4 memory which basically tells the Forex trade copier software what positions it should ignore and not copy. If you press F3 or go to the MT4 menu under Tools | Global Variables, you will find a list of all the variables that are created at the moment. These can be created by any indicator or Expert Advisor or even manually.

Global variables in MT4 Local Trade Copier trade filter values on 5 indicators

When a GV is created the Local Trade Copier program will take it into consideration every time a trade is sent from a master account for that particular currency pair. For example if we have a MACD trade filter indicator loaded on an EURUSD chart and we have it set to ignore long trades when the MACD indicator bars are below zero, a GV will be created which would look like this: #trade-filter-buy-EURUSD-MACD.

This GV tells the trade copier not to copy any long positions (buy trades) on the EURUSD pair only. If a long position is initiated on a master account on any other currency pair the Client EA will copy the trade as usual.

The #trade-filter is the default prefix that both the indicator and trade copier EA are using. This can be changed if needed, but keep in mind that the prefixes must match in order for the trade copier to read the trade filter indicator commands. It doesn’t matter what value those GVs are set to, if they exist the trade copier will take them into consideration.

Using a prefix is useful if you have multiple Client EA’s running on the same MT4 platform. Note that in such an advanced setup, each Client EA must have its own unique Magic Number set, which is not zero (and this disables the partial close feature).

If you want to use the same trade filter indicator multiple times, for example, you want to filter trades with two moving averages, the 13 and the 26 periods MAs. In this case, you should still set the same prefix for both indicators (#trade-filter). Indicators will automatically make the GV variable name unique so that Client EA understands them as separate filters. Of course, make sure the trade copier is using the same prefix too (ExternalTradeFilterPrefix).

Creating Global Variables by yourself

It is possible to create those GVs by yourself, both manually and programmatically. Say you want the trade copier EA not to copy any short positions in the USDJPY currency pair. In this case, all you need to do is open the Tools | Global Variables window and create a global variable with the name #trade-filter-sell-USDJPY. Make sure that the prefix matches both the EA settings and the indicator settings.

If you want to create a GV programmatically you need to use the GlobalVariableSet function in the MetaEditor. You will need MQL4 programming skills to do this or you can hire a programmer to create an app for you.

When you create GVs programmatically you can basically control the Local Trade Copier from a 3rd party application anytime by allowing or disallowing the copying of certain trades. Here is an example of the MQL4 code which can be used to create a GV that will tell the Client EA not to copy long trades in the GBPUSD currency pair.

string TF_NAME = “appName”; //this is your unique app name
string ExternalTradeFilterPrefix = “#trade-filter”; //this is the prefix for variable
string trade_type = “buy”; //trades that should be ignored
string currency_pair = “GBPUSD”; //currency pair the filter is applied to
string TradeFilterNameBuy = ExternalTradeFilterPrefix + “-” + trade_type + “-” + currency_pair + “-” + TF_NAME; //create the name for a GV
GlobalVariableSet(TradeFilterNameBuy, 1); //create the GV

Or it can be as simple as this:

GlobalVariableSet(“#trade-filter-buy-GBPUSD-myapp”, 1);

When you want to remove the filter so that Client EA starts accepting long trades again just use the GlobalVariableDel function.

Here is an example on how to delete the GV that we created previously.

GlobalVariableDel(“#trade-filter-buy-GBPUSD-myapp”);

Once that GV is deleted, the Client EA will start accepting any new long positions in the GBPUSD pair.

If you want to remove all filters that start with a certain prefix you can use the GlobalVariablesDeleteAll function. For example to remove all GVs that begin with #trade-filter you should use

GlobalVariablesDeleteAll(“#trade-filter”);

Trade filter indicator settings

Usually there are not many settings for the trade filter indicators, but let’s see what you can find here.

ExternalTradeFilterPrefix – This is where you set a prefix for the GVs that this indicator will create. It should match the same variable in the Client EA settings. The default value is “#trade-filter”.

BarIndex – Here you can set which bar the Client EA should look at. For example if you set this value to 0 (zero) the EA will monitor the current price bar. If you set this value to 1, the EA will monitor the last closed price bar. You can set any number that you want. The default value is 1.

IgnoreBuy_BarBelowZero – Here you can choose if the trade filter indicator should ignore buy trades (long positions) when the indicator’s bar is below zero. The default value is true which means that when this feature is turned on the Client EA will ignore buy trades when the indicator’s bar is below zero.

IgnoreSell_BarAboveZero – Same as above, just in reverse. You can choose if the trade filter indicator should ignore sell trades (short positions) when the indicator’s bar is above zero. The default value is true which means that when this feature is turned on the Client EA will ignore sell trades when the indicator’s bar is above zero.

You will notice that there will be different settings in each trade filter indicator, but they all have self-explanatory names and are used in a similar way.

Filtering trades with the MACD indicator

To load the MACD trade filter simply click this indicator in the Navigator window under “Custom Indicators” and then drag and drop it on a chart of your desired currency pair and time frame. Before the indicator appears on the chart it will show the settings window where you can set up how it should operate.

Indicator inputs MACD Local Trade Copier trade filter

In the example below we have a MACD filter indicator attached to the GBPUSD M15 chart. See how the MACD indicator shows a “BUY ONLY” message in the top-right corner of the indicator window area. This is because the MACD indicator’s bars are above zero and thus only buy trades are allowed.

MACD Local Trade Copier trade filter on gbpusd m15

In this state the MACD trade filter indicator creates a Global Variable to let the Local Trade Copier know that all sell trades (short positions) should be ignored and not copied. In the next picture you can see the Global Variables window with the trade filter GV that was created.

Global Variables MT4 Local Trade Copier trade filter value

When you add multiple trade filter indicators on the chart of the same currency they all will be taken into consideration when a trade is received from a master account. This means that if you have a MACD filter showing a “BUY ONLY” and another filter for the Accelerator Indicator that shows “SELL ONLY”, the Client EA will not copy any buy or sell trades.


Rimantas Petrauskas
Rimantas Petrauskas

First I am a father, a husband and then the author of the book “How to Start Your Own Forex Signals Service”. I am also a Forex trader, a programmer, an entrepreneur, and the founder of ea-coder.com Forex blog. I have created two of the most popular trade copiers and other trading tools for MT4 that are already used world wide by hundreds of currency traders.

    4 replies to "First account copier with external trade filtering indicators"

    • Teri Patterson

      Very cool new feature and creative programming! We will keep this in mind if we ever need this tool in the future. Thanks!

      • Rimantas Petrauskas

        Thanks Teri. For now it is available in Local Trade Copier only, but soon I will add that into Remote Trade Copier as well.

    • David Ofori

      hello brother
      i wish to find out if i have a strategy, can you create an EA for me? if yes may i know all your quotations.
      thank you

      • Rimantas Petrauskas

        Dear David,

        thank you for your interest in my services.
        Unfortunately I am already booked for the next few months and cannot accept more projects.
        I will be glad to forward your programming request to my partners.
        Please go to the link below to fill in your request.

        http://www.ea-coder.com/request-a-price-quote-for-mt4-programming-services/

        Thank You

        Regards,
        Rimantas Petrauskas

Leave a Reply

Your email address will not be published.