Loading…

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 · MT5 · v1.0 · Free

About Session Statistics Recorder

Session Statistics Recorder is a script for MetaTrader 5. 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.ex5, SessionRecorder.mq5, SessionRecorder.txt.

Settings

SettingDefaultWhat it does
Asian start hour22Asian session start, server time hour (0-23)
Asian end hour7Asian session end, server time hour (exclusive)
London start hour7London session start, server time hour
London end hour16London session end, server time hour (exclusive)
New york start hour12New York session start, server time hour
New york end hour21New York session end, server time hour (exclusive)
Symbol onlyfalseOnly count trades on this chart's symbol
Magic filter0Only count this magic number (0 = all)
Recalc interval sec30Seconds between recalculations
Csv file nameSessionRecorder_Report.csvReport file, in MQL5\Files

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Pivot Points · Trading Sessions · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria