Skip to content
All library documents

Combining Time Filters in Cross-Platform Expert Advisors

Article MQL5 articles

Summary

The article describes reusable time filters for controlling when an expert advisor may perform an action. It covers date ranges, selected days of the week, and timers with configurable durations. Filters can be activated or reversed, and a container can combine multiple filters so that trading features respond to schedules and exceptions. The design is intended to work across MQL4 and MQL5.

Examples show how the filters can support session restrictions, a lunch break, and closing positions near a defined time. The article also presents tester scenarios in which a position may close while a new entry is suppressed outside the allowed window, with entries resuming when the schedule permits and a trading signal occurs. These examples illustrate behavior rather than establish a trading advantage. The discussion focuses on software implementation and does not assess the profitability of time-based restrictions; results may also depend on the EA’s signals, broker time conventions, and the chosen filter settings.

Key ideas

  • Date range filters allow actions between configured start and end times.
  • Day filters use flags to enable or disable behavior on particular weekdays.
  • Timer filters compare elapsed time with a configured duration.
  • Active and reverse settings, plus a filter container, support combining schedules and exceptions.
  • The examples demonstrate entry suppression and position handling in tests, but do not establish profitability.

Tags

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