Partial close script

Ckart 1

Trader
Sep 17, 2018
9
1
24
San Francisco, CA
www.youtube.com
That is exactly what I was looking for!

It will save a lot of time not having to go through all the steps with meta trader doing it the difficult way.

Thank you very much.
 

milesZ

Trader
Dec 3, 2021
1
0
6
22
Have you seen this script? It can be easily modified to close 50% or 25% instead of the current 1/3 of a position.
Hey,

I have never modified scripts before. Wich line do I have to change in order to put a different percent to close?
 

Enivid

Administrator
Staff member
Nov 30, 2008
17,865
1,232
144
Odesa
www.earnforex.com
Hey,

I have never modified scripts before. Wich line do I have to change in order to put a different percent to close?
The line number 44:
MQL4:
double halflots = NormalizeDouble(LOTS / 3.0, vp);
This makes it close 1/3 of a position. You can either keep it as a part and change to LOTS / 4.0 for 25% close or LOTS / 2.0 for 50% close, or you can change it to percentage like LOTS * 0.27 for 27% close.
 
  • 👍
Reactions: milesZ

jibaku

Trader
Dec 27, 2021
2
0
17
37
thanks, but just only 1 position can be closed by partial by this script. can u made it for all position ?
 

Enivid

Administrator
Staff member
Nov 30, 2008
17,865
1,232
144
Odesa
www.earnforex.com
thanks, but just only 1 position can be closed by partial by this script. can u made it for all position ?
It partially closes all positions but only for the current trading symbol. You can make it work on all symbols by replacing this line of code:
MQL4:
if((l_type == OP_BUY || l_type == OP_SELL) && OrderSymbol() == Symbol())
with:
MQL4:
if(l_type == OP_BUY || l_type == OP_SELL)