Script required for calculating lot size and partially closing positions

MQL5 Script

Specifiche

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. 


Con risposta

1
Sviluppatore 1
Valutazioni
(332)
Progetti
452
52%
Arbitraggio
22
50% / 27%
In ritardo
5
1%
In elaborazione
2
Sviluppatore 2
Valutazioni
(9)
Progetti
14
14%
Arbitraggio
1
0% / 100%
In ritardo
1
7%
In elaborazione
3
Sviluppatore 3
Valutazioni
(156)
Progetti
170
34%
Arbitraggio
6
50% / 50%
In ritardo
2
1%
In elaborazione
4
Sviluppatore 4
Valutazioni
(176)
Progetti
235
46%
Arbitraggio
17
82% / 12%
In ritardo
35
15%
In elaborazione
5
Sviluppatore 5
Valutazioni
(446)
Progetti
505
33%
Arbitraggio
25
40% / 48%
In ritardo
7
1%
Caricato
6
Sviluppatore 6
Valutazioni
(10)
Progetti
25
28%
Arbitraggio
1
0% / 0%
In ritardo
1
4%
In elaborazione
7
Sviluppatore 7
Valutazioni
(4)
Progetti
4
0%
Arbitraggio
2
0% / 100%
In ritardo
1
25%
Gratuito
8
Sviluppatore 8
Valutazioni
(234)
Progetti
415
34%
Arbitraggio
52
37% / 40%
In ritardo
153
37%
Caricato
9
Sviluppatore 9
Valutazioni
(38)
Progetti
40
25%
Arbitraggio
20
15% / 75%
In ritardo
8
20%
In elaborazione
Ordini simili
Hello there, I would like help with creating a Tradovate Indicator/Script to help ease my trade. Tradovate is based on JavaScript so knowing it is a must. I would like to create a click to trade script. Basically using my keyboard and a click of the mouse (left click). Example, when I hold SHIFT (or whatever keyboard key the user desires) and move the mouse, a line would show indicating a buy order. Wherever the
Hello I am looking for a developer to help me Backtest my tradingview strategy in tradingview platform and make it work perfectly without errors please kindly reach out to so we can proceed
Hello I am looking for a developer to help me to convert my mt4 strategy to tradingview and make it work perfectly your expertise is highly needed for this project
Hello I am looking for a developer to help me backtest my tradingview script on tradingview platform in other to show me how it perform on tradingview your expertise is highly needed for this project
Hello, I am looking for someone that can develop for me a trading bot, that can trade on Crash 500 and 1000, and also on Boom 500 and 1000. The bot must buy on Crash 500 and 1000 and sell on Boom 500 and 1000. The indicator we use is the Awesome Oscillator. The CRASH 500/1000 we scalp it by buying. We only place our ENTRY that is to BUY when the Awesome Oscillator changes from VALUE DOWN to VALUE UP and by changing I
Hi there, I need a profitable MT5 trading robot with confirmed profitable results. It can be for any major pair, I just need a profitable bot, on autopilot. If you have a profitable bot, please contact me. And if possible, will need to test it for sometime before I purchase it
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
I'm looking for a good developer to help me develop EA Just add judgment sentences in EA This is a recurring transaction Developers who know how to write MT4 and MT5 can apply It's just a simple transaction

Informazioni sul progetto

Budget
50 - 200 USD
IVA (21%): 10.5 - 42 USD
Totale: 61 - 242 USD
Per lo sviluppatore
45 - 180 USD
Scadenze
da 1 a 5 giorno(i)

Cliente

Ordini effettuati1
Numero di arbitraggi0