Order Type Ledger
- Utilities
- Version: 1.0
- Activations: 10
Order Type Ledger reads this account's own order history - not its trade history - and counts what happened to every order that was placed. It does not predict and it does not advise. It never looks at trade results; it only counts outcomes: filled, cancelled, expired, rejected.
WHY THIS EXISTS
Most trading tools only look back at trades that filled. A pending order that expired untouched, a stop order that got rejected, an order that sat for hours before it filled - none of that shows up in a trade-history summary, because it never became a trade. The order history tab lists these one by one, but nothing adds them up. "37 percent of the limit orders placed last month never filled" is a fact this account already has - it is just never counted.
SETUP
1. Drag the EA onto any chart. The symbol and timeframe do not matter - it reads the account's whole order history, not the chart it is running on.
2. A panel appears in the top-left corner and fills in from this account's own order history.
3. It recalculates only when the order count changes, checked every 60 seconds. Nothing needs to be started or configured.
4. Nothing else is required. There are no numeric settings to tune.
INPUTS (four, in this order)
- InpShowPanel (true) - show or hide the panel.
- InpPanelCorner (top-left) - which of the four chart corners the panel sits in.
- InpPanelFontSize (9) - panel text size. Display only.
- InpColorText (white) - panel text colour.
There is no numeric threshold anywhere. The 365-day window, the 60-second recheck, and the minimum sample size for a median are all fixed and cannot be changed.
WHAT THE PANEL SHOWS
Every order from the last 365 days is placed into one of four groups by type - Market, Limit, Stop, Stop-Limit - and counted by outcome: Filled, Cancelled, Expired, Rejected. Next to each group, Unfilled shows what share of it did not fill (cancelled, expired or rejected, out of that group's total; partially filled orders count as filled). A group with fewer than five orders shows a dash instead of a percentage - too small a sample to mean anything.
Below that, Median wait to fill shows how long a filled order typically waited between being placed and being filled, worked out separately for Market orders and for Pending orders (Limit, Stop and Stop-Limit combined), because the two behave on completely different timescales. A market order usually fills in under a second; a pending order can sit for hours or days. Mixing them would make the median meaningless. Either figure shows a dash if there are fewer than five filled orders in that category.
THE REPORT FILE
A CSV file is written to MQL5\Files\OrderTypeLedger\order_report.csv, broken down by month, symbol and order group, with columns: Month, Symbol, OrderGroup, State, Count, MedianWaitSeconds. It is rewritten in full each time, not appended, so it never contains duplicates. Its full path is printed on the panel.
BEFORE YOU TEST IT
The Strategy Tester only has the order history from that one test run, so what you see there reflects the test period, not this account's real order history. It is useful for confirming the EA runs without errors, not for reading its numbers as if they were real account data.
WHAT IT DOES NOT DO
It never places, closes or modifies an order - it has no connection to the trade side of the terminal at all. It does not use trade results anywhere - only the order's type, state, symbol and timing. It does not say why an order was rejected or expired - a broker's reasoning is not always available, and only what the terminal actually records is counted. It does not compare symbols to each other or suggest changing how you place orders. It reads one account on one terminal, going back only as far as this account's own order history reaches.
