Partial Close EA
- Utilitys
- Rimantas Petrauskas
- Version: 1.4
- Aktualisiert: 8 März 2021
- Aktivierungen: 10
The most simple and easy to use Partial Close EA (by Rimantas Petrauskas)
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.
Author
Rimantas Petrauskas, programmer, software engineer, algorithmic Forex trader.
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.