A scheduled-news filter needs more than a list of event names. It needs a reliable publication time, a defined relationship to the instrument, a policy window and evidence that the calendar cache still covers the period being checked. Otherwise a missing or delayed update can look exactly like a quiet trading day.
This guide designs an application-level filter around external economic-calendar data and MT5 account context. MetaKit's current public API does not provide an economic-calendar endpoint or a managed news-entry gate. The design belongs to your application and does not change orders, stops, account settings or copier configuration.
Separate the schedule from an impact forecast
Start with first-party release schedules where available. The Bureau of Labor Statistics calendar publishes selected release dates and times and labels them as Eastern Time. The Federal Reserve meeting calendar is another official scheduling source for its listed events. Neither is a complete universal forex calendar.
A third-party API can consolidate sources and add identifiers or importance labels, but those labels are provider classifications. “High impact” does not prove that a particular market will move, by how much, or in which direction. If you require a specific event universe, document it rather than relying on an unexplained color in a calendar widget.
Store the original source URL, provider event id, scheduled time, source timezone, status and retrieval timestamp. Retain changes to the schedule. A rescheduled publication should update the active filter while preserving the record of what the application knew earlier.
This is distinct from enforcing a prop-firm contract. A firm's chosen calendar and rule definitions may differ from your application's research filter; the existing prop-firm news-rule guide addresses that separate requirement.
Normalize time before evaluating a window
Convert provider times to explicit UTC instants with a timezone-aware implementation. “Eastern Time” is not a fixed UTC offset throughout the year. Keep the original civil time and timezone so the conversion remains auditable, especially when an event is scheduled far in advance.
Use a timestamp representation with an explicit offset, consistent with the approach described by RFC 3339. A string such as 2026-10-20T12:00:00 has no offset and should not be silently interpreted according to the server's local timezone. The examples below use explicit Z timestamps and are entirely synthetic, not actual release appointments.
Native MT5 calendar data has its own convention: MetaQuotes documents that its calendar functions use trade-server time. A native calendar value is therefore not automatically an already-normalized UTC event. Do not join it to an external API's UTC timestamps by formatting both as strings and assuming they match.
Keep your scheduling clock separate from broker chart-time interpretation. The time used to decide an application gate must be an actual instant, not an inferred chart label. Synchronize the application clock and flag substantial clock disagreement rather than shifting every event by a guessed broker offset.
Match events to the intended exposure
For a simple forex-pair policy, start with the base and quote/profit currencies after verifying the instrument specification. A USD event may be included for a configured EURUSD policy, while an unrelated currency event may be excluded. This is a policy association, not a claim that other currencies can never be affected.
MetaKit's /v1/accounts/{id}/symbols/{symbol} exposes fields including currency_base and currency_profit. Do not infer all instrument rules from the first six letters of a broker symbol. Gold, indices and other contracts need explicit event mappings. The currency-exposure guide explains the distinction between symbol labels and economic exposure.
Decide whether the filter concerns a candidate new entry, an existing position, or a portfolio view. A filter for new entries should not automatically disable protective exits. Evaluate those actions under separate policies, and do not treat the function below as an execution instruction.
A gate with an explicit unknown state
Assume a trusted adapter has selected the relevant event categories and normalized each event to {id, currency, status, time}. Cache metadata must include the covered interval, not only the download time. A freshly retrieved empty response for the wrong month is still unusable.
The following pure JavaScript accepts numeric UTC milliseconds for cache metadata and explicit-offset strings for events. Its default five-minute windows and one-hour cache age are illustrative application settings, not broker rules or recommended trading parameters.
function newsWindowState(now, feed, {
currencies = ["USD"], beforeMs = 300000,
afterMs = 300000, maxAgeMs = 3600000,
} = {}) {
if (![now, beforeMs, afterMs, maxAgeMs].every(Number.isFinite) ||
Math.min(beforeMs, afterMs, maxAgeMs) < 0 ||
!Array.isArray(currencies) || !currencies.length ||
!currencies.every(c => typeof c === "string" && /^[A-Z]{3}$/.test(c))) {
throw new Error("Invalid filter configuration");
}
const unknown = { state: "unknown" };
if (!feed || !Array.isArray(feed.events) ||
![feed.fetchedAt, feed.coverageFrom, feed.coverageTo].every(Number.isFinite) ||
feed.fetchedAt > now || now - feed.fetchedAt > maxAgeMs ||
feed.coverageFrom > now - afterMs || feed.coverageTo < now + beforeMs) {
return unknown;
}
const blockedBy = [];
for (const event of feed.events) {
if (!event || typeof event.currency !== "string" ||
!/^[A-Z]{3}$/.test(event.currency)) return unknown;
if (!currencies.includes(event.currency) || event.status === "cancelled") continue;
if (event.status !== "scheduled" || typeof event.id !== "string" ||
!event.id || typeof event.time !== "string" ||
!/(Z|[+-]\d{2}:\d{2})$/.test(event.time)) return unknown;
const time = Date.parse(event.time);
if (!Number.isFinite(time)) return unknown;
if (now >= time - beforeMs && now <= time + afterMs) blockedBy.push(event.id);
}
return { state: blockedBy.length ? "inside_window" : "outside_window", blockedBy };
}For a synthetic event at 12:00 UTC, a five-minute-before and five-minute-after policy includes 11:55 through 12:05, including both boundaries. Overlapping events can return several identifiers. A canceled event is ignored under this explicitly chosen policy; a relevant tentative or unparseable event returns unknown.
The code was checked on boundaries, overlaps, canceled events, irrelevant currencies, stale caches and insufficient coverage. It validates the gate calculation, not any provider adapter or live calendar. All-day events, speeches without a precise time and provider-specific status values need a normalization policy before this function is appropriate.
Make missing evidence visible
An outside_window result means only that no selected normalized event intersects the configured window within the declared coverage. It does not mean trading is safe, that all possible news is scheduled, or that a calendar includes every announcement. Unexpected events and source failures remain possible.
Log the gate result, policy version, source revision and clock used with each application decision. Refresh the calendar when event times change and re-evaluate near the relevant decision. Do not display a stale cached calendar under a freshly updated UI timestamp.
If you acquire a commercial calendar API, verify that its terms cover your intended storage and display before choosing an integration. No API provider, subscription price or market-impact feed is assumed here. Confirm MetaKit's available account and symbol fields in the API documentation, and keep calendar ingestion as a separately verified dependency.
Sources and verification
Verified 20 October 2026 against official scheduling sources and MetaKit's public routes and symbol mapping. No live account actions were performed.
- BLS release schedule, source-time labeling and scheduling context.
- Federal Reserve meeting calendar, first-party event schedule.
- MetaQuotes economic calendar, native time convention.
- RFC 3339, explicit-offset timestamp representation.