Session Statistics Recorder
A trader who wants to know whether they actually trade better during London than during the Asian session usually has to export history and pivot it by hand. This EA does that split continuously: every trade in account history is classified by the server-time hour it was opened in, against three configurable session windows, and the running totals for each session are written to a CSV report and shown on the chart. The scoreboard is rebuilt from a full history scan on every recalculation, not tracked incrementally. An incremental counter has to remember which tickets were already counted, and that bookkeeping has to survive a terminal restart correctly or it either double-counts or silently drops trades after a restart. A full rescan is slower per call but always correct, and MQL4 account history is small enough that the cost is not noticeable at any sane recalculation interval. Session windows are read as server-time hours, and the Asian window is allowed to wrap past midnight (entered as 22 to 7, for example). A trade opened in a period where two windows overlap - London and New York commonly overlap for a few hours - is credited to whichever window is checked first in a fixed priority order: Asian, then London, then New York. That is an arbitrary tie-break, documented here and in the source rather than left for a reader to puzzle out. Notes and limitations - Session hours are server-time, and every broker sets its server clock to a different GMT offset. The default hours are a reasonable starting point, not a universal truth - verify against your own broker before trusting the split. - A trade opened in an overlap between two session windows is credited to whichever window is checked first (Asian, then London, then New York), not split between them. - Balance and credit entries in history are skipped; only real buy/sell trades are counted (OP_BUY/OP_SELL on MQL4, DEAL_TYPE_BUY/SELL exit deals on MQL5). - On MQL5, if a trade's entry deal has aged out of local terminal history independently of its exit deal, that trade is skipped rather than reported with a guessed open time. - This EA never trades. It only reads closed-trade history and reports on it.
Expert advisor · MT4 · v1.0 · Free
About Session Statistics Recorder
Session Statistics Recorder is a script for MetaTrader 4. It has 10 settings, such as Asian start hour, Asian end hour and London start hour. MQL source code included.
Files in the download: SessionRecorder.ex4, SessionRecorder.mq4, SessionRecorder.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Asian start hour | 22 | Asian session start, server time hour (0-23) |
| Asian end hour | 7 | Asian session end, server time hour (exclusive) |
| London start hour | 7 | London session start, server time hour |
| London end hour | 16 | London session end, server time hour (exclusive) |
| New york start hour | 12 | New York session start, server time hour |
| New york end hour | 21 | New York session end, server time hour (exclusive) |
| Symbol only | false | Only count trades on this chart's symbol |
| Magic filter | 0 | Only count this magic number (0 = all) |
| Recalc interval sec | 30 | Seconds between recalculations |
| Csv file name | SessionRecorder_Report.csv | Report file, in MQL4\Files |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Pivot Points · Trading Sessions · MT4 Expert Advisor · MQL4 Source Code