Systems and executionIntermediate24 min read

What your Forex robot does when scheduled news arrives

Separate release time, feed receipt, decisions and broker acknowledgements, then test spreads, pending orders and event exclusions with reproducible examples.

A wave approaches an empty dark pier with a small fuchsia safety marker.
Conceptual image of the interval before an expected disturbance.

At the scheduled release time, a robot can be doing something perfectly consistent with its instructions and quite different from what its owner imagines. It may have stopped generating signals while an earlier order remains active. It may have received a fresh price but an old calendar. It may know that a cancellation was sent without knowing whether the broker accepted it. The interesting question is therefore what the system actually knows and controls at each instant.

We will follow an entirely hypothetical event replay for EUR/USD. Every price, delay, quantity and operational threshold in the examples is invented for explanation. The exercise does not predict the content of a release, assign a direction to a currency, or describe a product’s trading results. Its purpose is to make behaviour inspectable before anyone mistakes a chart annotation for an execution record.

The running example uses a scheduled time called T. Several alternative policies will act on the same invented observations. Keeping those observations fixed lets us locate disagreements in clocks, rules or order state rather than explaining every difference through the news itself.

1. Five clocks hidden inside one timestamp

Suppose T is 13:30:00 UTC on a hypothetical winter trading day. The planned release is scheduled for T. If material is distributed subject to an embargo, its authorised release boundary is another field; for this example that boundary is also T. This is a conditional distinction, not a claim that every agency uses an embargo or that our robot has access to embargoed material. A public schedule alone cannot establish when every recipient obtained a document.

To illustrate a branch that submits an order, suppose the robot’s feed delivers a release message at T plus 180 milliseconds. Parsing and evaluation finish at T plus 205 milliseconds, the order request leaves at T plus 215 milliseconds, and an acknowledgement reaches the client at T plus 310 milliseconds. Receipt is the information boundary for this particular robot. A simulated decision at T plus 100 milliseconds cannot use that message, even if another participant received it earlier.

The observable intervals are useful but limited. Receipt to decision is 25 milliseconds. Decision to submission is 10 milliseconds. Submission to received acknowledgement is 95 milliseconds. That last interval combines several possible stages; it is not a measurement of broker processing alone. Nor does acknowledgement necessarily mean a complete fill. Its meaning depends on the message type and the accompanying order state.

Store the scheduled time, any verified public release boundary, source timestamp, local receipt time and decision time separately. Record the submission and acknowledgement as order events. A source timestamp can help explain transport delay, but it should not silently replace local receipt time when reconstructing what the robot knew. If clocks are not synchronised, subtracting timestamps from different machines may give misleading precision.

A release time is not a receipt time, and an acknowledgement is not automatically a fill. This distinction changes the replay itself: the simulation advances through observable messages, not directly from a calendar label to a hypothetical trade. It also gives an incident reviewer a precise question to investigate when someone says that the system reacted late.

Separate rows show scheduled time and release boundary at T, feed receipt at 180 milliseconds, decision at 205, submission at 215 and acknowledgement at 310.
The horizontal position measures elapsed time. The release boundary and the robot's information boundary are different events.

2. Treat the calendar as a versioned input

An event record needs more than a headline and a coloured importance label. Give it an identifier, issuing institution, release family, reference period, scheduled local time, named time zone and the time at which that schedule was retrieved. Keep the calendar version used by the robot. Without that version, a later reviewer cannot tell whether a missed exclusion arose from a stale download, an identifier mismatch or a genuine change to the schedule.

The BLS release calendar explicitly states that its times are Eastern Time. That is a property of the calendar, not a promise that a copied calendar in another application uses the same display convention. BLS release schedule. Our proposed record design is an engineering choice: preserve the original wording and time representation alongside the normalised timestamp, so that a conversion error remains visible.

Consider an invented schedule update. Version A places an event at T; version B, received an hour before T, moves it 15 minutes later. A robot following version B should apply its declared rescheduling rule. An offline replay must not pretend that version B was already available the previous evening. Conversely, replaying version A forever would ignore information that the live robot actually received. The relevant question is which version was available when each decision occurred.

