Agentic Trading Index

What a strategy description leaves out before live orders

Trading workstation displaying an ETF chart and order controls for translating a strategy description into executable rules
Photo by AlphaTradeZone on Pexels

The sentence is not the specification

A 0.20% execution shortfall costs $200 on a $100,000 position. That is a plausible cost on a volatile or poorly timed entry, not a guaranteed outcome. A strategy description that says "buy a pullback to VWAP" does not tell an unattended agent when to act, how much to buy or what to do if the order only partly fills.

Take a simple illustrative case: buy a liquid US ETF when its price falls 0.6% below session VWAP, then sell at VWAP or close the position before the session ends. It sounds complete to a human reader. For software, each phrase contains a choice.

Does "price" mean the last trade, bid, ask or bar close? Is VWAP calculated from the opening auction, regular-session trades only, or a vendor's pre-aggregated bars? Does the agent act as soon as the threshold is crossed, or wait for a five-minute bar to close? A last-trade trigger can fire on one print that is not available at the agent's data feed.

"Sell at VWAP" also leaves the order behaviour unstated. A limit order at VWAP may not fill when the market touches it.

A market order may fill beyond it. The plain-language rule describes an intended signal, not a promise about execution.

Turn the example into rules the agent can enforce

Assume an illustrative account equity of $100,000 and an ETF trading near $500. Specify regular-session data, five-minute bars, and a signal evaluated only after a completed bar.

If session VWAP is $500, the trigger is a five-minute close at or below $497. The order cannot use information from the bar that has not closed.

Before sending an order, the agent needs a deterministic policy for quantity, price and exceptions. One workable specification might be:

  1. Validate the inputs. Require a current quote, a fresh bar timestamp and a valid session calendar. Reject the signal if data is stale by more than a configured limit, such as two seconds.
  2. Check exposure and risk. Set a maximum gross position of 50% of equity and a $250 planned loss limit, including an allowance for typical execution costs. Recalculate quantity from the entry-to-stop distance. With entry near $497 and a 0.5% stop, 100 shares would risk about $249 before costs, so the actual quantity must be lower if costs count towards the limit.
  3. Define the entry order. For example, submit a marketable limit order with a price cap 3 basis points above the current ask. Cancel the unfilled remainder after five seconds rather than letting it become stale.
  4. Handle fills as state changes. If 60 of 80 shares fill, protect those 60 shares immediately. Do not send a second full-size entry just because the original order timed out before its final status arrived.
  5. Set exit and session rules. Place a protective stop based on the filled average price. Work an exit limit near VWAP, but cancel or replace it under a defined rule. Close any remaining position by 15:45 Eastern Time and prohibit overnight exposure.

These choices change the strategy. A bar-close trigger is slower than an intrabar trigger. A marketable limit reduces the risk of an uncontrolled fill but can miss the trade. A time-based exit may realise a loss even when the original signal remains valid. Record those trade-offs as part of the specification, rather than allowing library defaults to decide them.

For each rule, log the input value, decision, order identifier and resulting broker state. That gives a reviewer enough information to distinguish "signal did not occur" from "signal occurred but the order was rejected".

Put typical execution costs into the case

The illustrative account may see a signal near $497, but the fill depends on spread, order size, liquidity and message timing. The table gives typical ranges for liquid US ETFs and broker API workflows. They are working assumptions for design and testing, not fixed costs or audited results; conditions and venues vary.

ItemTypical rangeWhat the agent must account for
Quoted spread in calm conditions1-5 basis pointsA buy at the ask and a sell at the bid can lose the spread even before other costs.
Slippage beyond the midpoint per side0.5-5 basis points in ordinary conditions; 5-20 basis points in fast marketsUse marketable limits and measure fill price against the decision-time quote.
Broker order acknowledgementAbout 50-500 milliseconds, with occasional delays of secondsSet timeouts, reconcile status after delays and avoid duplicate submissions.
Market-data delay or stalenessSub-second to several seconds, depending on feed and loadCheck event timestamps and reject signals based on stale data.

At $497, 80 shares represent about $39,760 of exposure. A round-trip cost of 4-12 basis points would be roughly $16-$48 before any unusual market impact. That cost can consume a material part of a short pullback trade's expected edge. The range is a planning example, not a forecast for a particular broker or order.

Paper trading can expose logic errors, but a simulated fill often does not reproduce queue position, partial fills or market impact. An agentic paper-trading environment from Agentic Trading Index starts at $9.99 a month. Treat paper results as a check on signal and order-state behaviour, then compare live or venue-specific fill data before relying on cost assumptions.

Test the path after the signal

Most of the hidden decisions appear after the trigger. The broker may accept an order but return an acknowledgement late. A timeout can occur after the order reached the venue. A cancel request can race with a fill. If the agent treats each of these as a simple success or failure, it can exceed its intended position.

Model the order lifecycle explicitly: prepared, submitted, acknowledged, partially filled, filled, cancel pending, cancelled, rejected and unknown. On an unknown status, query the broker using the original client order identifier before trying again. Reconcile the broker's positions and open orders against the agent's ledger on a schedule, and stop placing new risk if the two disagree.

Test at least these situations before unattended operation:

  • The signal appears while the quote is stale or the market is halted.
  • The entry receives a partial fill, then the remainder is cancelled or rejected.
  • The stop triggers while an exit limit remains open.
  • A cancel request times out, followed by a late fill notification.
  • The process restarts with an open position and incomplete local order state.

Set measurable limits for each path. For example, pause new orders after two consecutive reconciliation mismatches, reject entries when data is more than two seconds old, and stop for the session if realised plus open loss reaches the account's configured risk budget. These are example controls; their values should reflect the instrument, feed and account mandate.

Keep the prose strategy as an explanation for people. Keep the executable specification as versioned rules with explicit units, timestamps, rounding, order types and recovery behaviour.

Then compare signals and fills against the same recorded inputs. A useful review should show where the rule fired, what the agent knew at that moment, what it sent and what the broker reported.

Stop doing these things:

  • Leaving "near", "quickly" or "best price" undefined.
  • Retrying a timed-out order before checking its broker status.
  • Counting a simulated fill as evidence of live execution quality.

Frequently Asked Questions

What should a trading strategy description include for an automated agent?

Define the data source, signal timing, units, position sizing, order types, exits and session boundaries. Include behaviour for stale data, partial fills, rejections, timeouts and restarts.

How should an agent handle a trading API timeout?

Treat the order status as unknown, not failed. Query using the original client order identifier and reconcile open orders and positions before deciding whether another request is safe.

Should an automated strategy use market or limit orders?

The choice depends on the cost of a missed trade versus the cost of uncertain execution. A marketable limit with a defined price cap can bound price exposure, but it may leave the order partly or wholly unfilled.

How do I account for slippage in an automated trading strategy?

Record the quote at the decision time and compare it with each fill, separating spread, fees and price movement where possible. Test typical and stressed ranges for the instrument instead of assuming a fixed cost.

What should paper trading test before live trading?

Use it to check signal timing, order-state handling, sizing and recovery behaviour. Do not assume simulated fills reproduce queue position, market impact or live partial-fill patterns.