Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Partial Closing Buy Order - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources

author EAcpu | 7 reads | 0 comments |

Partial Close Buy Orders - script for MetaTrader 5

The main purpose of this script is to close some of the open buy orders (i.e. profit) and let other running orders close with the target profit. Check the Experts tab for information.

Partial Close Buy Orders - script for MetaTrader 5

Input parameters :

ClosePercentage : Percentage (0-100) of each buy position that you want to close

Slippage: Maximum slippage allowed (in points)

CommentText: if you only want to close positions with a specific comment (leave it blank for all buy positions)

Available for multiple buy positions

Keep stop loss and take profit levels for remaining positions

Verify minimum volume requirements

Handle errors and provide feedback

Copy the code to MetaEditor

Compile (F7)

The script will appear in the Navigator panel under "Scripts"

Drag it to any chart to execute

The script will close a specified percentage of all buy positions unless you filter by comments

It uses FOK (Fill or Kill) execution type to ensure that the entire partial closing position is filled at once

Remaining positions will maintain their original Stop Loss/Take Profit levels


Attachment download

📎 partial_close_buy_orders.mq5 (3.99 KB)

Source: MQL5 #60232

Verification code Refresh