Audience
For MQL5 builders whose EA fails around Trade.mqh, CTrade trade, trade.Buy, trade.Sell, PositionClose, or a 'trade' undeclared compiler cascade.
MQL5 CTrade blocker
Fix MQL5 CTrade setup errors by checking Trade.mqh includes, CTrade object scope, trade.Buy/trade.Sell calls, result retcodes, and execution guardrails before manual retesting.
Common CTrade evidence
'trade' - undeclared identifier 'CTrade' - unexpected token trade.Buy - undeclared identifier PositionClose call fails ResultRetcode not logged
These are wiring and evidence failures. Treat them as software diagnostics before changing strategy logic or testing order behavior.
Audience
For MQL5 builders whose EA fails around Trade.mqh, CTrade trade, trade.Buy, trade.Sell, PositionClose, or a 'trade' undeclared compiler cascade.
Problem
CTrade issues usually start with structure: the standard trade include is missing, the CTrade object is declared in the wrong scope, or the EA calls a different object name than the one it created.
Outcome
Workfusionapp keeps the repair path narrow: wire the include and object once, keep calls behind risk gates, log retcodes, then route the fixed block into the free desk and support handoff.
Support path
Start with the concrete blocker, keep the full EA context attached, then move to a reviewable output.
Use the standard Trade.mqh include and create one CTrade instance in a scope visible to OnTick and helper functions.
If the EA declares tradeObj but calls trade.Buy, the compiler is correct. Pick one object name and use it consistently.
Do not call trade.Buy or trade.Sell before spread, session, exposure, max-trade, stop-distance, and risk checks pass. Log ResultRetcode after each attempt.
Workflow
The fix is not to rename everything randomly. The fix is to prove the include, object declaration, call site, risk gate, and retcode logging are wired consistently.
Step 1
Paste the first CTrade error
Step 2
Check include and object scope
Step 3
Review trade call and retcodes
Step 4
Retest manually with execution logs
CTrade handoff
Open the guide that matches the failed CTrade wiring, then run the free desk with the first compiler line, include block, object declaration, failing trade call, and any retcode evidence.
Use this when the first blocker is missing Trade.mqh, missing CTrade trade, inconsistent object naming, or trade.Buy/trade.Sell scope.
Use this when the specific error is 'trade' undeclared or the EA has a compiler cascade after one missing object.
Use this when trade calls compile but retcodes, broker comments, or order evidence are not being recorded cleanly.
Send me the CTrade repair workflow
Opt in only if your MQL5 EA is blocked by Trade.mqh, CTrade object scope, trade.Buy/trade.Sell, PositionClose, or retcode logging. This captures the CTrade source for conversion measurement.
Choose the workflow you want, then opt in only if you want Workfusionapp updates.
No. Use one clearly named object in visible scope unless there is a deliberate reason to isolate execution state.
No. It only fixes one code and execution-evidence layer. Manual compile, Strategy Tester review, demo testing, and risk review remain separate.
No. Use code, compiler errors, Strategy Tester or demo retcodes, broker comments, and logs. Workfusionapp does not need broker login.