Calendar freshness is a policy input. A maximum permitted age can be specified for the schedule, but it should match the workflow. A stable weekly download and a last-minute change notification serve different purposes. If an update cannot be retrieved, explicitly decide whether new entries remain disabled around the last known time, whether a wider uncertainty interval applies, or whether human review is needed. Do not convert a failed request into an empty calendar.

Separate related communications too. The Federal Reserve calendar links statements, press conferences and minutes; it says minutes of regularly scheduled meetings are released three weeks after the policy decision. FOMC calendar and communications. A shared meeting identifier is helpful, but each communication has its own release event. One scheduled label should not erase later information arrivals.

3. A revised value belongs to a later information set

There are two distinct version problems. The calendar can change when an event is expected. The statistical release can change what is reported about an earlier period. Keeping only the latest download destroys the difference between those problems and makes a historical system look better informed than it was.

The BLS describes preliminary CES estimates, subsequent monthly revisions and annual benchmark revisions. BLS CES revision explanation. That statement does not imply that a revision is an error or a trading signal. It tells us that the latest value and the originally released value can be different objects. A reproducible experiment must specify which object it supplies to a decision.

Imagine a wholly invented statistical field first reported as 150,000 and later revised to 180,000. A robot that archives the first release should retain 150,000 in that original message. The later message can contain both a new current-period estimate and a revision to the previous period. Replacing the earlier field with 180,000 would change the history of the robot’s knowledge. It could alter a classification even if the price series remained identical.

Store reference period and availability separately. The period being measured might be a month; the time when a robot can use the estimate is an instant. A database ordered only by reference month invites accidental joins to future revisions. A defensible join asks for the most recent eligible version whose availability precedes the decision, then records the selected version identifier.

ALFRED’s documentation explains how real-time periods retrieve information known during past dates, whereas the default commonly represents information available today. FRED and ALFRED real-time periods. Such dates help with vintage selection, but do not establish millisecond receipt at a particular feed. That finer claim requires an appropriate receipt record. A historical vintage can prevent revision leakage without proving intraday availability. When only daily availability is known, report that limitation and avoid pretending that the value was usable at the first instant of the release minute.

4. Convert named time zones, not remembered offsets

Writing “New York is five hours behind UTC” into a rule works only during part of the year. For a hypothetical event at 08:30 in New York, a winter offset of UTC minus five gives 13:30 UTC; a summer offset of UTC minus four gives 12:30 UTC. Applying the winter offset in summer shifts a five-minute protection interval by an entire hour. The code may execute perfectly while guarding the wrong minute.

Use a named time zone with rules for the event date. Python’s official documentation describes zoneinfo as support for IANA time-zone data, including transitions. Python zoneinfo documentation. The practical design choice here is to record both the source zone and the resulting UTC instant. The library solves a conversion problem; it does not verify that the calendar’s source time was correctly interpreted.

Madrid and New York do not necessarily change clocks on the same weekend. Therefore a dashboard configured in Madrid should derive its display time from the event instant, rather than add a memorised transatlantic difference. For debugging, show the original local time and zone near the UTC value. A person can then distinguish a display problem from a robot using the wrong event time.

Test boundaries as data cases. Include a winter date, a summer date and dates near clock changes. If a source gives a local time that is repeated during an autumn transition, require an offset or an explicit ambiguity rule. If it gives a local time skipped during a spring transition, reject or resolve it according to the documented source contract. Quietly choosing whichever interpretation a library happens to return is not a specification.

The same discipline applies to machine clocks. A monotonic clock is useful for measuring elapsed processing time, while a civil timestamp is needed to align calendar events. Preserve enough information to connect them. After a clock correction, an apparently negative transport delay should trigger a timing-quality flag. It should not be treated as evidence that the robot saw the release before it existed.

5. A wider quote is not the same as a rising price

Before the invented event, EUR/USD is quoted at bid 1.1000 and ask 1.1002. One pip is 0.0001 USD per EUR in this example, so the spread is 2 pips. The midpoint is 1.1001. During the disturbance, the quote becomes 1.0994/1.1006: the spread is now 12 pips and the midpoint is 1.1000. The spread multiplied by six while the midpoint fell by only 1 pip.

