Loading…

Session Attribution Report

"Which session works best" sounds like a simple question but hides two choices most scripts skip past. Real trading sessions overlap - London and New York both run through the mid-afternoon in most brokers' server time - so a trade opened in the overlap can only be counted in one bucket if the report is going to add up to the true total. And "server time" is not GMT and drifts with whichever daylight-saving calendar the broker itself follows, so a script that assumes GMT session hours silently misattributes trades near the boundaries on any broker that doesn't match. This report sidesteps the overlap problem by using fixed, non-overlapping server-time hour bands (defaulting to three even eight-hour blocks) rather than the real overlapping session times, so every closed trade lands in exactly one bucket with no double counting. The band edges are inputs, so they can be moved to match a specific broker's own published session times instead of guessing. For each session the report prints the trade count, win rate and net profit (including swap and commission), plus which session was most profitable overall. Notes and limitations Attribution is by the hour a trade was OPENED, server time - not GMT, not the hour it closed, and not the hour the trader was actually watching the screen. Any hour outside all three configured bands is reported separately as "Other/unassigned hour" rather than silently dropped or force-fitted into the nearest session. The default bands are even 8-hour blocks, not the real (overlapping) Asian/London/New York session times - this is a deliberate simplification to keep every trade in exactly one bucket. Move the band edges to whatever non-overlapping split is meaningful for the broker in question if the defaults don't fit. Net profit per trade includes swap and commission; it does not include any separate rollover or dividend adjustments some brokers post as their own balance-operation rows.

Script · MT4 · v1.0 · Free

About Session Attribution Report

Session Attribution Report is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Asian start hour, Asian end hour and London start hour. MQL source code included.

Files in the download: SessionAttributionReport.mq4, SessionAttributionReport.txt.

Settings

SettingDefaultWhat it does
Asian start hour0Asian session start (server hour, 0-23)
Asian end hour8Asian session end (exclusive, 0-24)
London start hour8London session start (server hour, 0-23)
London end hour16London session end (exclusive, 0-24)
New york start hour16New York session start (server hour, 0-23)
New york end hour24New York session end (exclusive, 0-24)
From date0Only trades opened on/after this date (0 = no lower bound)
To date0Only trades opened on/before this date (0 = no upper bound)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Trading Sessions · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria