Entering positions
Every trade your bots take starts the same way: at a scheduled time, the bot picks its strikes, checks your account, and works the market for a fair fill, or stands down if it can't get one. This page walks through that whole sequence, so you know exactly what happens the moment a bot's clock strikes.
The entry time and window
Each bot has its own entry time, the openTime you set, in New York time (ET), the exchange's clock, wherever you are: there is no time-zone setting. That's when the bot wakes up and starts trying to get in.
You also give it a window to work in. If an attempt does not fill, the bot tries again every few seconds, picking strikes and quotes afresh each time, until it fills, the window closes, or another try cannot change the outcome (the same strikes refused again and again, or a credit spread already offered at its lowest credit: see The entry window). The window ends at whichever cutoff you've set:
| Setting | What it controls |
|---|---|
openTime | The scheduled entry time: when the bot starts trying. |
openTimeWindow | How many seconds after openTime the bot may keep trying. |
latestEntryTime | A hard cutoff: once the clock passes this, no entry today, full stop. |
If you set latestEntryTime, that's the wall. Otherwise the window runs for openTimeWindow seconds past the open.
Either way, the market's close is a wall too: a window never runs past 4:00 p.m. ET, or 1:00 p.m. on a day the market closes early. A bot whose openTime is at or after the close makes no entry that day, and a window that would run past the close ends there.
Why an entry may fire a little after the minute
Three things can put a small gap between your openTime and the actual fill, and all three are deliberate:
- Jitter. You can ask the bot to randomize its first attempt by a few seconds around the open (
entryJitter). The randomization only ever pushes the entry later, never earlier: it's clamped so a bot can never fire before its window opens. Set it to0to fire exactly on the second. - Working the fill. Even once it starts, the bot spends a few seconds nudging the price to get you a fair fill (more on that below). So the confirmation lands shortly after the trigger, not the instant the clock ticks over.
- The opening bell. A bot that fires in the first minute after the 09:30 open waits a few seconds, up to about ten after the bell, for the index's first trade of the day, rather than pick strikes off yesterday's close, which is what the index still shows until that trade prints. If no opening trade arrives in time, or the short's own price implies a delta well away from the one the bot worked out (a sign the index level or volatility it used is stale), the bot skips that attempt, shown as No suitable strikes found, and tries again inside its window like any other unfilled attempt. That second check can refuse a pick at any time of day, not only at the open.
openTime, entryJitter spreads their first attempts across a few seconds so they don't all fire on the exact same tick.Choosing the strikes
When the entry fires, the bot's first job is to pick the strikes.
The short strike
By default, the bot selects the short strike nearest your target delta (targetDelta: for example, 0.20 finds the strike closest to 20 delta). That's the risk leg, the one you're selling, so it's chosen first and everything else is built around it.
You have other ways to steer that choice:
- By distance out of the money. Instead of delta, you can pick the short strike by how far out of the money it sits, either as a fraction of where SPX is trading, or a fixed number of points out (
targetPercentOTM/targetPointsOTM). - By premium. Or pick it by what it pays (
targetCredit): walking out from the money, the bot takes the first strike whose premium has come down to your amount. - A minimum premium floor. You can require that the strike the bot lands on pays at least a minimum amount worth collecting (
minPremium, measured as extrinsic value; on a spread, the short's less the wing's). This is a floor, not a nudge: if the strike your delta target points to doesn't clear it, the bot simply doesn't open the trade. It will not move closer to the money to scrape together more premium. Too little on the table means no trade.
If the short the bot picks is already past the delta stop that will watch it, the bot refuses that pick rather than open a position its own stop would close straight away. That holds for put and call credit spreads, naked puts and calls, the near short of a calendar or diagonal, and each side of an iron condor.
The long strike
The long wing, the leg that caps your risk, is built out from the short at the width you chose (width, in points). By default the wing lands at your width, snapping to the nearest listed strike.
If you'd rather target what the long costs instead of a fixed distance, you can give the bot a price to aim for. It then walks outward from the short to the nearest strike whose long leg meets that cost while still showing a real, two-sided market, and never goes past your width cap. Either way, your width is the ceiling.
If no wing inside your width has a two-sided market, the bot still takes the best wing it can rather than skipping the trade. That is deliberate: the wing's job is to cap your risk at expiry, and it does that whether or not anyone is currently bidding for it. The trade-off is that an unbid wing is hard to sell back if you exit early, so the position is best thought of as one you may have to carry to settlement.
An iron condor's two sides
An iron condor picks its put side and its call side one after the other, each exactly as a credit spread would, with the same settings. Every way of choosing the short (targetDelta, targetPercentOTM, targetPointsOTM, targetCredit) and the premium floor applies to each side on its own, so targetCredit: 1.50 asks for about 1.50 from the put short and about 1.50 from the call short, not 1.50 in total. The wing settings (spread.width, spread.price, spread.percent, spread.delta) likewise place each side's wing. Once both shorts are chosen, condorMinWindow and condorMaxShortDelta check them together, and a side already inside its own delta stop is refused, whichever setting picked it.
A debit spread's two legs
A debit spread picks its legs the other way round. The strike settings (targetDelta, targetPercentOTM, targetPointsOTM, or targetDebit to pick by price) choose the leg you buy, and the leg you sell sits further out of the money, placed by the same width and wing settings a credit spread uses.
The account check
Before it sends anything, the bot checks your account.
Depending on how you've set the bot up, the number of contracts is either a fixed quantity you chose or scaled to your account size (leverage and bpu size the position off your account value). Whatever the size, the bot then asks a simple question: would putting this trade on push my account past its margin cushion?
If the answer is yes, the bot skips the entry rather than sending an order that would push the account past its margin cushion. You get a short note that it stood down for headroom, and the bot moves on.
If your IBKR account is kept in another currency, such as Canadian dollars, its value and margin figures are converted to US dollars before the bot sizes the trade or checks the cushion. When no live exchange rate can be read, a deliberately low fallback rate is used where one exists (Canadian dollars have one), so the account is understated rather than overstated. With no rate at all, your margin cannot be read, and the bot treats that the way it treats any margin it cannot read: at first as a passing hiccup. Entries that fire before the margin has failed three reads in a row go ahead without the cushion check (the margin is read at most once every ten seconds, so bots firing together share one read). From the third failed read in a row, new entries pause until the margin can be read again, and the alert says why.
This check is careful about timing, too: each entry that passes reserves its own slice of headroom against the account, so a cluster of bots all opening at the same second can't each look at the same free margin and all slip through together. They're measured against what's actually left after the ones ahead of them.
One order, never legged
When a spread does go in, both legs go to the market together, as a single order, never one leg first and the other chased afterward. This means you are never left holding a naked short because half of a spread filled and half didn't. An iron condor goes the same way, all four legs at one net price, so both sides open at the exact same instant.
A short strangle is the exception, because its two legs are both naked shorts with no spread between them: the put is sold first, then the call. If the put sells nothing, the bot stands down without selling the call and tries again like any other unfilled attempt, so you are never left holding the call alone.
And a multi-leg spread is never sent as a market order. The bot always works a limit price (below).
Working the price to a fair fill
On a two-leg credit spread the bot is patient and works the price, rather than crossing the market and paying up to get filled instantly. Not every entry works that way: step 1 and the note after this list say which ones cross.
- It starts favorable, on a two-leg credit spread. For a put or call credit spread the first order goes out at a price that's good for you, not one that just crosses the spread. Iron condors, debit spreads and calendars are different: those go out at a marketable price straight away, because pricing a four-leg or cross-expiry combo patiently tends to mean not filling at all. An iron condor that doesn't fill is re-priced to the live market at each step, the same way a spread is. If patient pricing matters more to you than certainty of fill, prefer the two-leg structures.
- It gives ground a step at a time. If that price doesn't fill, the bot nudges it a little, re-checking the live market before each move so it's always adjusting against fresh quotes, not stale ones.
- It re-picks strikes if it has to. As it re-tries through the window, the bot re-selects strikes and quotes fresh each time, so a move in the market between attempts is accounted for rather than ignored.
- It stands down if it can't get there. Each attempt has a time budget, and the whole effort is capped by your entry window. If the bot can't get a fair fill before the window closes, it cancels and records a miss rather than chasing a bad price. If IBKR fills the order anyway, in the seconds the cancel takes to land, that fill is not ignored: the position is opened at the price it actually filled at and watched by its stops like any other entry, and the bot shows as holding a position. A fill that lands at the close, once positions are no longer watched, is left to settle at expiry.
The result, on a put or call credit spread, is an entry that starts at a favorable price and does not cross the market to force a fill, unless you turn on crossOnFinalRetry, which prices the window's final attempt to cross (see the config reference). Iron condors, debit spreads and calendars cross from their first order, as step 1 says, and crossOnFinalRetry changes nothing for them.
A single-leg entry (a naked put or call, a long put or call, or either leg of a short strangle) is patient with every openOrderAlgo: it starts one tick inside the mid and moves a tick toward the market at each adjustment, without crossing. Market is exits-only, so a single-leg entry set to it works as Normal, and the engine says so once.
Entry filters: only enter when your conditions are met
You can gate any bot behind conditions, so it only enters when the market looks the way you want (entryFilter). A filter is a plain true/false rule you write out of named checks and live market readings: for example, "only if VIX is below 20," or "only if SPX is above a level." The bot enters only when the whole rule comes out true. There is no time-of-day function; use the bot's own openTime and latestEntryTime for that, and the weekday filters for day gates. To trade on fewer days use the day-of-week gates; to spread a bot's entry across a few seconds, use entryJitter. randomFilter(p) passes each check with chance p, drawn again every 10 seconds while the bot waits, so it mostly delays the entry to a random moment in the window; with a short window the bot may not enter that day.
Two things worth knowing:
- Filters fail safe on market data. If a live market value your filter depends on (VIX, SPX, ES) is missing or gone stale, the whole rule resolves to no and the bot skips the entry. A bot set to check VIX never enters blind because it couldn't read VIX; it waits it out instead. An unreadable external feed behaves differently: that one check simply reads false and the rest of your rule still applies, so an
||can carry the entry through. If you want an external feed to be a hard requirement, make it its own&&term. - A bot enters once a day. A fill ends the bot's attempts for the day. If the engine restarts inside the bot's window, a bot that already entered today is skipped rather than opening a second lot.
maxDailyEntriesraises that limit: set it to2or more if you want a restart inside the window to be able to open another one.
After it fills: watched live
The moment a spread fills, the bot starts watching it, continuously, for the rest of the session, tracking its delta and value live and streaming the numbers to your dashboard so your P&L chart and open-positions view always reflect what's really happening. Nothing that's open goes unwatched.
That live monitoring, and every way a position can close, is its own subject: see Exiting positions for the full picture.