OptionDesk

How Fills Work in the OptionDesk Engine

Every price the backtester books, and where it comes from: entry at the bar open, stops at the level unless the bar gapped, and why the close is never used.

Updated 2026-11-28 · 8 min read

On this page
  1. Why this matters before anything else
  2. The one rule underneath all the others: the open, not the close
  3. What each exit fills at
  4. The three places the engine gives up an easy assumption
  5. Slippage sits on top of every fill
  6. A worked example
  7. What mistakes do traders make?
  8. Next step

Every number a backtest reports is built from fills, and a fill is where a backtest is easiest to flatter. This page documents exactly which price the engine books in each situation, and the three places it deliberately gives up an easy assumption.

Every rupee figure on this page is hypothetical. It comes from backtested runs on historical NSE data — projected, not advice, and not indicative of future results. Every trade is sized at today's lot size.

Slippage and brokerage, set per leg and per side. Every fill in the run is priced through these two boxes. Slippage and brokerage, set per leg and per side. Every fill in the run is priced through these two boxes.

Why this matters before anything else

A backtest is a claim: had you traded this rule, this is what would have happened. The claim is only as good as the prices it books. Move every fill a rupee in your favour and a losing strategy turns profitable, with no change to the logic at all.

Think of it like marking a test paper. If you also wrote the answer key afterwards, a perfect score means nothing. A fill rule is the answer key written in advance — it fixes what price you get before the engine knows how the minute turned out.

The one rule underneath all the others: the open, not the close

Every scheduled fill takes the bar's opening price. Entry at 09:20 books the open of the 09:20 candle. The timed exit at 15:15 books the open of the 15:15 candle.

Here is why that matters, and it is not a technicality. A 1-minute candle is only complete once the minute has finished. Its close is therefore the last thing known about that minute — filling there means the engine decided to trade at a price it could only have learned by waiting to see how the minute went. Do that on every trade in an 81-session backtest and you have handed the strategy 81 free minutes of foresight.

The open is the opposite: it is the first price of the minute, knowable at the instant the decision is due.

The common misconception. Many traders assume open-versus-close is a rounding detail worth a few paise. On a NIFTY option premium that moves ₹4 in a minute at 09:20, it is ₹4 a leg, both legs, every session — larger than the entire brokerage bill for the run.

What each exit fills at

Exit Fill price
Entry The bar open at or after the entry time. A leg with no print in that minute fills at its next print, but only within five minutes; later than that the session is skipped and listed
TIME — the scheduled exit The bar open at or after the exit time
SL / TRAIL SL on a leg The stop level — unless the bar opened already past it, then that open
TP on a leg The target level — same gap rule
STOP — the position stop The stop amount, with each leg's exit scaled so the legs sum exactly to it
TARGET — the position target The target amount, only if a price the position actually printed reached it
NO DATA The last bar that could be fully marked, at its close

Two of those rows carry the real weight.

The gap rule. A stop fills at its level only if the market was there to fill you. If the minute opened beyond your stop, you were gapped through it, and the engine books the open — a worse price than you asked for. A backtester that always fills stops exactly at the level is quietly claiming you were never once gapped through one in three years of data.

NO DATA is disclosed, not hidden. When a strike drifts outside the band the archive holds, or simply stops printing, the honest answer is that we do not know what that position was worth. The engine closes at the last bar it could mark and labels the trade so you can see the result rests on incomplete marking.

The three places the engine gives up an easy assumption

1. A stop and a target in the same minute counts as the stop. A candle gives you the high, the low and the close, but never the order they happened in. If one minute touched both of a leg's levels, we cannot know which came first, so the engine books the worse one. Assuming the good one came first would inflate results on precisely the violent minutes where the difference is largest.

2. A trail tightened this minute binds from the next. A trailing stop that tightens using this bar's favourable extreme and is then tested against this bar's adverse extreme assumes the good half of the minute arrived first. It runs one way — always in the trader's favour. So a step earned on this bar takes effect on the following one.

3. Adverse excursion is measured leg by leg. For a leg you are short the engine takes that minute's high; for a leg you are long, its low. Legs do not peak at the same instant, so summing those extremes overstates how bad the position actually got — which means stops trigger at least as often in the backtest as they would have live, never less.

Each of those choices costs the reported P&L something. That is the point: the cost is what makes the number worth reading.

Slippage sits on top of every fill

Slippage is applied per leg, per side, always against you — added when buying, subtracted when selling, on the way in and again on the way out. A four-leg iron condor pays it eight times in a round trip.

The default is 0.25% of the premium, set in the Costs panel under Slippage. The % of premium, min ½ tick mode exists for a specific reason worth knowing: a plain percentage of a ₹5 wing is ₹0.0125, a quarter of a tick, which is not a fill anybody has ever received. That mode floors it at half a real tick instead.

There is a guard behind this. If your position stop is smaller in rupees than the slippage the engine itself just charged you on entry, that stop is disabled for the trade and reported — because a stop tighter than your own cost assumption is not a rule, it is arithmetic that fires on entry.

A worked example

The base run used throughout these guides: NIFTY short strangle (ATM±2), 1 lot, 2025-01-01 to 2025-04-30, 81 sessions, entry 09:20 exit 15:15 IST. a 30% position stop, slippage 0.25% a leg, brokerage ₹20 an order. Projected, not advice.

Lot size: every trade is sized at today's lot size, whatever its date. Premiums are per unit, so rupee figures are comparable across a window that crosses a lot-size change.

Value
Net P&L +₹34,994
Win rate 51.9%
Brokerage and statutory charges ₹9,277
Slippage ₹4,321

₹13,598 of modelled friction on a ₹34,994 result — over a third of the profit. Switch brokerage and statutory charges off and the same run reports +₹44,271. Neither number is wrong; one of them is just answering a question nobody trades.

What mistakes do traders make?

Comparing a result here against a backtest elsewhere that fills at the close. The two numbers are not measuring the same thing. Check the other tool's fill rule before concluding ours is pessimistic.

Setting slippage to zero to "see the strategy cleanly". What that shows is the strategy's behaviour in a market with no spread. Every real fill crosses one.

Reading a run with NO DATA trades in it as though it were complete. Check how many trades carry that label before trusting the average.

Assuming a tight stop is free. A stop tight enough to be inside the spread costs more in slippage than it saves in losses, which is why the engine refuses to price one and tells you so.

Next step

Open /backtest, run any strategy twice — once with the cost model on and once with it off — and read the gap. That gap is what fills and friction cost, and it is the part of a backtest result that nobody advertises. Then read how costs and slippage are calculated for the full breakdown of where the money goes.

Common questions

Does the OptionDesk backtester fill at the bar open or the bar close?
The open, for every scheduled fill — entry, the timed exit, and any bar that gapped through a level. Filling at the close would hand a minute of hindsight to every decision, because the close is not knowable at the moment the decision is made. The one exception is a run that ends because the data ran out, which books the last fully-marked bar's close and is labelled NO DATA so you can see it happened.
What price does a stop-loss actually fill at in a backtest?
At the stop level itself, unless the minute opened already past it — in which case the fill is that bar's open, which is worse. A backtest that always fills stops exactly at the level quietly assumes you were never gapped through one, which is the single most flattering assumption a stop-loss backtest can make.
What is look-ahead bias and how does this engine avoid it?
Look-ahead bias is using information inside a decision that was not available when the decision was made. The engine avoids it in three specific places: fills take the bar open rather than the close, a trailing stop tightened by this minute's move only binds from the next minute, and when one minute touches both a leg's stop and its target the stop is assumed to have come first.
Why does a stop and a target on the same minute count as the stop?
A 1-minute candle records the high, the low and the close, but not the order they occurred in. If a minute touched both a leg's stop and its target, the engine cannot know which came first, so it books the worse of the two. The alternative — assuming the good one came first — would inflate results on exactly the volatile minutes where it matters most.
Are the option prices in the backtest real traded prices or a model?
Real traded 1-minute option candles from the historical archive, not prices generated by Black-Scholes. Greeks and implied volatility are modelled, because they are not quoted; the premium a fill books is a price that actually traded.
What does the NO DATA exit reason mean?
The position could no longer be marked — a strike drifted outside the band the archive holds, or it simply stopped printing before the scheduled exit. Rather than guess a price, the engine closes at the last bar it could mark completely and labels the trade NO DATA, so a result resting on incomplete marking is visible instead of buried in the average.
How is slippage applied to a backtest fill?
Per leg and per side, always against you: added to the price when buying, subtracted when selling, on entry and again on exit. A four-leg structure pays it eight times over a round trip. The default is 0.25% of the premium.

Disclosures

  • Not investment advice. OptionDesk provides tools, analytics, backtesting and education for NSE F&O only. It is not a SEBI-registered Investment Adviser or Research Analyst, and does not provide investment advice, buy/sell calls, tips or trade execution. You place every order yourself, through your own broker.
  • Projected, not promised. Every projected figure — payoffs, max profit/loss, probability of profit, target-date P&L and similar estimates — is “projected, not advice.” Backtested and simulated results are hypothetical, do not represent actual trading, and are not indicative of future results.
  • Delayed market data. Market data shown on OptionDesk is delayed by approximately one minute — it is not a live feed. It is provided for analysis and education only, and must not be relied on for time-sensitive execution.
  • F&O risk. Trading in futures & options carries a high risk of loss and is not suitable for every investor. Consider your objectives and risk tolerance, and seek independent advice where appropriate.

More in How the engine works