Summary
Trading Management blocks control what happens after an order or trade exists.
Use them to:
select specific trades or pending orders
delete pending orders
close open trades
partially close trades
move stop loss or take profit
check if a trade is in profit or loss
stop the same action from repeating again and again
The core idea:
Select what to manage → Check if a condition is true → Apply the action → Prevent repeated actions if needed
Also known as: delete orders, delete pending orders, close trades, partial close, move stop loss, modify SL/TP, trade management, pending order management, no editable orders, select trades, once per trade.
The trade management mental model
Most management logic has four parts.
1. When should the logic run?
Start with a timing block.
Examples:
Run per Tick Run per Candle Run at Time Run in Session
Use Run per Tick for active trade management, such as trailing stops.
Use Run per Candle if you only want to manage once per candle.
Use Run at Time if you want to clean up orders at a specific time.
2. Which trade or order should be managed?
Use Select Trades.
This tells the EA what to target.
Examples:
Only pending orders Only open trades Only buy trades Only sell trades Only trades on EURUSD Only trades with Group Number 1 Only automatic trades
Without selection, the action may affect more trades or orders than intended.
3. What condition must be true?
Use blocks such as:
Check Profit/Loss Trade Rule Once per Trade Count Trades
Examples:
Only close if trade is +50 pips Only delete order if price invalidates the setup Only move SL once per trade Only open a new trade if count = 0
4. What action should happen?
Use an action block.
Main action blocks:
Delete Orders Close Trades Modify SL/TP
These blocks directly affect pending orders, open trades, or stop loss / take profit levels.
Control blocks vs action blocks
This distinction matters.
Control blocks
Control blocks decide what should be targeted and whether the action should happen.
Block | Purpose |
Select Trades | Selects the trades or pending orders to manage |
Count Trades | Counts trades/orders before execution |
Check Profit/Loss | Checks if selected trades meet profit/loss conditions |
Once per Trade | Prevents repeated actions on the same trade |
Trade Rule | Adds a custom condition before the action |
Action blocks
Action blocks actually change something.
Block | Action |
Delete Orders | Deletes selected pending orders |
Close Trades | Closes selected open trades fully or partially |
Modify SL/TP | Changes stop loss or take profit on selected trades |
Select Trades
What it does
Select Trades filters which trades or orders should be managed.
Use it before blocks like:
Delete Orders Close Trades Modify SL/TP Check Profit/Loss
The block can be used to filter by settings such as:
trade/order type
buy or sell direction
symbol
group number
trade source
manual or automatic trades
Example
Run per Tick → Select Trades: open buy trades on EURUSD → Check Profit/Loss → Modify SL/TP
This makes sure the logic only manages the selected trades, not everything on the account.
Screenshot placeholder
[Screenshot placeholder: Select Trades block with advanced options expanded]
Caption:
Use Select Trades to define exactly which trades or pending orders the following management blocks should affect.
Delete Orders
What it does
Delete Orders removes pending orders.
It does not close open trades.
Use it for orders that have not triggered yet.
Examples:
Buy pending order Sell pending order Buy stop / buy limit style pending entries Sell stop / sell limit style pending entries
If the order already triggered and became an open trade, use Close Trades instead.
Important: Delete Orders has no editable settings
This is expected.
The Delete Orders block only performs the action:
delete selected pending orders
You control what it deletes with the blocks before it, especially Select Trades.
Correct structure:
Run per Candle → Select Trades: pending orders → Delete Orders
More precise structure:
Run per Candle → Select Trades: pending orders, symbol EURUSD, group 1 → Trade Rule: invalidation condition is true → Delete Orders
Why “no editable orders” can happen
The message usually means the EA did not find any pending orders it could delete at that moment.
Common reasons:
the pending order already triggered
the order was already deleted
Select Trades is filtering the wrong symbol
Select Trades is filtering the wrong group number
there is no pending order active yet
the logic runs before the order exists
you are trying to delete an open trade instead of a pending order
Remember:
Delete Orders = pending orders only Close Trades = open trades only
Screenshot placeholder
[Screenshot placeholder: Select Trades → Delete Orders flow]
Caption:
Delete Orders depends on Select Trades. The Delete Orders block itself does not need settings; the selection happens before it.
Close Trades
What it does
Close Trades exits open trades.
It can close:
the full position
part of the position
Example:
Close Trades: 100%
closes the full trade.
Example:
Close Trades: 50%
closes half of the selected trade.
Important: partial close can repeat
If your logic runs on every tick and you close 50%, it may trigger again and again.
Example:
First trigger: closes 50% Next tick: closes 50% of what remains Next tick: closes 50% again
That can reduce the trade much more than intended.
Use Once per Trade before Close Trades when the close should happen only once.
Better structure:
Run per Tick → Select Trades → Check Profit/Loss → Once per Trade → Close Trades: 50%
Screenshot placeholder
[Screenshot placeholder: Select Trades → Check Profit/Loss → Once per Trade → Close Trades]
Caption:
Use Once per Trade before Close Trades when you only want a partial close or full close to happen once per trade.
Modify SL/TP
What it does
Modify SL/TP changes stop loss or take profit levels on selected trades.
Use it for:
break-even logic
trailing stop logic
lock-in profit
dynamic take profit
adjusting stop loss after a trade moves into profit
Basic structure:
Run per Tick → Select Trades → Check Profit/Loss → Modify SL/TP
Example:
If trade reaches +20 pips → move SL to break-even
For one-time SL changes, add Once per Trade:
Run per Tick → Select Trades → Check Profit/Loss: profit >= 20 pips → Once per Trade → Modify SL/TP: move SL to break-even
For trailing logic, you may intentionally allow repeated updates. In that case, Once per Trade may not be needed.
Check Profit/Loss
What it does
Check Profit/Loss checks whether selected trades meet a profit or loss condition.
It can work with values such as:
pips
currency value
account percentage
Example:
Selected trade profit is greater than 50 pips
Then:
→ Close Trades
or:
→ Modify SL/TP
Important: Check Profit/Loss requires Select Trades before it, because it needs to know which trade or trades to evaluate.
Correct structure:
Select Trades → Check Profit/Loss → action block
Once per Trade
What it does
Once per Trade prevents the same action from being applied repeatedly to the same trade.
Use it when the action should happen once.
Good examples:
Move SL to break-even once Close 50% once Lock in profit once Send trade through one-time management step
Use it before the action block:
Select Trades → Check Profit/Loss → Once per Trade → Close Trades
or:
Select Trades → Check Profit/Loss → Once per Trade → Modify SL/TP
Do not use Once per Trade for logic that should keep updating, such as some trailing stops.
Count Trades
What it does
Count Trades checks how many trades or pending orders exist before the EA opens more.
It is mainly an execution-control block, but it often works together with trade management.
Use it before:
Buy Now Sell Now Buy Pending Order Sell Pending Order
Example:
Trade Rule → Count Trades: buy trades = 0 → Buy Now
Best practice: place Count Trades close to the execution block.
Good:
Trade Rule → Count Trades → Buy Now
Avoid placing it far away from the actual trade execution, because the logic tree may change before the order is placed.
Most common management structures
Delete pending orders at the end of a session
Use this when a pending order should not stay active after the setup expires.
Run at Time: 21:00 → Select Trades: pending orders, symbol EURUSD → Delete Orders
Use case:
Delete untriggered breakout orders at the end of the trading day.
Delete a pending order if price invalidates the setup
Use this when the order should be canceled before it triggers.
Example from support:
A system places a pending order at the top of a 1-hour candle, with SL at the bottom. If price reaches the SL area before the entry triggers, the pending order should be canceled.
Possible structure:
Run per Candle: H1 → Select Trades: pending orders → Trade Rule: candle low reached invalidation level → Trade Rule: entry was not triggered → Delete Orders
Example project placeholder:
[Example link placeholder: Cancel pending order when SL side is hit before entry]
Important: validate this in MT5 Visual Mode. You need to confirm the order exists, is still pending, and is selected correctly before Delete Orders runs.
Close a trade once profit reaches a target
Run per Tick → Select Trades: open trades → Check Profit/Loss: profit >= 50 pips → Once per Trade → Close Trades: 100%
Use this when you want a full exit once a profit target is reached.
Partial close at profit
Run per Tick → Select Trades: open trades → Check Profit/Loss: profit >= 30 pips → Once per Trade → Close Trades: 50%
Use Once per Trade here. Otherwise, the EA may keep closing 50% repeatedly.
Move stop loss to break-even
Run per Tick → Select Trades: open trades → Check Profit/Loss: profit >= 20 pips → Once per Trade → Modify SL/TP: move SL to entry price
Use this for one-time break-even management.
Trailing stop
Run per Tick → Select Trades: open trades → Check Profit/Loss: trade is in profit → Modify SL/TP: update stop loss
Depending on the trailing logic, Once per Trade may not be used because the stop loss may need to update repeatedly.
Best-practice block order
For pending order cleanup
Timing block → Select Trades → Optional Trade Rule / condition → Delete Orders
Example:
Run at Time → Select Trades: pending orders, symbol EURUSD → Delete Orders
For closing trades
Timing block → Select Trades → Check Profit/Loss or Trade Rule → Once per Trade if needed → Close Trades
For modifying SL/TP
Timing block → Select Trades → Check Profit/Loss or Trade Rule → Once per Trade if one-time action → Modify SL/TP
For preventing duplicate entries
Entry condition → Count Trades → Buy Now / Sell Now / Pending Order
Common mistakes
Mistake 1: Trying to edit Delete Orders
Delete Orders does not need settings inside the block.
Use Select Trades before it to define what should be deleted.
Mistake 2: Trying to delete an open trade
Delete Orders only deletes pending orders.
If the order already triggered, it is now an open trade. Use Close Trades.
Mistake 3: No Select Trades before management
If you do not select trades first, the management block may target too broadly or not find the intended trade/order.
Best practice:
Select Trades → management action
Mistake 4: Wrong symbol name
If you filter by symbol, the symbol must match the broker’s exact MT5 symbol.
Examples:
EURUSD EURUSDm EURUSD.pro XAUUSD XAUUSDm US100.cash
If your broker uses EURUSDm, filtering for EURUSD may not match.
Mistake 5: Partial close repeats
If Close Trades is set to 50% and the logic runs every tick, it can repeatedly close half of what remains.
Fix:
Once per Trade → Close Trades
Mistake 6: Management logic is connected to the wrong tree
Trade management does not always need to be connected directly after the execution block.
You can create a separate management tree.
Example:
Run per Tick → Select Trades → Check Profit/Loss → Modify SL/TP
This can manage trades independently while the entry tree stays clean.
Debugging checklist
If management logic does not work, check this order:
Is there actually a pending order or open trade to manage?
Are you using the correct block?
Pending order → Delete Orders
Open trade → Close Trades or Modify SL/TP
Is Select Trades filtering the right type?
Is the symbol exactly correct?
Is the group number correct?
Is the magic number correct?
Is the condition actually true?
Does Once per Trade block repeated actions correctly?
Did you export and test in MT5 Visual Mode?
Conclusion
Trading Management blocks work best as a small decision tree.
Use this structure:
When should it run? → Which trade/order should it manage? → What condition must be true? → What action should happen? → Should this happen once or repeatedly?
Use Select Trades before managing specific trades or orders.
Use Delete Orders for pending orders.
Use Close Trades for open trades.
Use Modify SL/TP for changing stop loss or take profit.
Use Check Profit/Loss, Trade Rule, and Once per Trade to control when those actions happen.
Always export and test in MT5 Visual Mode before trusting the management logic.
