EA operations resources

Code Review

Filter MQL5 positions by symbol and Magic Number before changing signal logic.

PositionSelect, PositionGetTicket, and PositionsTotal can make a bug look like a strategy problem when the EA counts account-wide exposure instead of the strategy instance it owns. Fix the ownership filter first: symbol, Magic Number, order type, and the exact block reason should be visible before max-trade, cooldown, or close logic runs.

Search intent

The developer needs to stop an MT5 EA from counting the wrong positions, blocking valid trades, or managing another strategy instance.

Cluster

Code Review

Tool path

mql5 code review

Reader

mq5 developer

Optional follow-up for MQL5 PositionSelect and Magic Number filter

Open the free desk first. Opt in only if this guide matches your compiler blocker for MQL5 PositionSelect and Magic Number filter.

Intent locked: Paste compiler errors

Lead activation handoff

No email wait is required. After saving the opt-in, continue into the free desk with the same blocker so the visitor-to-lead-to-workflow path is measurable.

Continue in free desk

Choose the workflow you want, then opt in only if you want Workfusionapp updates.

Separate position selection from ownership

Selecting a position by symbol or ticket is not the same thing as proving the EA owns it. Read the selected position properties and compare them against the EA inputs before acting.

POSITION_SYMBOL matches the chart or configured symbol
POSITION_MAGIC matches the EA MagicNumber input
Unexpected manual or external positions are skipped

Count pending orders separately

Pending orders and open positions are different exposure states. A max-trade gate should say exactly whether it counted market positions, pending orders, or both.

PositionsTotal loop for open positions
OrdersTotal loop for pending orders
Separate log fields for each count

Log the blocker once

A good ownership gate explains why a trade was skipped without flooding every tick. Log the symbol, Magic Number, counted positions, counted orders, and next allowed action.

Block reason is explicit
Logs include symbol and magic
Duplicate-entry checks stay reproducible

Use the tool

Paste the position or order-count loop into Workfusion Debugger to add MQL5 ownership filters before the next Strategy Tester run.

Fix the first error first
Keep full EA context attached
Recompile before changing strategy logic

Related guides

Continue the EA build path.