• 概述
  • 评论 (3)
  • 评论 (37)
  • 新特性

Exp4 Close Minus by Plus

Exp Close Minus by Plus - Covering losing positions by identifying and closing winning positions.

Further to the subject of leveling positions, I would like to offer you a more reliable and easy-to-use algorithm of covering losing positions. Every one of you is certainly free to choose your own way of getting rid of negative positions. Our previous Expert Advisor closing positions by total profit or loss, with trailing of the obtained profit, was quite successful.


Introduction

This Expert Advisor searches for the biggest losing position across all positions in the terminal (magic numbers, positions and their directions can be specified separately in the settings). Further, using a clever search of 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.


Settings

  • TypyClose - dollars - 1, pips - 2.
  • MinLossPoss_in_unit- order with a loss of "MinLossPoss_in_unit" units.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.
  • ProfitPerLoss_in_unit - order (one or more) with the total profit exceeding the loss by "MaxPos_in_Class" units.
  • MaxPos_in_Class - "MaxPos_in_Class" parameter should limit the number of deals of the whole closing "set".
  • FirstSymbolClose - search for pairs of orders and close only those in the currency of the losing position we want to cover.
  • timetrade_ - time settings of the Expert Advisor.
  • OpenHoura - trade opening hour.
  • OpenMinutea - trade opening minute.
  • CloseHoura - trade closing hour.
  • CloseMinutea - trade closing minute.
  • OrderToClose - all orders = -1, Sell = 1, Buy = 0.
  • MagikToClose - all orders = -1.
  • SymbolToClose - all symbols = -1, current symbol = 1.


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 - 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 - Exp - CloseMinusByPlus USDCHF,H1: Tickets of prof positions: .22079015
2014.02.05 01:18:38.346 Exp - 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 - Exp - CloseMinusByPlus USDCHF,H1: Tickets of loss positions: 22085491
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Numbers of positions to Close: 80635972
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: All profit from open positions: 20 dollars
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Maximim profit ticket: 22079015
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Maximim profit: 20 dollars
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Maximum Loss ticket: 22085491
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Maximim loss: -7 dollars
2014.02.05 01:18:38.283 Exp - Exp - CloseMinusByPlus USDCHF,H1: Overlapping loss positions by closing profitable positions started using the currency pair minus:

The above suggests that we have had a lot of open positions (chaotically opened).

We have specified in the settings that the calculation should start when we find the biggest losing position with a loss of -10 (MinLossPoss_in_unit=-10) dollars (TypyClose=1) and the total profit being higher by 10 dollars (ProfitPerLoss_in_unit=10). We have also specified that not more than 5 orders (MaxPos_in_Class=5) should be closed.

The Expert Advisor has found a position with a loss of -7 dollars, as well as a series of orders with the profit of +20 dollars. So it closed both the losing position and the series of winning positions. 

Gusstaw
43
2015.05.16 12:17 
 

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

umtelo
131
2015.04.09 23:00 
 

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

savagerus
141
2015.01.15 15:42 
 

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

版本 17.208 - 2017.02.14
Improved EAPADPRO
版本 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
版本 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.
版本 15.731 - 2015.08.03
Added the message to the strategy tester stating that the product cannot be tested in the strategy tester.
版本 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.
版本 14.965 - 2014.12.23
- Compiled under new build.
- Added enumerations to select calculation and close type.
版本 14.709 - 2014.07.09
Added array release before every pass to avoid closing positions with the same tickets.