Audience
For MQL5 builders whose EA needs closed-trade PnL, TP hit counts, magic-number reports, or account-history logic but fails around HistorySelect, HistoryDealGetTicket, deal properties, or duplicate HistoryDeals includes.
MQL5 deal-history blocker
Fix MQL5 history and deal-function errors by using HistorySelect, HistoryDealsTotal, HistoryDealGetTicket, deal properties, magic-number filters, and closed-PnL grouping correctly.
Common deal-history evidence
'HistoryDealGetTicket' - undeclared identifier HistoryDealsTotal() returns 0 HistorySelect failed DEAL_PROFIT reads 0 for every row duplicate HistoryDeals.mqh include conflict
These are history-selection, deal-loop, include, and property-read failures. Fix the evidence layer before using the output in risk reports or project handoff notes.
Audience
For MQL5 builders whose EA needs closed-trade PnL, TP hit counts, magic-number reports, or account-history logic but fails around HistorySelect, HistoryDealGetTicket, deal properties, or duplicate HistoryDeals includes.
Problem
MQL5 trade history is deal-based. Many broken EAs try to reuse MQL4 order loops, download a random HistoryDeals.mqh file, skip HistorySelect, or double-count entries and exits.
Outcome
Workfusionapp keeps the repair path narrow: select the history window, loop deal tickets, read typed properties, filter by symbol and magic number, then route the code into the free desk with a small reproducible history block.
Support path
Start with the concrete blocker, keep the full EA context attached, then move to a reviewable output.
Call HistorySelect with an explicit from/to range, check the return value, and log GetLastError before assuming the account has no deals.
Use HistoryDealsTotal and HistoryDealGetTicket, then read properties with HistoryDealGetInteger, HistoryDealGetDouble, and HistoryDealGetString.
Filter by DEAL_SYMBOL, DEAL_MAGIC, and DEAL_ENTRY so entries, exits, swap, commission, and partial closes are not counted as the wrong strategy result.
Workflow
The goal is not to prove the EA performs. The goal is to make closed-trade evidence readable and reproducible before any manual reporting, tester review, or handoff.
Step 1
Paste the history/deal code
Step 2
Select the history window
Step 3
Loop deal tickets safely
Step 4
Group closed PnL without double-counting
Deal-history handoff
Open the guide that matches the failed history read, then run the free desk with the HistorySelect range, deal loop, getter calls, symbol/magic filter, and expected report output.
Use this when the blocker is HistorySelect, HistoryDealGetTicket, HistoryDealGetInteger/Double/String, missing deal properties, or closed-PnL grouping.
Use this when the EA compiles but needs cleaner signal, execution, retcode, closed-trade, and report evidence before handoff.
Use this when MQL4 order-history loops, OrderSelect patterns, or MT4-style helpers are being copied into MQL5.
Send me the deal-history repair workflow
Opt in only if your MQL5 EA is blocked by HistorySelect, HistoryDealGetTicket, deal-property reads, magic-number PnL, or closed-trade reporting. This captures the deal-history source for conversion measurement.
Choose the workflow you want, then opt in only if you want Workfusionapp updates.
Usually no. Start with the built-in MQL5 history APIs, HistorySelect, deal tickets, and typed property getters.
Common causes are no HistorySelect range, wrong date window, wrong account history scope, or reading before the tester/account has closed deals.
No. It only organizes historical evidence. Strategy quality still needs proper tester reports, out-of-sample review, and manual validation.