A chart displaying asks could suggest an upward move because the ask increased by 4 pips. A chart displaying bids would show a 6-pip decline. Neither alone describes the whole quote. Quote width and quote location are separate measurements. A robot that treats an ask-only jump as a breakout can respond to a widening spread even when the midpoint barely moves. Whether that matters depends on what its signal is intended to measure.

Now buy 10,000 EUR at the disturbed ask of 1.1006 and later sell all 10,000 EUR at an available bid of 1.0998. Under the explicit assumption of no other fees, financing or currency conversion, the result is 10,000 multiplied by the price difference of minus 0.0008: a loss of 8 USD. The calculation uses the actual hypothetical entry and exit sides. It does not subtract another spread charge afterwards.

An immediate liquidation at the disturbed bid of 1.0994 would instead lose 12 USD. The later bid of 1.0998 improves that exit by 4 pips, leaving the 8 USD loss. This does not contradict a chart showing recovery: recovery from one reference point need not overcome the cost of crossing the quote. For this quantity, each pip is 1 USD, which makes the reconciliation transparent.

Use executable sides for the worked trade and a declared series for the signal. A midpoint may be informative for analysis, but buying at the midpoint is a different execution assumption. Keeping those roles distinct prevents a visually plausible event chart from supplying an unavailable entry price.

Two bid-to-ask intervals share a price axis: 1.1000 to 1.1002 before the event and 1.0994 to 1.1006 during it, with midpoints 1.1001 and 1.1000.
The spread grows from 2 to 12 pips while the midpoint falls by 1 pip. Entry and exit at 1.1006 and 1.0998 produce minus 8 USD for 10,000 EUR.

6. A candle cannot tell you which quote you could use

A historical candle’s high establishes a property of the series used to construct that candle. It does not, by itself, establish an ask available to a buyer, a bid available to a seller, the order of all observations, or the quantity available at an attractive level. Before testing an event rule, identify whether the bars contain bids, asks, midpoints or transactions and how their timestamps define the interval.

Suppose the release minute’s high is 1.1012. That number cannot prove that a take-profit sell for 10,000 EUR could have filled at 1.1012. The high may belong to asks, may precede entry, or may describe an observation that was no longer available when the request arrived. Likewise, a low below a stop threshold is insufficient to reconstruct the exact fill. A touched level and an executable order are different evidence.

Depth creates another distinction. In a separate hypothetical variant, a purchase of 20,000 EUR receives 5,000 at 1.1007 and 15,000 at 1.1011. The total quote-currency consideration is 22,020 USD, giving a volume-weighted average price of 1.1010. The simple average of the two prices is 1.1009 and is wrong for these unequal quantities. Both partial fills belong in the order record; the average is a summary derived from them.

OANDA Europe’s execution policy describes execution at prevailing prices when orders are processed after server receipt, and discusses volatile-market execution risks. OANDA Europe execution policy. That is entity-specific documentation, not a promise about another broker or a numerical estimate of slippage. Our partial-fill example illustrates the accounting needed if such fills occur; it does not assert that this exact sequence would be offered by that entity.

If only candles are available, use a deliberately limited study. It may examine signal eligibility or the frequency of event-window overlap. An exact event-execution claim requires richer evidence or explicitly conservative assumptions. Reporting the missing bid/ask sequence is more informative than hiding it behind an elaborate fill simulator whose inputs cannot support its precision.

7. Separate signal eligibility from execution eligibility

A price filter and a signal filter answer different questions. A spread ceiling asks whether the current quote meets an execution condition. A rule that ignores a news-related observation asks whether that observation should influence the signal. Blocking an order does not automatically remove its underlying price from an indicator, and removing a price does not cancel an existing order.

In an invented policy, allow new entries only when spread is at most 3 pips, the latest quote is no older than 250 milliseconds, and no event exclusion applies. The disturbed 12-pip quote fails the spread condition even if its midpoint satisfies the signal. A fresh 2-pip quote inside the excluded interval still fails the calendar condition. These are distinct rejection reasons and should remain distinct in the decision log.

Record the complete eligibility state, not merely the first failed test. Otherwise the result depends on the order in which software happens to evaluate conditions. A stale quote with a wide spread should carry both flags. That helps distinguish a data outage from a market with live but expensive quotes, and it lets a reviewer count overlapping reasons without mistaking them for independent blocked decisions.

