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
Оценка
(337)
Проекты
455
52%
Арбитраж
22
50% / 27%
Просрочено
5
1%
Загружен
2
Разработчик 2
Оценка
(10)
Проекты
15
13%
Арбитраж
1
0% / 100%
Просрочено
1
7%
Загружен
3
Разработчик 3
Оценка
(159)
Проекты
173
33%
Арбитраж
6
50% / 50%
Просрочено
2
1%
Загружен
4
Разработчик 4
Оценка
(176)
Проекты
236
45%
Арбитраж
17
82% / 12%
Просрочено
35
15%
Работает
5
Разработчик 5
Оценка
(454)
Проекты
513
33%
Арбитраж
25
40% / 48%
Просрочено
7
1%
Загружен
6
Разработчик 6
Оценка
(10)
Проекты
25
28%
Арбитраж
1
0% / 0%
Просрочено
1
4%
Загружен
7
Разработчик 7
Оценка
(4)
Проекты
4
0%
Арбитраж
2
0% / 100%
Просрочено
1
25%
Свободен
8
Разработчик 8
Оценка
(237)
Проекты
419
34%
Арбитраж
53
36% / 40%
Просрочено
154
37%
Занят
9
Разработчик 9
Оценка
(38)
Проекты
40
25%
Арбитраж
20
15% / 75%
Просрочено
8
20%
Загружен
10
Разработчик 10
Оценка
(90)
Проекты
111
37%
Арбитраж
8
88% / 0%
Просрочено
0
Работает
11
Разработчик 11
Оценка
(41)
Проекты
88
14%
Арбитраж
30
30% / 53%
Просрочено
36
41%
Работает
12
Разработчик 12
Оценка
Проекты
1
0%
Арбитраж
0
Просрочено
0
Свободен
13
Разработчик 13
Оценка
(548)
Проекты
1330
59%
Арбитраж
28
82% / 0%
Просрочено
10
1%
Свободен
14
Разработчик 14
Оценка
(68)
Проекты
77
8%
Арбитраж
33
9% / 55%
Просрочено
6
8%
Загружен
15
Разработчик 15
Оценка
(265)
Проекты
539
50%
Арбитраж
55
40% / 36%
Просрочено
224
42%
Работает
16
Разработчик 16
Оценка
(64)
Проекты
69
64%
Арбитраж
3
100% / 0%
Просрочено
7
10%
Работает
Похожие заказы
Hi there - Overview We are seeking an experienced developer to create a Forex Robot Expert Advisor (EA) tailored to specific trading strategies and conditions. The EA will focus on the London trading session and will automate trades based on pre-defined calculations and market movements. *Responsibilities:* 1. *London Session Analysis:* - Develop functionality to highlight the London trading session on the forex
Dear Freelancers, I'm seeking a skilled MT4/MT5 developer to collaborate on a valuable trading indicator. Project Description: I'm looking to develop a powerful Elliott Wave indicator compatible with the MT4 and MT5 trading platforms. This indicator will be based on the highly successful [LuxAlgo] indicator currently available on TradingView. Key Features: In-indicator Alerts: The ability to receive pop-up
Profit EA 50+ USD
//+------------------------------------------------------------------+ //| SimpleEA.mq4 | //| Generated by MetaEditor | //| https://www.mql5.com/en/docs&nbsp ; | //+------------------------------------------------------------------+ #property strict // Input parameters input double LotSize = 0.1; // Lot size input int MovingAveragePeriod = 50; // MA
1. **Timeframe and Liquidity:** Focus on the 5-minute timeframe for liquidity analysis.(timeframe for liquidity should be editble) 2. **Candlestick MSS:** Monitor 1-minute candlestick patterns for entry signals.(should be editble) 3. **Swing Points:** Identify swing points using the high and low of the last three candles.(ict swimg high and low) 4. **Sell Setup:** - Wait for a 5-minute candle to take out the swing
i am looking for experienced programmer to create indicator for me. i am willing to pay for the service. and if it works amazingly like i expected. i will tip more money
High Low intraday ticker to display the most recent high low of up to 40 stock symbols. As a stock makes an intraday high low it will populate at the top and so on. Regardless of chart that's display it will continue to track high lows of the 40 stocks inputed. The 40 stocks can by manually changed. A high will display as green with the time (hour:minute:second), symbol, and last price. A low will be displayed as red
Modify an existing Python bot to trade bollinger bands, with iqoption api Currently the bot strategy is wrong, I am limited in my knowledge here and hope to fix this Hope to work with more experience people out there in relation to iqoption api and python
hi guys, I have a script, that I have been struggling to work. most of the work is done, just final touch of an expert is needed. The script Is using Fibonacci and Pivot standard in its base. look forward to hear from an expert! Best regards Sina
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party messengers, personal correspondence or emails. I understand that violators will be banned from publishing Orders in the Freelance service. I have read the Rules of using the Freelance service and accept them. I agree

Информация о проекте

Бюджет
50 - 200 USD
VAT (21%): 10.5 - 42 USD
Итого: 60.5 - 242 USD
Исполнителю
45 - 180 USD
Сроки выполнения
от 1 до 5 дн.