EA operations resources

Code Review

Track MQL5 trade events before guessing why the EA entered or exited.

An accepted order request is not the same as a filled trade. OnTradeTransaction helps you capture the account event stream, then reconcile orders, deals, positions, and history so the EA can explain fills, closes, SL/TP changes, and duplicate entries.

Search intent

The developer needs to debug the trade lifecycle in an MT5 EA and understand what happened after an order send.

Cluster

Code Review

Tool path

mql5 code review

Reader

mq5 developer

Optional follow-up for MQL5 OnTradeTransaction deal tracking

Open the free desk first. Opt in only if this guide matches your compiler blocker for MQL5 OnTradeTransaction deal tracking.

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 order, deal, and position events

OnTradeTransaction receives transaction types from the terminal. Treat request accepted, order update, deal add, and position change as different events instead of one generic trade result.

Log transaction type
Log order, deal, and position IDs
Do not mark a trade filled only because the request was accepted

Filter events by symbol and Magic Number

The transaction stream can include manual trades, other EAs, and account maintenance events. Filter the event context before changing your EA state.

Check symbol and Magic Number
Compare request/comment context
Ignore unrelated account events

Reconcile live events with history

After the event, use HistorySelect and HistoryDealGet* calls to read closed PnL, exit reason, commission, swap, and entry direction. Keep a processed ID set so the same deal is not counted twice.

Select a history window
Read DEAL_ENTRY and DEAL_REASON
Store the last processed deal or transaction ID

Use the tool

Paste your handler, order-send block, and history loop into Workfusion Debugger or Code Review to build a clean event log before the next Strategy Tester or demo retest.

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

Related guides

Continue the EA build path.