Expert Advisor that closes open positions on the chart if average profit in pips/points on all open positions is achieved

MQL4 Experts Scripts

Termos de Referência

I am looking for an expert advisor that manages open positions on my MT4 platform (Broker Details: FXCM; 5 Digits account; 30:1 leverage; Instruments: FX & CFDs) that are manually openend.

Logic: If average profit from all open positions in FX-Pair/CFD-contract is more than X-amount in pips/points, then close x-% of all open positions

Example: 

1.    If the average profit from all open positions in EURUSD is:

a.    more than 10 pips/points, then close 33% of all open positions

b.    more than 20 pips/points, then close 33% of all open positions

c.    more than 30 pips/points, then close 33% of all open positions

2.    If there are for example 5 positions open at the moment the first profit target is reached, the EA should close 2 positions (so round up because it is not possible to close 1,66 (5*33%) positions). If the second profit target is reached (and there were no new positions created in the meantime) the EA should close 1 position ((5-2)*33% = 1)

3.    While the EA is running in the background, the programm always has to monitor the change in open positions. So in case new positions are manually openend or closed the EA has to recalculate its next operations.

a.    Example from above: If the Second profit target was reached and there were new positions entered in the meantime, the EA should start with the initial configuation, so that if the „new“ average profit from all open positions in EURUSD is:

                                       i.    more than 10 pips/points, then close 33% of all open positions

                                      ii.    more than 20 pips/points, then close 33% of all open positions

                                    iii.    more than 30 pips/points, then close 33% of all open positions

4.    The EA should either use the FIFO (First in First out) or LIFO (Last in First out) principle, when closing positions

5.    I would like to enter several closing instructions; i.e.:

a.    1) If the average profit then…

b.    2) If the average profit then…

c.    3) If the average profit…

d.   

ð  If there needs to be a limit, than I would prefer 3 different closing instructions

6.    Under some circumstances the EA also needs to be able to work with magic numbers, so that it only closes positions that were assigned a certain magic number (on/off function).


Respondido

1
Desenvolvedor 1
Classificação
(52)
Projetos
133
44%
Arbitragem
14
50% / 29%
Expirado
55
41%
Livre
2
Desenvolvedor 2
Classificação
(879)
Projetos
1393
67%
Arbitragem
117
32% / 42%
Expirado
215
15%
Trabalhando
3
Desenvolvedor 3
Classificação
(84)
Projetos
149
31%
Arbitragem
32
34% / 41%
Expirado
43
29%
Livre
4
Desenvolvedor 4
Classificação
(1235)
Projetos
2820
80%
Arbitragem
156
22% / 43%
Expirado
488
17%
Livre
5
Desenvolvedor 5
Classificação
(197)
Projetos
320
35%
Arbitragem
64
13% / 56%
Expirado
83
26%
Livre
6
Desenvolvedor 6
Classificação
(221)
Projetos
369
66%
Arbitragem
10
50% / 0%
Expirado
46
12%
Livre
7
Desenvolvedor 7
Classificação
(33)
Projetos
49
12%
Arbitragem
16
0% / 88%
Expirado
10
20%
Livre
8
Desenvolvedor 8
Classificação
(564)
Projetos
779
46%
Arbitragem
23
39% / 13%
Expirado
63
8%
Trabalhando
9
Desenvolvedor 9
Classificação
(48)
Projetos
80
28%
Arbitragem
8
75% / 13%
Expirado
41
51%
Livre
10
Desenvolvedor 10
Classificação
(33)
Projetos
35
40%
Arbitragem
11
9% / 91%
Expirado
4
11%
Livre
11
Desenvolvedor 11
Classificação
(135)
Projetos
193
42%
Arbitragem
17
29% / 59%
Expirado
28
15%
Livre
12
Desenvolvedor 12
Classificação
(59)
Projetos
182
55%
Arbitragem
31
45% / 16%
Expirado
103
57%
Livre
13
Desenvolvedor 13
Classificação
(195)
Projetos
395
28%
Arbitragem
155
20% / 52%
Expirado
112
28%
Livre
14
Desenvolvedor 14
Classificação
(491)
Projetos
1017
58%
Arbitragem
29
28% / 24%
Expirado
132
13%
Livre
15
Desenvolvedor 15
Classificação
(2442)
Projetos
3079
66%
Arbitragem
77
48% / 14%
Expirado
340
11%
Trabalhando
16
Desenvolvedor 16
Classificação
(43)
Projetos
72
49%
Arbitragem
4
0% / 50%
Expirado
19
26%
Livre
17
Desenvolvedor 17
Classificação
(65)
Projetos
87
39%
Arbitragem
3
0% / 33%
Expirado
29
33%
Livre
18
Desenvolvedor 18
Classificação
(564)
Projetos
933
47%
Arbitragem
302
59% / 25%
Expirado
125
13%
Carregado
19
Desenvolvedor 19
Classificação
(66)
Projetos
143
34%
Arbitragem
10
10% / 60%
Expirado
26
18%
Livre
20
Desenvolvedor 20
Classificação
(1)
Projetos
1
0%
Arbitragem
1
0% / 100%
Expirado
0
Livre

Informações sobre o projeto

Orçamento
50 - 150 USD
IVA (19%): 9.5 - 28.5 USD
Total: 59.5 - 178.5 USD
Desenvolvedor
45 - 135 USD