Script required for calculating lot size and partially closing positions

MQL5 スクリプト

仕事が完了した

実行時間7 日
依頼者からのフィードバック
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.
開発者からのフィードバック
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!

指定

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. 


応答済み

1
開発者 1
評価
(356)
プロジェクト
488
52%
仲裁
24
54% / 25%
期限切れ
5
1%
取り込み中
2
開発者 2
評価
(11)
プロジェクト
16
13%
仲裁
3
0% / 33%
期限切れ
2
13%
仕事中
3
開発者 3
評価
(167)
プロジェクト
189
32%
仲裁
6
50% / 50%
期限切れ
2
1%
仕事中
4
開発者 4
評価
(182)
プロジェクト
243
46%
仲裁
18
78% / 17%
期限切れ
35
14%
仕事中
5
開発者 5
評価
(489)
プロジェクト
558
33%
仲裁
27
44% / 44%
期限切れ
8
1%
取り込み中
6
開発者 6
評価
(11)
プロジェクト
26
27%
仲裁
3
0% / 0%
期限切れ
1
4%
取り込み中
7
開発者 7
評価
(4)
プロジェクト
4
0%
仲裁
2
0% / 100%
期限切れ
1
25%
8
開発者 8
評価
(249)
プロジェクト
446
34%
仲裁
56
36% / 38%
期限切れ
164
37%
取り込み中
9
開発者 9
評価
(38)
プロジェクト
40
25%
仲裁
23
13% / 74%
期限切れ
8
20%
仕事中
10
開発者 10
評価
(98)
プロジェクト
122
39%
仲裁
9
89% / 0%
期限切れ
0
仕事中
11
開発者 11
評価
(42)
プロジェクト
88
14%
仲裁
31
29% / 55%
期限切れ
36
41%
仕事中
12
開発者 12
評価
プロジェクト
1
0%
仲裁
0
期限切れ
0
13
開発者 13
評価
(558)
プロジェクト
1344
59%
仲裁
28
82% / 0%
期限切れ
10
1%
14
開発者 14
評価
(72)
プロジェクト
80
10%
仲裁
36
8% / 53%
期限切れ
6
8%
仕事中
15
開発者 15
評価
(267)
プロジェクト
542
50%
仲裁
55
40% / 36%
期限切れ
225
42%
仕事中
16
開発者 16
評価
(67)
プロジェクト
74
64%
仲裁
4
100% / 0%
期限切れ
7
9%
仕事中
類似した注文
Hi there, I am offering $30 usd for someone to convert four pictures I have to metatrader icons(arrows) that I can use in both MT4 & MT5. We all know that we can change arrows on the chart by using a different arrow code, but the arrows in metatrader are boring and I want to use custom ones. I want the four attached pictures as icons that i can use with indicators that give the option to choose your arrow type. I
I need an expert to decrypt my itf file using on prorealtime. I forgot my password, so I need to generate the source code. I need someone that can help me to derive source code from the itf file I have

プロジェクト情報

予算
50 - 200 USD
VAT(付加価値税) (21%): 10.5 - 42 USD
合計: 60.5 - 242 USD
開発者用
45 - 180 USD
締め切り
最低 1 最高 5 日