Skip to content
All library documents

Detecting the First Friday of a Month in MetaTrader

Article MQL5 code base

Summary

The code provides a MetaTrader 4 Expert Advisor example for identifying a Friday that falls between the first and seventh calendar days of a month. It checks the current weekday and day of month, then compares the current daily candle's timestamp with a stored timestamp so the message is printed only once for that candle. The article associates this date rule with the timing of the US Nonfarm Payrolls release.

The example is a calendar trigger, not an economic-event calendar or a trading strategy. It does not check an official release schedule, account for holidays, or explain broker time zones and server-time differences. Its label can therefore identify a qualifying calendar Friday without confirming that a report is actually scheduled that day. The document provides code but no testing evidence, event-date validation, or discussion of how to use the trigger to manage positions.

Key ideas

  • The example identifies Fridays whose calendar date falls from the first through the seventh of the month.
  • It uses a daily candle timestamp to avoid printing repeatedly during the same candle.
  • The date rule is presented as a way to detect a possible Nonfarm Payrolls day.
  • The code does not verify the official release calendar, holidays, or broker time-zone conventions.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.