Magic Cost Ledger
- Utilitários
-
Kim Seongyu
I approach investing by asking what drives an investment’s return, what could undermine it, and what evidence would change my view. - Versão: 1.2
- Atualizado: 24 novembro 2026
- Ativações: 5
Which trades made up your EA's net result? Choose a broker-date range, find your EA by name or magic number and select Postings. Each posting shows the original ticket, broker time, symbol, allocation source, gross P/L, commission, swap, fees and net amount in the deposit currency.
Try it on MT4 or MT5. Turn on Show example, then choose Week and All symbols. The fictional account shows 27 USD net. Magic 2101 contributed 43 USD. Select Postings to see ticket 900104 with 32 USD net, then use the right arrow to see ticket 900102 with 11 USD net. Back returns to the same strategy. Turn off the example on a regular chart to read the account history available to your terminal.
The running visual Strategy Tester uses the same fictional account. Let the test play while using the buttons. The sample and its exports are labeled. The indicator reads history and can share a chart with a trading EA.
Start with one period
- Select Day, Week or Month. Weeks start on Monday. For a past period, set both report dates in the indicator inputs, then use Dates. Both calendar dates are included in broker server time. During a market closure the report uses the last available server quote time. The CSV records that observation separately from the report end.
- Enter names such as 2101=London Breakout;4107=Asia Range in EA names. Each magic starts with its own row. For one EA that runs on several magic numbers, give those numbers the same name and enable Combine same EA names. The summary then shows their combined result. Each posting keeps its original magic and ticket. Rows are ordered by descending net P/L. All symbols switches between the account and the chart instrument.
- Select CSV in the overview to export all groups, or inside Postings to export every underlying posting for the selected group. From the terminal choose File → Open Data Folder, then MQL5/Files or MQL4/Files. Each manual export has its own filename.
Keep a local report up to date
Set Auto-export label to a name such as desk-1 to refresh one CSV containing the postings for all groups in the displayed period and symbol scope. A successful refresh replaces the same file, including after a restart. The filenames end in _sample.csv or _live.csv . A disconnected trading account, an incomplete read or a file locked by another reader leaves the previous report in place. Use distinct labels for different charts or accounts when you want to keep their files separately. An empty label disables automatic export.
Read a strategy row
A fictional trade with gross P/L of 36 USD, commission of −3 USD and swap of −1 USD contributes 32 USD net. A separate posted entry charge within the period also contributes even if that position closes later on MT5. SAMPLE DATA displays a small fictional history for exploring the controls. The tester uses this history. A regular chart uses the account's available history unless the sample input is enabled.
Platform coverage
MT5. Buy and sell deals are booked on their deal timestamps. Entry costs follow their recorded magic. A partial or full exit follows the position owner at that moment. If you manually close an EA's position, the posting can show the EA's allocation magic alongside the broker's recorded deal magic of zero. In the posting CSV, magic identifies the allocation and broker_magic preserves the broker's record. If two strategies shared a net position or its opening order is missing, the affected exit appears under Unattributed.
An opening order can fill across two reporting periods. The ledger checks when that order was placed before treating its later fill as a new position. If earlier ownership history fails to load, the panel flags the missing history and keeps the selected period's amounts. A newly placed opening order or a reversal within the period can still establish an owner for later exits.
A netting reversal closes the old side and opens the new side. When different magic numbers own the two sides, realized P/L and swap go to the known closing owner. The broker's combined commission and fee stay under Unattributed, including when both magics share one EA name. The reversal can appear in two groups, with one exit in total. Later exits follow the new owner. Separately posted broker commission and charge records are grouped under Account charges in the all-symbol view. Deposits, credits and other non-trading entries are excluded. A broker fee posted without a symbol is outside a chart-symbol filter.
MT4. The ledger reads closed market orders loaded under Account History and books profit, commission and swap at the order's close time, using its recorded magic number. Select All History to make the period available. Charges recorded as separate balance operations are outside these totals. Floating P/L is excluded on both platforms.
| Setting | Effect |
|---|---|
| Initial period | Open on today's, this week's or this month's postings. |
| Chart symbol only | Start with the current chart instrument. |
| Refresh interval | Read the available history every 5 to 3,600 seconds. |
| Show example | Use labeled fictional USD entries on a regular chart. |
| EA names | Enter semicolon-separated decimal magic numbers and names. A repeated magic retains its first valid name. |
| First and last broker dates | Set both dates to open the saved range. The examples use 7–9 April 2025. |
| Auto-export label | Use up to 48 ASCII letters, digits, hyphens or underscores for the local file. |
| Combine same EA names | Group active nonzero magics with the same case-sensitive name. Manual trades, unattributed costs and account charges keep their own rows. |
