Time in Force Explained

By Stax Team

Time in force tells the broker how long an order should remain active. Day orders expire at the end of the session; good-til-cancelled orders persist across sessions until filled or cancelled; immediate-or-cancel fills whatever it can right now and cancels the rest; fill-or-kill requires the entire order to fill immediately or none of it. The setting decides what happens to an unfilled order, which is a question automation has to answer deliberately rather than by default.

Time in force is the order parameter most often left at whatever the platform defaults to, and the default is not always the right answer.

The main types

Day. The order stays working until the end of the trading session and is cancelled if unfilled. This is the most common default.

Good-til-cancelled. The order persists across sessions until it fills or you cancel it. Brokers typically impose a maximum lifetime rather than leaving it indefinitely, and the limit varies.

Immediate-or-cancel. Fill as much as possible right now, cancel whatever remains. Partial fills are accepted.

Fill-or-kill. Fill the entire order immediately or cancel it entirely. No partial fills.

Availability varies by broker and by instrument, and some venues support additional variants. Confirm what your broker actually accepts rather than assuming a standard set.

What the session boundary means

Day orders expire when the session ends, and what counts as the session end is not always what you would assume.

For equities and equity options, it aligns with the regular market close. For futures, the trading day rolls at the daily maintenance break rather than at midnight, so a working day order expires with that session — a Sunday evening order belongs to Monday's trading day and expires at Monday afternoon's break.

The practical consequence for anything automated is that orders you believe are working may not be. A system that submits a day order and assumes it persists overnight is wrong about its own state, and on a futures account the expiry happens at an hour nobody is watching.

Immediate-or-cancel and fill-or-kill

These two exist for a specific problem: wanting to interact with the current book without leaving a resting order behind.

Immediate-or-cancel is the more useful of the pair in most situations. It takes whatever liquidity is available at your price and cancels the rest, so you never leave a partial order working at a stale price. For an automated system, that means the order's outcome is known immediately rather than pending.

Fill-or-kill is stricter and correspondingly harder to fill. It is appropriate when a partial position is worse than no position — a spread leg that would leave you unhedged, for instance — and it will frequently return nothing on anything but the most liquid contracts.

Both are worth considering in options specifically, where a partial fill on a multi-leg position can leave exposure you did not intend to hold.

Good-til-cancelled and its risks

Persistent orders solve a real problem and introduce one.

The problem they solve is not having to resubmit. A price target that may take days to reach does not need daily attention.

The risk is that they persist through conditions you did not anticipate. A resting order left over a weekend, through an earnings release, or across a gap can fill at a moment when your original reasoning no longer applies. It does not know your thesis changed.

Broker maximum lifetimes also mean a good-til-cancelled order can expire silently after a period, so a system relying on one indefinitely will eventually be surprised.

The setting that governs unfilled orders

The framing that makes time in force worth thinking about rather than accepting.

Every order has two possible outcomes: it fills, or it does not. Time in force is the only parameter that says what happens in the second case, and the choices are meaningfully different — cancel at session end, keep working indefinitely, cancel immediately, or cancel unless complete.

For a discretionary trader watching the screen, a wrong choice is a minor inconvenience. For automation, an order in an unexpected state is a divergence between what the software believes and what exists at the broker, which is the root of a broad class of failures.

What this means for automation

Choose deliberately per order type. An entry and an exit have different requirements. An entry that does not fill is a missed opportunity; an exit that does not fill is an unmanaged position, and the time in force should reflect which one you are submitting.

Track expiry as a state transition. An order that expired at the session boundary is not the same as an order still working, and a system that does not model the transition will believe it has protection it does not have.

Model the correct session. Futures day orders expire at the daily maintenance break, not at midnight, and holiday schedules differ from equity calendars.

Reconcile after every boundary. The broker is authoritative about which orders survived. That reconciliation belongs off the order path, on worker thread pools, so it cannot delay a live submission.

Prefer immediate-or-cancel where the outcome must be known now. It converts an uncertain pending state into a definite one, which simplifies everything downstream.

The honest limits

Time in force governs order lifetime, not execution quality. It does not improve your fill or protect against a gap.

Available types and their exact behaviour vary by broker and venue, so a system written against one broker's semantics may behave differently against another.

And no time-in-force setting bounds risk. Position sizing does — capital divided by twenty as the ceiling on any single position, under the divide-by-20 rule — enforced on infrastructure you control rather than left to whatever a platform defaults to.

Frequently asked questions

What does time in force mean? How long an order remains active before being cancelled if it does not fill.

What is the difference between day and GTC? A day order expires at the end of the session; a good-til-cancelled order persists across sessions until filled or cancelled, subject to a broker maximum.

What is immediate-or-cancel? Fill whatever is available right now and cancel the remainder, accepting partial fills.

What is fill-or-kill? Fill the entire order immediately or cancel it entirely, with no partial fills.

When do futures day orders expire? At the end of the futures trading session, which rolls at the daily maintenance break rather than at midnight.


Disclaimer: This article is educational content about trading mechanics and software. It is not investment advice, financial advice, tax advice, legal advice, or a recommendation to buy or sell any security, nor a recommendation of any strategy, order type, or position size. Any instruments, figures, or examples are used solely to illustrate mechanics. Options and futures trading involve substantial risk of loss and are not suitable for all investors. Please read Characteristics and Risks of Standardized Options before trading options. Automated trading carries additional risks including software defects, connectivity failures, broker API changes, and outages that may prevent orders from being placed, modified, or cancelled. Stop orders do not guarantee an execution price and stop-limit orders may not execute at all. Past performance does not indicate future results, and no configuration, order type, position-sizing rule, or risk setting can guarantee a profit or prevent a loss.

StaxInvesting LLC sells self-hosted trading software. It is not a broker-dealer, investment adviser, or financial institution, and it does not manage accounts, hold member funds, place trades on behalf of members, or access member brokerage accounts. Members run the software in their own cloud environment, connect their own brokerage accounts under their own credentials, and are solely responsible for their configuration, their credential security, and every trade executed in their account. Broker order handling and available order types vary; verify against your broker's current documentation. Consult a qualified financial adviser and tax professional regarding your individual circumstances.