Loading…

Monthly Seasonality Table

"This pair always rallies in November" is a claim that only means something if it held across several separate years, not one memorable one. This script builds the matrix needed to check it: every calendar month in the loaded daily history gets its own return, from that month's first bar's open to its last bar's close, printed as one row per year and month. The matrix alone answers the question for a specific year, but the summary underneath it is the part worth reading first. Full calendar months are grouped by month number across every year on file, and each month gets a mean return, a count of years, the percentage of those years that closed positive, and a bias label - UP or DOWN - only when that percentage clears InpBiasThresholdPct in either direction. A month sitting near 50/50 gets no label at all, because "no persistent bias" is itself the honest answer for most months on most symbols. Partial months - the first and last calendar month in the loaded window, which rarely align with a full month of bars - are shown in the matrix for transparency but deliberately excluded from the bias summary. Counting a half-covered month as equal to a full one would quietly bias the most recent data, which is exactly where a trader most wants the number to be honest. Notes and limitations - Needs D1 history loaded for the symbol regardless of which chart the script is run from; if the terminal has not downloaded enough daily history, the matrix will be shorter than InpMaxYears requests. - A month's return uses that month's own first open and last close in the loaded window - it is not adjusted for splits, symbol changes or contract rollovers on instruments where those occur. - The bias summary is descriptive seasonality, not a backtested edge. It says nothing about whether the pattern was tradeable after spread and slippage, and a past bias is not a guarantee of a future one. - Months with very few years on file will more easily cross the bias threshold by chance; the year count is printed next to every summary row for that reason.

Script · MT4 · v1.0 · Free

About Monthly Seasonality Table

Monthly Seasonality Table 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 Symbol, Max years and Bias threshold pct. MQL source code included.

Files in the download: MonthlySeasonalityTable.ex4, MonthlySeasonalityTable.mq4, MonthlySeasonalityTable.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max years20Most recent years of daily bars to include
Bias threshold pct70.0Percent of years agreeing in direction to call it a bias
Save csvtrueWrite the year-by-month matrix to a CSV file

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