Audience
For MT4 and MT5 builders whose EA opens duplicates, blocks valid trades, manages another chart's positions, or counts old history as current exposure.
MQL5 ownership debugger
Debug MT5 Expert Advisor magic-number, symbol, account-history, and position-scope bugs before changing signal logic or risk settings.
Common ownership evidence
MaxOpenTrades blocks even with no visible chart trade EA manages positions from another symbol Closed losing trades counted as open exposure MagicNumber filter missing in history loop PositionSelect used without checking POSITION_MAGIC
These are state and ownership failures, not trading-edge evidence. Fix scope before changing signals or risk.
Audience
For MT4 and MT5 builders whose EA opens duplicates, blocks valid trades, manages another chart's positions, or counts old history as current exposure.
Problem
Magic-number bugs look like strategy bugs until the EA proves which positions, orders, and closed deals it actually owns. Missing symbol filters, mixed MT4/MT5 history APIs, and account-wide counts can make max-trade and losing-streak rules behave unpredictably.
Outcome
Workfusionapp keeps the debug path narrow: isolate symbol and magic filters, separate open positions from closed history, log the ownership count, then route the code into a reviewable EA debugging pass.
Support path
Start with the concrete blocker, keep the full EA context attached, then move to a reviewable output.
Open positions and pending orders should be filtered by symbol and magic number before the EA decides whether another trade is allowed.
A losing-streak or cooldown rule can inspect closed deals, but it should not be mixed with current open-position counts without clear logs.
Print symbol, magic number, counted positions, counted orders, history window, and block reason so the next manual test can reproduce the decision.
Workflow
Do not change entry logic until the EA can prove which trades belong to this strategy instance. Ownership, state, and history scope are the first checks.
Step 1
Paste the order-count loop
Step 2
Check symbol and magic filters
Step 3
Separate open positions from history
Step 4
Retest manually with ownership logs
Related resource cluster
Use the cluster hub when the first issue branches into adjacent compiler, draft, risk, or review checks.
Compiler cluster
Use this hub for undeclared identifiers, CTrade setup, CopyBuffer, invalid stops, invalid volume, and fill-policy blockers.
Open compiler cluster
Review cluster
Use this hub when the next useful step is a structured EA review, no-trades diagnostic, audit trail, or readiness handoff.
Open review cluster
Magic-number handoff
Open the guide that matches the count failure, then run the free desk with symbol, magic number, order loop, position loop, and one journal excerpt.
Use this when PositionSelect, PositionsTotal, pending orders, or POSITION_MAGIC filters make the EA count or manage the wrong trade.
Use this when Magic Number scope combines with persistent signals, missing cooldown, or max-open-trade gaps.
Use this when closed deals, losing streaks, or account-history windows are being counted incorrectly.
Send me the magic-number debug workflow
Opt in only if your EA has Magic Number, symbol-filter, duplicate-entry, max-trade, or trade-history scope problems. This captures the magic-number source for conversion measurement.
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 deskChoose the workflow you want, then opt in only if you want Workfusionapp updates.
Only if that is intentional. Many EAs should isolate by symbol, timeframe, strategy instance, and magic number so tests match live behavior.
Yes, if the EA mixes closed-deal history with open-position rules. Keep those decisions separate and logged.
No. It only makes ownership and state decisions observable. Strategy, risk, execution, and testing remain separate.