Decide what happens to signal state during the pause. One design keeps updating indicators but prohibits new orders. Another freezes selected state and restarts only after fresh observations. A third invalidates the current signal entirely. These produce different behaviour after the window ends. If a moving indicator contains the event spike, reopening the order gate may immediately release a signal shaped by that spike.

An explicit expiry rule resolves another ambiguity. A signal created before the pause might be valid for only 30 seconds in our hypothetical design. A five-minute exclusion should not queue that stale intention for automatic execution afterwards. The restart decision should be computed from the declared state policy and current eligible inputs. This is a causal rule, not an assertion that any particular restart design earns more.

8. Pending orders survive an instruction to stop signalling

Imagine that an entry stop was accepted before the exclusion began. The robot disables new signals and displays a reassuring paused status, but the entry stop remains with the broker. A later quote may trigger it. The pause has changed local behaviour without removing the remote instruction. This is why a news policy needs an inventory of pending orders, open positions and requests whose outcome is still unknown.

Consider a separate cancellation race around T. The client sends a cancellation at T minus 40 milliseconds. The order fills at the broker at T minus 10 milliseconds. At T plus 80 milliseconds, the client receives a cancellation rejection because the order has already filled. These are hypothetical times, and the broker-side timestamp is assumed available in the execution report. The correct reconstruction contains both the attempted cancellation and the fill.

Cancellation requested is not cancellation confirmed. Until the order’s terminal state is established, keep it in the exposure model. If the system treats the send operation as success, it can report no position just as a real position appears. If it retries by placing an opposite order without checking state, it may close a position unintentionally or create a new one after the original cancellation eventually succeeds.

The design therefore needs stable order identifiers, a record of each request, and reconciliation of broker responses with local state. A timeout means unknown outcome, not automatic failure. A restart must recover unresolved requests before issuing replacements. These are practical consequences of separate machines exchanging messages; they do not depend on anticipating the news value.

Protective orders require their own treatment. Cancelling an entry instruction and cancelling a protective exit are different actions. A blanket cancel-all policy can remove protection from a position that remains open. Specify the role of each order and how partial fills change it. The event policy should be tested against these roles, including the case where only part of an entry fills before cancellation becomes effective.

9. Declare the excluded interval before inspecting outcomes

Take an illustrative rule that blocks new-entry decisions from 120 seconds before T until 180 seconds after T. Write the interval as start-inclusive and end-exclusive: a decision exactly at T minus 120 seconds is blocked, while one exactly at T plus 180 seconds is eligible to face the remaining checks. Its duration is 300 seconds, or five minutes. The endpoint convention matters because software needs an unambiguous answer.

Our test cases are a decision at minus 121 seconds, one at minus 120 seconds, one at plus 179.999 seconds and one at plus 180 seconds. Their calendar classifications are outside, inside, inside and outside. “Outside” does not mean an order must be submitted: spread, quote freshness, signal validity and position rules still apply. It means only that this particular calendar gate does not block the decision.

Predeclared exclusion and retrospective deletion answer different questions. If the rule is fixed before evaluating the sample, the experiment can measure a system with that rule. If the interval is enlarged after seeing losing trades and narrowed around winning ones, the resulting history describes a selected subset. Both can be explored, but the second cannot be presented as an unchanged policy that existed beforehand.

Classify decisions using information available at decision time. An entry submitted just before the exclusion may fill inside it. Under a decision-time rule, that does not retroactively change the decision’s membership. It does reveal a separate issue about orders that remain outstanding across the boundary. A rule based on submissions, fills or exposure duration would be another policy and needs its own definition.

Overlapping events should combine predictably. If their intervals overlap, take the union for a single no-entry gate rather than count the shared time twice. Retain the list of contributing event identifiers for explanation. The schedule version, membership convention and gate scope together turn a vague instruction to “avoid news” into a reproducible decision rule.

A five-minute exclusion runs from minus 120 seconds inclusive to plus 180 seconds exclusive. Decisions at minus 121 and plus 180 are outside; minus 120 and plus 179.999 are inside.
The calendar gate classifies decision time. An order fill inside the interval requires separate order-state reasoning.

10. An open position needs a policy of its own

Stopping new entries leaves an unanswered question about existing exposure. Suppose the robot already holds 10,000 EUR when the exclusion begins. It can retain the position with its existing exit rules, attempt a pre-event reduction, or apply another explicitly defined policy. None follows automatically from the phrase “news filter”. The implementation should name which behaviour applies and what evidence confirms its completion.

A planned exit before T is still an order subject to acknowledgement, fills and costs. If the system intends to be flat 120 seconds before T, submitting a close at that exact boundary does not prove that the target was achieved. Distinguish the target time from the submission deadline and from the observed flat state. If the close remains unresolved, show unresolved exposure rather than changing the display to flat.

Do not turn an entry gate into an exit prohibition by accident. A spread rule intended to avoid expensive new risk could prevent a protective reduction if applied indiscriminately. Conversely, allowing every action labelled exit without checking quantity can increase exposure when local position state is stale. The intended property is about the resulting position, and verifying that property requires consistent order and fill records.

Take the earlier cancellation race. Once the fill is confirmed, the system must manage the position according to its declared unexpected-entry branch. That might involve a controlled close request or a hold with defined protection. We do not assign a financial advantage to either here. The useful test is whether the branch is deterministic, whether it uses the actual filled quantity, and whether duplicate messages can trigger duplicate closes.

An event report should therefore include exposure at the start of the window, pending entry quantity, pending reduction quantity and exposure at its end. These observations reveal whether the policy actually reduced the intended activity. Counting only suppressed signals can make an apparently quiet robot conceal a busy sequence of previously submitted orders.

11. Replay messages in the order the robot could use them

A reproducible replay starts with preserved inputs and an initial state. Keep the calendar snapshot, received release messages, quotes with side and size where available, order requests, responses and configuration. Give each record a stable identifier. A decision should point to the specific inputs it consumed, so another run can establish whether it reconstructed the same information set.

For the main timeline, the release message becomes available at plus 180 milliseconds. A quote received at plus 190 milliseconds can be used by the plus 205-millisecond decision if the declared processing model permits it. A quote received at plus 230 milliseconds cannot. Sorting all records by their source timestamps instead of their local availability could mistakenly give the decision the later quote. This is an information-ordering error even if every recorded price is genuine.

A replay needs deterministic tie handling. Two messages may share the same recorded millisecond because timestamp resolution is limited. Preserve an ingestion sequence or define a consistent rule for ties. If the true order is unknowable and different orders change the decision, run those alternatives and report the ambiguity. Do not select the ordering that yields the most appealing trade.

An alternative decision record that blocks entry uses calendar version R, which retains the scheduled time T, and quote identifier Q17. It records: calendar gate active, spread 12 pips, quote age 15 milliseconds and action no new entry. Replaying that record should reproduce the action and reasons. Changing only the calendar gate in a labelled counterfactual should leave the other inputs unchanged; the 12-pip spread still blocks entry under the 3-pip ceiling. This tests the logic without inventing an execution.

Use two layers of evidence. Deterministic replay can establish that recorded inputs yield recorded decisions under a given implementation. Execution reconstruction additionally needs order and fill evidence. The first cannot prove the second. Keeping that boundary visible makes replay useful even when the broker does not provide every detail required for an exact reconstruction of liquidity.

A replay matrix assigns calendar version R, quote Q17, release receipt and decision to availability times, excluding a later quote at 230 milliseconds from the decision at 205 milliseconds.
A decision log records consumed inputs and rejection reasons. Later messages remain later even when a source timestamp appears earlier.

12. Missing messages should produce an explicit degraded state

Now remove the release message from the recording while leaving the calendar and quote stream intact. A system that uses only scheduled exclusions may still classify the window correctly. A system that requires the released value cannot complete that part of its decision. Both behaviours can be valid if specified. Treating missing content as a numerical zero would silently create a third, unintended strategy.

A delayed calendar update presents another case. If the robot cannot establish which schedule version is current, it needs a defined degraded mode. That mode may permit management of existing positions while preventing new entries. It should have an observable reason and a recovery condition. “Paused” without an explanation cannot distinguish a planned exclusion from a disconnected feed or an unresolved broker request.

Recovery requires new evidence. The passage of the nominal window end does not prove that a data stream has recovered. Under our illustrative policy, the quote must still satisfy the 250-millisecond age limit and the 3-pip spread ceiling. If the system requires a fresh calendar confirmation after an outage, that condition must also be met. Avoid reopening solely because a timer expired.

Repeated delivery is the opposite problem. A feed can resend a message after reconnecting, and an order update can arrive more than once. Stable identifiers let the system recognise duplicates without discarding legitimate revisions. A revision should have a relationship to the earlier release and its own availability time; a duplicate is another delivery of the same logical content. Confusing the two can either double-apply information or suppress a real update.

Unknown is an operational state that deserves its own record. A useful recovery exercise starts with an unresolved cancellation, restores connectivity, reconciles the order and only then decides whether to resume entries. This tests the path that a smooth historical price chart omits: the period when the system cannot yet establish its actual exposure.

13. Measure decisions, overlaps and unresolved exposure

Monitoring should describe what the policy did, not merely whether the day ended with a positive result. Track eligible decisions, suppressed decisions, spread at evaluation, quote age, processing intervals, unresolved requests and exposure during the exclusion. Separate market conditions from data quality and order-state uncertainty. A single “news risk” score hides the distinction between an expensive quote and a missing one.

Consider an invented diagnostic sample of 100 decisions. The calendar gate blocks 24, the spread gate 11 and the freshness gate 5. Suppose 8 belong to both calendar and spread, 2 to calendar and freshness, 1 to spread and freshness, and 1 to all three. These pairwise intersection counts include the triple overlap. Inclusion-exclusion gives 30 distinct blocked decisions, leaving 70 that pass these three gates.

Do not add rejection counters as if they were disjoint. Adding 24, 11 and 5 gives 40 reason occurrences, not 40 separate decisions. The difference is operationally useful: many wide quotes may already be inside the planned exclusion. Removing the calendar gate would not make every calendar-blocked decision tradable, because some still fail other conditions. The log makes those counterfactual counts possible without altering the original sample.

Latency summaries need similar care. Averages can hide a small group of very slow acknowledgements. Inspect the distribution and retain the largest cases with their order state, but do not assign a percentile meaning to a tiny collection of examples. Our 95-millisecond submission-to-acknowledgement interval is one invented observation, not a service-level estimate. A quantitative claim about reliability requires a defined population and sufficient recorded events.

Finally, measure policy exceptions directly. Count entries submitted while the calendar gate was active, fills arising from earlier requests, cancellation outcomes and intervals with unknown exposure. Each category points to a different investigation. A fill inside the window can be consistent with the decision rule yet still reveal that the policy’s practical protection is narrower than its owner expected.

14. Finish with a testable event contract

A useful event contract states which releases matter, how calendar versions become effective, which clock determines membership, and what happens to signals, pending orders and open positions. It also states the quote conditions for resuming, the meaning of unknown state and the evidence retained for replay. The contract should be understandable without reading the implementation, because it is the standard against which the implementation is checked.

Start a review with the five-minute exclusion example and deliberately vary one feature at a time. Move a decision onto either boundary. Widen only the spread. Delay only the release message. Replace the calendar version before, then after, a decision. Deliver a fill before a cancellation rejection. These changes probe causal dependencies. They should produce explainable differences, not a collection of exceptions added after looking at financial outcomes.

The finished result is an auditable behaviour specification. It does not establish that avoiding a particular release improves returns. A strategy may lose opportunities during a pause, retain exposure through an event, or encounter widening quotes outside every scheduled window. Unscheduled information also exists. The value of the specification is that those limitations are visible and can be studied without rewriting what the robot was supposed to know.

For the numerical example, the conclusions remain modest and exact: a 2-pip quote can widen to 12 pips with only a 1-pip midpoint decline; buying 10,000 EUR at 1.1006 and selling at 1.0998 loses 8 USD before other costs; and a cancellation attempt can coexist with a completed fill. Those facts are enough to show why event handling is a problem of information, prices and state rather than a coloured calendar icon.

The primary references used here are the BLS calendar, CES revision documentation, Federal Reserve communications calendar, ALFRED real-time documentation, Python time-zone documentation and OANDA Europe execution policy. They support the limited institutional and technical claims identified above; the replay design and scenarios are original teaching examples.

Use the demo review page to practise asking which event inputs, order states and execution assumptions a robot description actually makes visible.

Back to the Blog