Guides, manuals and platform references.
A canceled order can leave you with a position. If part of an immediate-or-cancel order executes, canceling the remainder does not undo the shares or contracts already bought. That distinction is the reason to understand time in force before treating an order-status label as an account balance.
IOC accepts an immediate partial fill, FOK requires an immediate complete fill, and GTC allows an order to keep working subject to the broker's rules. In automated trading, these choices determine whether a signal leaves no position, a smaller position or an unfilled order that may execute later.
When designing a workflow around AlgoWay's TradingView-to-Interactive-Brokers guide, separate the intended trade from the destination's accepted order and execution reports. This article explains order semantics; it does not establish that every time-in-force option is exposed by every AlgoWay route. Check the selected integration's documented controls rather than adding an assumed field to a webhook message.
A buy limit sets the highest acceptable execution price; a sell limit sets the lowest. It does not promise execution. Investor.gov's order-type explanation distinguishes those price constraints from market and stop orders. Time in force adds instructions about how long an order can work and, for IOC or FOK, what immediate execution is acceptable.
| Instruction | Immediate partial execution? | Unfilled quantity |
|---|---|---|
| IOC: immediate or cancel | Allowed | Canceled immediately |
| FOK: fill or kill | Not allowed | Entire order canceled unless immediately filled in full |
| GTC: good till canceled | Allowed unless other conditions prevent it | Can keep working until filled, canceled or expired under broker rules |
These definitions follow IBKR's order reference. Availability depends on the product, venue and order combination. GTC also does not itself grant permission to trade outside regular hours.
Suppose an account has no position and sends a limit buy for 12 shares at $25.00. Assume exactly five shares are immediately executable at or below that limit, with no other eligible liquidity. Ignore fees and assume the venue supports the selected instruction. This is a constructed example, not an observed order.
The three outcomes require different next actions. If a bot blindly resends the original 12-share instruction after the IOC cancellation and that new order fills completely, the account reaches 17 shares. A retry intended to “finish” the trade has exceeded the original target by five.
If the desired final holding is still 12 shares, the unfilled requirement in this example is seven. Before sending even that amount, reconcile current holdings and any other working orders. With the GTC version, submitting seven more while the old seven remain active creates a second path to excess exposure.
IBKR documents automatic GTC cancellation rules, including expiry at the end of the calendar quarter following the quarter of submission and certain corporate actions. Check the displayed expiry rather than reading “good till canceled” as a promise of indefinite life. Other brokers can use different policies.
There is another distinction: all-or-none is not the same as fill-or-kill. IBKR describes AON orders that can wait for the full quantity; FOK adds the requirement for immediate completion. A quantity condition and a lifetime condition should not be guessed from similar-sounding names.
Session eligibility needs its own check. For example, Alpaca's order documentation treats extended-hours eligibility and permitted order/time-in-force combinations separately. A long lifetime cannot make an otherwise ineligible order executable in every session. Our guide to limit orders that touch but do not fill covers the price, queue and session questions in more detail.
Write the response policy before choosing an abbreviation:
For a paper test, record requested size, filled size, remaining size, final status and resulting position for each scenario your environment can produce. Paper fills are not evidence of live liquidity. The useful check is whether your workflow handles the reported state correctly, including a partial fill followed by cancellation. An order can be finished while the trade it created is very much alive.