Script required for calculating lot size and partially closing positions

MQL5 Skripte

Auftrag beendet

Ausführungszeit 7 Tage
Bewertung des Kunden
Excellent work Michael. Thank you for making my life so much easier. Excellent communication and fast delivery. This is a guy who actually understands your requirements and makes it all happen.
Bewertung des Entwicklers
It was a pleasure working with you! Your clear communication, prompt responses, and friendly demeanor made the process smooth and enjoyable. Thank you, Roel! Looking forward to serving you again!

Spezifikation

Hello Programmers, 

I'm looking for an MQL5 script (not EA). The requirements and conditions are listed below.

Please be so kind to have a look at it and let me know if it can be scripted?
If yes, i would like to receive a quote if you're available.

Many thanks in advance for your assistance and please let me know if you have any questions or require additional information.

/Roel


Requirements and conditions:

• There are multiple positions (buy and sell positions) on US30 all with 3% risk.

• When launched, the script should check which position is in profit.
• Only if the winning position is at least 3000 ticks in profit, it should execute. If not, it should terminate without performing any action. 

• If the winning position is in profit for at least 3000 ticks, it should
- close the position
- Take 75% of the profit of that closed position and calculate the appropriate lot size.
- Partially close the position (reducing its lot size with the lot size that was calculated) in the opposite direction (sell if a buy was closed and a buy if a sell was closed) that is furthest away from current price and is currently in drawdown. 

• IF the lot size reduction (partial close) of the position in drawdown based on the 75% profit of the winning position exceeds the remaining lot size, the position in drawdown can be closed completely.
It cannot be closed completely under any other circumstances.
The remaining lot size can be subtracted now (partial close) from the next position that is now furthest removed from current price. 

• Please keep in mind, the minimum lot size for US30 is 0.1 lots.

• The currency used for trading is EUR. Not USD. 


• The lot size calculation for partial close is

(75% of winning position divided by the Loss of losing position) multiply the outcome by the lot size of losing position

Example: 

winning position is 400€ in profit

Losing position is 10 lots and 500€ drawdown

((400€ * 0.75) / 500€) * 10 = 6 lots to close


Example. 

Winning position has generated 300€ profit. and is 3000 ticks in profit and can be closed by the script. 

The script should look for the position in opposite direction in drawdown (hedge) furthest away from current market price
This position has a lot size of 1 lot and is 100€ in drawdown.

Calculation: 

300€ multiplied by 0.75 = 225€
Divide 225€ by 100€ drawdown of the losing trade = 2.25
Multiply 2.25 with the lot size of the position in drawdown which is 1 lot = 2.25 lots
2.25 lots of the 1 lot need to be closed from the position that is in drawdown.

The script should reduce the lot size of this position with 2.25 lots, so basically this position can be closed completely and there are still 1.25 lots left available

The script should look for the new opposite position in drawdown (hedge) that now is furthest away from current market price
This position is 5 lots, so it should partially close this position with 1.25 lots
The lot size of this position is now 3.75 lots

Script should terminate. 


Bewerbungen

1
Entwickler 1
Bewertung
(428)
Projekte
624
54%
Schlichtung
30
53% / 23%
Frist nicht eingehalten
6
1%
Überlastet
2
Entwickler 2
Bewertung
(25)
Projekte
33
24%
Schlichtung
3
33% / 33%
Frist nicht eingehalten
4
12%
Frei
3
Entwickler 3
Bewertung
(194)
Projekte
241
34%
Schlichtung
10
50% / 50%
Frist nicht eingehalten
8
3%
Arbeitet
Veröffentlicht: 1 Artikel, 8 Beispiele
4
Entwickler 4
Bewertung
(209)
Projekte
281
46%
Schlichtung
27
59% / 37%
Frist nicht eingehalten
36
13%
Frei
5
Entwickler 5
Bewertung
(542)
Projekte
624
33%
Schlichtung
39
36% / 49%
Frist nicht eingehalten
11
2%
Überlastet
6
Entwickler 6
Bewertung
(16)
Projekte
35
23%
Schlichtung
4
0% / 50%
Frist nicht eingehalten
2
6%
Arbeitet
7
Entwickler 7
Bewertung
(4)
Projekte
4
0%
Schlichtung
2
0% / 100%
Frist nicht eingehalten
1
25%
Frei
8
Entwickler 8
Bewertung
(307)
Projekte
551
35%
Schlichtung
79
32% / 42%
Frist nicht eingehalten
199
36%
Beschäftigt
9
Entwickler 9
Bewertung
(45)
Projekte
46
24%
Schlichtung
34
9% / 85%
Frist nicht eingehalten
10
22%
Frei
10
Entwickler 10
Bewertung
(152)
Projekte
190
57%
Schlichtung
10
80% / 0%
Frist nicht eingehalten
0
Arbeitet
Veröffentlicht: 1 Beispiel
11
Entwickler 11
Bewertung
(45)
Projekte
91
13%
Schlichtung
34
26% / 59%
Frist nicht eingehalten
37
41%
Frei
12
Entwickler 12
Bewertung
Projekte
1
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
13
Entwickler 13
Bewertung
(618)
Projekte
1428
59%
Schlichtung
31
81% / 0%
Frist nicht eingehalten
10
1%
Frei
14
Entwickler 14
Bewertung
(72)
Projekte
80
10%
Schlichtung
38
8% / 58%
Frist nicht eingehalten
6
8%
Frei
15
Entwickler 15
Bewertung
(270)
Projekte
552
49%
Schlichtung
57
40% / 37%
Frist nicht eingehalten
228
41%
Arbeitet
16
Entwickler 16
Bewertung
(73)
Projekte
83
64%
Schlichtung
5
100% / 0%
Frist nicht eingehalten
9
11%
Frei

Projektdetails

Budget
50 - 200 USD
Ausführungsfristen
von 1 bis 5 Tag(e)