Skip to main content

How to tell MT4 trade copier not to close specific trades but keep updating them

Local-Trade-Copier-Tutorials-do-not-close-certain-trades-1745x1080

In this short tutorial, Rimantas explains how to configure Local Trade Copier not to close specific positions.

Client EA has a unique parameter called MarkAllTrades_DoNotClose. We’ve added it for advanced users who have lots of open positions that should not be closed by the Client EA.

It can get quite advanced because you can mark which trades cannot be closed by the Client EA and you can also do this from your Expert Advisor or even manually. Usually, only advanced users require such functionality, and therefore this parameter is available just for the VIP plan.

Marked trades which MT4 trade copier cannot touch, change or close.

Marked trades which MT4 trade copier cannot close. Their SL/TP changes will still be updated by following the master account.

How to set Trade Copier NOT to close my trades

Let’s mark the trades with a “do not close” tag.

Step #1: Tell the Client EA mark these trades with the “Do not close” tag.

When you execute a Client EA with this parameter set to TRUE, it will mark all currently open trades as “do not close“. It means Client EA will never close them under any circumstances even after you restart MT4 or the Client EA.

MarkAllTrades_DoNotClose parameter in the Client EA module of the MT4 Local Trade Copier

MarkAllTrades_DoNotClose parameter in the Client EA module of the MT4 Local Trade Copier

Client EA will mark the trades in a few seconds and then tell you to restart it.

Client EA is telling to restart it after it marked all trades with the 'Do Not Close' tag.

Client EA is telling to restart it after it marked all trades with the ‘Do Not Close’ tag.

Remove the Client EA from the chart and start it again.

Step #2: Restart the Client EA in your normal operational mode to continue its work.

Restart the Client EA with this parameter set to FALSE to continue regular Client EA operation. Any new trades will be copied/modified/closed but those marked as “do not close” will not be closed, but only adjusted to match the master (SL/TP changes, etc.).

Restarting Client EA to continue normal operations after it marked all trades with the 'Do Not Close' tag.

When the Client EA marks trades with the ‘Do Not Close‘ tag, restart it to continue regular operations.

Important things to know about the ‘Do Not Close’ tag

The “Do Not Close” tags would be lost if you reinstall MT4 or move the account to another MT4 platform because the data is stored in Tools->Global Variables.

MT4 Global Variables window with the Trade Copier 'Do Not Close' tags

MT4 Global Variables window with the Trade Copier ‘Do Not Close‘ tags

It’s possible to move the data to another account too in case you need it sometimes; you need to copy the file named “\profiles\gvariables.dat” from your MT4 terminal Data Folder.

You can also create these “Do not close” marks (Global Variables) manually if needed in the Tools->Global Variables and Client EA will not close those trades. The format for the name of the Global Variable is: DoNotClose-ORDERTICKET

For example, a GV with the name DoNotClose-44323698 will tell the Client EA to never close the trade 44323698. Important is only the name. Values of these GV’s are ignored.

 

Rimantas Petrauskas

Rimantas Petrauskas is one of the most well-known programmers among Forex traders. Having more than 20+ years of programming experience, he created two of the most popular trade copiers for the MetaTrader 4 platform—the Signal Magician and Local Trade Copier. Rimantas is also a best-selling author on Amazon after his book "How to Start Your Own Forex Signals Service" hit #4 in the Forex category during the first launch week.

Leave a Reply