Skip to content
All library documents

Closing Multiple Orders with Filters for Side and Profit

Article MQL5 code base

Summary

This document describes a trading-terminal script for closing several market orders or deleting selected pending orders. Its settings allow users to target all orders, buy orders, sell orders, buy limit orders, or sell limit orders. A profit-only filter can restrict eligible buy or sell positions, while an all-orders setting overrides the other choices. A slippage parameter controls the permitted execution slippage, and automated trading must be enabled for the script to operate.

The material explains the script’s controls but provides no implementation details, test results, or evidence about how it behaves under different market conditions. It does not discuss order-selection edge cases, execution failures, or the risks of closing positions automatically. Traders should understand how the all-orders override interacts with other settings before running it.

Key ideas

  • The script can close all market orders or target buy and sell orders separately.
  • Pending buy and sell limit orders can be deleted through their own settings.
  • A profit-only filter applies to selected buy or sell positions unless the all-orders setting overrides it.
  • The script requires automated trading to be enabled, and its slippage setting affects execution.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.