Loading…

Day Of Month Seasonality Study

"Day X of the month tends to be strong" is one of the most common seasonality claims, and one of the easiest to state wrong. A plain average by day-of-month is misleading on its own: day 31 only occurs in seven months of the year, day 29 mostly in leap Februaries and the 31-day months, while day 1 through 28 occur in every single month. Treating a five-sample average the same as a two-hundred-sample average makes noise look like a pattern. This script walks the symbol's daily bars, computes the close-to-close return (percent or log, your choice) attributed to the calendar day of the bar it closed on, and aggregates mean, standard deviation and a raw sample count for every day 1 through 31. Every row in the exported table carries its own sample count and a "TrustedSample" flag driven by a minimum-sample input, so a day with too few observations is flagged rather than silently presented as equally reliable. Nothing here claims causation. It is a descriptive table: what did each calendar day actually average historically, and how many times did that day happen. Notes and limitations - Daily timeframe only (PERIOD_D1). If the broker does not provide deep daily history, increase InpMaxBars only as far as the history actually reaches - the script uses whatever is available and reports the real sample counts either way. - A trading holiday or weekend simply does not appear as a bar; day 1 of a month landing on a Sunday contributes no sample that month. This is real market behaviour, not a bug. - The return attributed to a calendar day is the return realised ON that bar's close relative to the prior close - not a forward-looking return from that day. - This is a descriptive statistics tool, not a trading signal. A historically strong day is not a guarantee of a future strong day.

Script · MT4 · v1.0 · Free

About Day Of Month Seasonality Study

Day Of Month Seasonality Study is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Max bars, Min samples and Use log return. MQL source code included.

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

Settings

SettingDefaultWhat it does
Max bars3000Daily bars to scan (0 = all available)
Min samples8Minimum sample count to trust a day's average
Use log returnfalseUse log return instead of simple percent return
File nameDayOfMonthSeasonality.csvOutput file (in MQL4\Files)

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: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria