Script required for calculating lot size and partially closing positions

MQL5 Sripts

Trabajo finalizado

Plazo de ejecución 7 días
Comentario del Cliente
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.
Comentario del Ejecutor
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!

Tarea técnica

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. 


Han respondido

1
Desarrollador 1
Evaluación
(337)
Proyectos
455
52%
Arbitraje
22
50% / 27%
Caducado
5
1%
Trabajando
2
Desarrollador 2
Evaluación
(10)
Proyectos
15
13%
Arbitraje
1
0% / 100%
Caducado
1
7%
Trabajando
3
Desarrollador 3
Evaluación
(159)
Proyectos
173
33%
Arbitraje
6
50% / 50%
Caducado
2
1%
Trabajando
4
Desarrollador 4
Evaluación
(176)
Proyectos
236
45%
Arbitraje
17
82% / 12%
Caducado
35
15%
Trabaja
5
Desarrollador 5
Evaluación
(454)
Proyectos
513
33%
Arbitraje
25
40% / 48%
Caducado
7
1%
Trabajando
6
Desarrollador 6
Evaluación
(10)
Proyectos
25
28%
Arbitraje
1
0% / 0%
Caducado
1
4%
Trabajando
7
Desarrollador 7
Evaluación
(4)
Proyectos
4
0%
Arbitraje
2
0% / 100%
Caducado
1
25%
Libre
8
Desarrollador 8
Evaluación
(237)
Proyectos
419
34%
Arbitraje
53
36% / 40%
Caducado
154
37%
Ocupado
9
Desarrollador 9
Evaluación
(38)
Proyectos
40
25%
Arbitraje
20
15% / 75%
Caducado
8
20%
Trabajando
10
Desarrollador 10
Evaluación
(90)
Proyectos
111
37%
Arbitraje
8
88% / 0%
Caducado
0
Trabaja
11
Desarrollador 11
Evaluación
(41)
Proyectos
88
14%
Arbitraje
30
30% / 53%
Caducado
36
41%
Trabaja
12
Desarrollador 12
Evaluación
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
13
Desarrollador 13
Evaluación
(548)
Proyectos
1330
59%
Arbitraje
28
82% / 0%
Caducado
10
1%
Libre
14
Desarrollador 14
Evaluación
(68)
Proyectos
77
8%
Arbitraje
33
9% / 55%
Caducado
6
8%
Trabajando
15
Desarrollador 15
Evaluación
(265)
Proyectos
539
50%
Arbitraje
55
40% / 36%
Caducado
224
42%
Trabaja
16
Desarrollador 16
Evaluación
(64)
Proyectos
69
64%
Arbitraje
3
100% / 0%
Caducado
7
10%
Trabaja
Solicitudes similares
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

Información sobre el proyecto

Presupuesto
50 - 200 USD
IVA (21%): 10.5 - 42 USD
Total: 60.5 - 242 USD
Para el ejecutor
45 - 180 USD
Plazo límite de ejecución
de 1 a 5 día(s)