• Overview
  • Reviews (16)
  • Comments (38)
  • What's new

Partial Close EA

The most simple and easy to use Partial Close EA (by Rimantas Petrauskas)

Note: Partial Close EA does not work in the MT4 Strategy Tester.

To test the EA, please use the DEMO version: https://www.mql5.com/en/market/product/13617

The main idea of this EA is to apply partial close to your positions. EA will automatically find your open market positions and apply partial close according to your settings.

For those who do not know what Partial Close is: it is simply an action to close only a part of your position. For example, if your trade lot size is 1.2 and you close 25% of it (which is 0.3) you will still have 0.9 lot size trade running and existing bank profits from that 0.3 lot size that was just closed. This action obviously can be performed manually, but if you want to program your MT4 to do this for you then you need "Partial Close EA".

How to use Partial Close EA?

The EA should be attached to a separate chart on your MT4 and it will apply partial close to all trades selected by magic number or trade number. The EA will see the trades of that currency pair (instrument) that it is attached to. By default the EA will apply partial close to any market order on the currency pair (instrument) it is attached to. The EA can also be applied to non-Forex pairs/instruments like Indices, Commodities, etc. For this you might need to use CustomPipSizes option (read explanation below).

Partial Close EA Inputs

  • ManageMagicNumber — This tells the EA to apply partial close to trades only with certain magic number you choose. If this value is set to zero, the EA will manage only manually opened trades. If you set this to -1 (negative one), the EA will manage all of the trades running on the account (default value).
  • ManageTradeNumber — This tells the EA to apply partial close only to the trade number specified. This will also make the EA ignore the ManageMagicNumber option.
  • ManageTradeWithComment - This tells the EA to apply partial close only to those trades that have a specified text in "trade comment". If you set this parameter to "777", it will manage trades that have "trade comment" like "1777" or "777" or "777565, but not "7737" or trades with no "trade comment" at all.
  • PartialCloseCount — This tells the EA to apply partial close X times. Set this to zero to disabled Partial Close option.
  • PartialCloseOnHoldPips — This tells the EA to start partial close when trade reaches X pips in profit. Zero means EA will start applying partial close at the first target (PartialCloseStepPips). If this option is set to 50 pips and PartialCloseStepPips=20 pips, then EA would wait for the trade to reach profit of 50 + 20 = 70 pips to close the first part of the trade.
  • PartialCloseStepPips — This tells the EA to apply partial close each X pips in profit. If this option is set to 20 pips and PartialCloseCount=3, then EA will apply partial close 3 times every 20 pips. This means TP1 = 20 pips, TP2 = 40 pips and TP3 = 60 pips.
  • PartialCloseStepPercent — This tells EA to close X% of the trade. Percentage of the lot size is counted from the initial lot size.
  • PartialCloseBreakEvenAfter — This indicates after how many partial closes EA should move stop loss to a break-even point (open price + few pips to cover commission expenses). Zero value means no break-even will be applied.
  • CustomPipSizes — I have added this option because there are no standard pip sizes for indices and other non-Forex pairs between brokers. This option allows you to override the pip size that the EA will detect automatically. In 99% cases EA will work fine on all Forex pairs, but for non-Forex pairs you might notice that pip size is different between brokers. For example NAS100 with one broker might be quoted with 1 decimal and another broker might quote it to 2 decimals. Here is an example how to enter in a comma separated list of custom pip sizes: XAUUSD=0.1,XAGUSD=0.01,WTI=0.1
  • For those who are using EA on a non-Forex pairs please set the CustomPipSizes option correctly according to your broker settings. Sorry, I am unable to help you setting this option, because each broker might need different value.
  • SlippageClosePips — This is the slippage setting EA will use to exit the market (close the trade). Note that not all brokers use this and this will be ignored by your broker on ECN accounts. If you do not know what that is, simply leave it as is.


Rimantas Petrauskas, programmer, software engineer, algorithmic Forex trader.

Lee Bryant
2016.09.20 16:51 

Good product and seller with great support

2016.08.10 05:55 

Break even functionality is not working in this EA.

Example:: If break even is expected to happen on a trade after x number of partial closes, EA is modifying trade to break even right at first partial close. EA is not considering value specified. NO RESPONSE FROM AUTHOR YET. Waiting to hear back from Rimantas/ seller /author. Will update this review after response from them.

2016.04.06 19:26 

Great program! Other scale out EA's I have tried worked only on attached chart and you had to set timeframe manually and cost 10x as much as this one.

2015.04.23 11:45 

Great tool! Thank you for the EA.

2015.04.02 15:50   

Hello, I have tested your partial close EA and this is what I can currently confirm:

1. It is similar to a lot of FREE trade managing EA's which are available not only on the Forex Factory web site but also on other forex sites on the net as well. As such, its nothing extraordinary or unique. However, till now your EA has functioned without any issue.

2. It would certainly enhance this EA, if a custom trailing stop is integrated within it which could be activated at a user defined partial close level.

Good luck with further development.

2015.03.31 14:13 

Fantastic product. I highly recomend.

2015.03.31 08:23 

Great tool, works very well. Thanks Rimantas for the awesome EA!!

2015.03.27 03:55 

Great EA aplication and very effective for my strategy sistem and thank you verymuch Rimantas, GBU

2015.03.23 07:06 

I've been looking for something like this for sometime. It works great and haven't had any issues yet with it's use. Thanks for making it available.

2015.03.19 02:03 

Works fine ! Good Job ! Thank you very much ! That will keep me more organized ! : )))

2015.03.17 21:38 

Thanks for this useful EA, it will be very helpful in trends.

2015.03.16 13:07 

Great tool !!!

2015.03.16 09:51 

Very usefull in combination with vavatrade client EA it is realy making money for me

2015.03.10 22:23 

I have tested this EA on major forex pairs and even on indexes and I have to say that this EA is absolutelly great tool to manage trades. It gives more freedom you do not need to sit front of your computer and manage your trade. It will be done with this EA.

Great job!

Thanks EA Coder

Povilas Zukauskas
2015.03.04 09:04 

Very good and useful EA act with manual and effective with autometed trading !!! Realy great tool.

Mujeeb Abdul
2015.02.28 17:40 

Wow Great free tool with this great features Love it Excellent programing

Version 1.3 - 2016.09.28
Fixed "ManageTradeWithComment" parameter.
Version 1.2 - 2016.09.20
Fixed break-even error. Now PartialCloseBreakEvenAfter parameter works correctly.

Added new feature (parameter): ManageTradeWithComment

ManageTradeWithComment - this tells the EA to apply partial close only to those trades that have specified text in "trade comment". If you set this parameter to "777", it will manage trades that have "trade comment" like "1777" or "777" or "777565, but not "7737" or trades with no "trade comment" at all.
Version 1.1 - 2015.12.23
Fixed problems detecting price Digits when using CustomPipSizes option.