Holiday Proximity Return Study
"Markets get thin around holidays" is widely repeated and rarely measured. This script takes a user-supplied list of holiday dates - Christmas, Thanksgiving, national bank holidays, whatever the trader wants to test - and builds a window of trading days before and after each one, then reports the average return and average range for every offset in that window, compared against the symbol's own all-history baseline for the same two figures. A holiday date itself is very often not a trading day: it lands on the actual public holiday, which may be a weekend or a day the market is simply closed. Looking the date up directly in the price history would usually fail. This script instead resolves each listed date to the nearest trading bar on or after it (a nearest-bar lookup, not an exact match), then measures the window of offsets around that trading bar - so a holiday that closes the market on a Thursday still contributes real data from the Wednesday before and the Friday after. The holiday list itself is intentionally external and user-editable: a single script cannot know which holidays matter for a given broker, symbol or trader, so it reads a documented CSV instead of hardcoding a calendar. Notes and limitations - A holiday date older than the symbol's available history, or newer than the most recent bar, is silently skipped and does not contribute to the table; the summary line reports how many of the listed dates actually matched a trading bar. - The nearest-bar resolution always looks ON OR AFTER the listed date, never before it - a Saturday Christmas resolves to the following Monday's bar, not the preceding Friday's. - Range is measured in pips using the symbol's own point size and digit count, never a hardcoded pip value, so it is comparable across FX pairs, metals and indices run through the same script. - This is a descriptive comparison against the symbol's own baseline, not a statistical significance test - read the deviation from baseline as a magnitude, not as proof of an effect.
Script · MT5 · v1.0 · Free
About Holiday Proximity Return Study
Holiday Proximity Return Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Holiday file, Window days and Max bars. MQL source code included.
Files in the download: HolidayProximityStudy.ex5, HolidayProximityStudy.mq5, HolidayProximityStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Holiday file | HolidayDates.csv | Holiday list (in MQL5\Files), format below |
| Window days | 3 | Trading days before/after to measure |
| Max bars | 3000 | Daily bars to scan for the baseline (0 = all) |
| Output file | HolidayProximityStudy.csv | Output file (in MQL5\Files) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code