• Übersicht
  • Bewertungen (5)
  • Diskussion (66)
  • Neue Funktionen

Exp4 Close Minus by Plus

Covers losing positions by identifying and closing winning positions.

This assistant looks for the most loss-making position among all positions in the terminal.

Further, by searching for other positions, it calculates a series of orders that can cover the loss and closes them.

The series of orders can include any position. The maximum number of positions is specified in the settings of the Expert Advisor.

You can test the Expert Advisor in the strategy tester and trade with our EAPADPRO toolbar in visual mode!

Close Loss by Profit - Full Description


  • TypeOfUnitToClose - type of profit and loss calculations. In USD or in points.
  • MinLossInUnit - the minimum loss of a position in units (TypeOfUnitToClose), to be taken into account by the EA.
    • An order with a loss of "MinLossPoss_in_unit" units (USD or points), should be placed in the negative zone.
    • It is the upper limit when searching for unprofitable positions.
    • For example: MinLossInUnit = -100, TypeOfUnitToClose = USD.
    • Then the EA looks for or waits for a position with a loss greater than or equal to -100 USD, for example: -100 USD, -150 USD, -200 USD and so on.
    • A position with a loss of -99 USD is ignored.
  • AdditionalProfitInUnit - the amount of profit units for the difference to close a set of positions.
    • Position (or several) with the total profit exceeding the loss by "AdditionalProfitInUnit" units.
    • For example: AdditionalProfitInUnit= 10, MinLossInUnit= -100, TypeOfUnitToClose = USD.
    • The EA will look for or wait for at least 2 positions, where one position has a loss of -100 USD and the other has a profit of +110 USD. At this point, the EA decides if it is necessary to activate its functions.
  • MaxPos_in_Class - the "MaxPos_in_Class" parameter should limit the number of positions of the entire closing "set".
    • For example: MaxPos_in_Class = 3, then the EA will look for a closing set with 3 positions at most (1 unprofitable and 2 profitable ones).
  • FirstSymbolClose - search for position pairs and close only those in the currency of the currently processed losing position.
    • You can disable the FirstSymbolClose, parameter. Then the EA will close any sets of losing and profitable positions on the entire account, regardless of the currency pair included in calculation.
    • When the FirstSymbolClose function is enabled, the EA considers and closes sets of the same currency pair.
  • OrderToClose - type of positions: -1 = All Orders, 1 = Sell, 0 = Buy;
  • MagiсToClose - magic number of positions: -1 = any, or you can specify a unique magic number of your positions to be processed.
  • SymbolToClose - currency pair to monitor: -1 = All Symbol, 1 = Current Symbol;
      • Dear friends and users of our EAs, please add your ratings in the Reviews section.
      • Developer of forex tools: Expforex

Operation of the Expert Advisor

The operation involves attaching the Expert Advisor to a separate chart, making the necessary settings and continuing to work in our terminal. When the programmed condition triggers, the Expert Advisor comes into play and starts making calculations.

All calculations are written to the log, as follows:

2014.02.05 01:18:38.408 - Exp - CloseMinusByPlus USDCHF,H1: close #22079015 sell 1.00 EURUSD at 1.35141 at price 1.35119
2014.02.05 01:18:38.346 - Exp - CloseMinusByPlus USDCHF,H1: Tickets of prof positions: .22079015
2014.02.05 01:18:38.346 - Exp - CloseMinusByPlus USDCHF,H1: close #22085491 sell 1.00 USDCHF at 0.90423 at price 0.90430
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Tickets of loss positions: 22085491
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Numbers of positions to Close: 80635972
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: All profit from open positions: 20 dollars
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Maximim profit ticket: 22079015
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Maximim profit: 20 dollars
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Maximum Loss ticket: 22085491
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Maximim loss: -7 dollars
2014.02.05 01:18:38.283 - Exp - CloseMinusByPlus USDCHF,H1: Overlapping loss positions by closing profitable positions started using the currency pair minus:

Staffan Ofwerman
Staffan Ofwerman 2019.04.03 11:24 

This is a great EA to add to my setup. I would give it five stars if there were some setfiles for different scenarios. It would make things easier and a great way to understand how it works.

eriva 2019.01.13 11:08 

I use many products from Vladislav, the utilities are exceptional even if they require a bit of patience to find the right settings based on their use. Each reviewed utility is used in my real account. Vladislav is a kind and helpful person for any help required. Great Vladislav !!

Gusstaw 2015.05.16 12:17 

работает на 5+,любой счет,любой депозит,полезен новичкам,те постоянно в минуса лезут,закрывает и -10 и -100,настройки минимальны и очень просты,авторы всегда помогут,если и закрывает с минусом,то минимальным..поверьте-это один из лучших помошников

umtelo 2015.04.09 23:00 

я так понял главное правильно настроить. И в принципе из 10 пар закрывает пачку ордеров плюс минус.

savagerus 2015.01.15 15:42 

Отличный и полезный советник

Version 19.107 2019.01.07
- Update EAPADPRO v25;
- Additional languages added to the panel: Spanish, Portuguese (Brazil), German, Chinese, Japanese;
The translation was made using the GOOGLE Translator + MQL + Terminal site!
if you find an error in your language, please report it in messages. Thank!
- Increase the speed of the panel;
Version 18.830 2018.08.30
Close Minus by Plus Update EAPADPRO v 20
Version 18.515 2018.05.29
- Updated EAPADPRO v2.0 info panel;

- Renamed the parameters:
TypyClose = TypeOfUnitToClose
MinLossPoss_in_unit = MinLossInUnit
ProfitPerLoss_in_unit = AdditionalProfitInUnit
MagikToClose = MagicToClose
Version 17.208 2017.02.14
Version 17.123 2017.01.27
- Added the EAPADPRO information panel
Details on the panel in our blog: https://www.mql5.com/en/blogs/post/687140
Version 16.121 2016.04.07
Fixed the error of closing the profitable trades when there are no unprofitable ones and the MinLossPoss_in_unit parameter is set to +
MinLossPoss_in_unit - should be set in the negative zone. This is the upper limit when searching for unprofitable positions.
If the parameter is set to MinLossPoss_in_unit=-10, then the unprofitable trade (covered by the profitable ones) must be less than -10 dollars (points)
MinLossPoss_in_unit = parameter that limits the EA operation if the negative trade is greater than the MinLossPoss_in_unit. For example, when opening a trade, it profit = -spread.
Version 15.731 2015.08.03
Added the message to the strategy tester stating that the product cannot be tested in the strategy tester.
Version 15.729 2015.07.30
Added: disabling algorithm if there are more than 1 positive trade.
The algorithm works if there are 2 or more positions to be closed.
Version 14.965 2014.12.23
- Compiled under new build.
- Added enumerations to select calculation and close type.
Version 14.709 2014.07.09
Added array release before every pass to avoid closing positions with the same tickets.