Advanced8-12 min readTopic 17 of 20

    From Backtest to Live Trading

    Rohit Singh

    Mr. Chartist · SEBI RA

    Module Progress
    0/20
    Module

    A backtest that passes is not a strategy that works. It is a strategy that has not yet met the two things a historical simulation cannot contain: a real order queue and your own behaviour. The distance between a passing report and live capital is covered in stages, each of which answers exactly one question and is blind to the next — and the only honest way through is to refuse to skip one. This page is about that path: what paper trading proves, why forward testing on small real size is unskippable, how to reconcile live fills against what the backtest assumed, and why scaling size is a separate decision that proves nothing about the strategy at all.

    The same signal, filled twice. The backtest books it at the signal price; the live order pays for latency, spread, queue position and its own size. The gap is the thing you are about to go and measure.A single signal is drawn twice on the same price ladder. The backtest books the trade at the signal price itself, instantly and in full. The live order leaves after the candle closes, crosses the spread, waits in the queue and takes whatever the book offers, so it prints at a worse point. Four labelled causes sit under the gap: decision latency, spread, queue position and your own size. The figure compares fill points on a schematic ladder, not returns.ONE SIGNAL, TWO FILLS — SCHEMATIC PRICE LADDER, NOT A RESULTsignal candle closesBacktest books it here — instantly, in full100.00Live order fills here100.35This gap is not a bug. It is the part the backtest was never able to observe.WHAT PUT THE GAP THEREDecision latencycandle closes, code thinks, order leavesSpreadyou cross it; the backtest never didQueue positiona limit at the touch is behind everyone earlierYour own sizethe top of the book is thinner than the chart looksIllustrative points on a made-up ladder. No instrument, no date, no outcome implied.
    The same signal, filled twice. The backtest books it at the signal price; the live order pays for latency, spread, queue position and its own size. The gap is the thing you are about to go and measure.

    Why does a passing backtest prove so little?

    A backtest answers one narrow question honestly: given this exact series of prices, would these exact rules have produced these exact decisions? That is worth having. It catches rules that contradict each other, entries with no matching exit, and logic that quietly looks at a price it could not have seen.

    What it cannot answer is whether the prices you fed it were the prices you would actually have had, and whether an order at those prices would have been filled. Both of those are assumptions your simulator made on your behalf, usually silently. A backtest fills at the close because you told it to. The market has no obligation to agree.

    So treat the report as a gate, not a verdict. It removes strategies. It never approves one.

    Note — This page discusses no strategy's results, and quotes none. Every number below is a made-up illustration of a mechanism. Nothing here is a recommendation to trade any instrument or to deploy any system.

    What are the four stages between a backtest and real size?

    The rollout is a ladder, and each rung answers something the one below it could not.

    Backtest, paper, forward test on small real size, and then — separately — scale. Each rung names both what it proves and what it is structurally unable to see.Four stacked stages. A backtest proves the rules are executable but not that the data was clean. Paper trading proves the plumbing survives a session unattended but cannot show slippage, queue position or rejects because no order existed. A forward test on small real size is the first stage that produces real fills, rejects, costs and square-offs. Scaling size proves nothing about the strategy and is treated as a separate decision.EACH STAGE ANSWERS ONE QUESTION AND IS BLIND TO THE NEXT1 · BacktestProves: the rules are executable and self-consistentCannot show: that the data you fed it was the data you would have had2 · Paper tradeProves: the plumbing runs unattended through a real sessionCannot show: slippage, queue position or a reject — no order ever existed3 · Forward test, small real sizeProves: real fills, real rejects, real costs, real square-offCannot show: how the same logic behaves at ten times the quantity4 · Scale, as a separate decisionProves: nothing about the strategy — only about your capacityCannot show: be reversed cheaply if you skipped stage threeA divergence you cannot explain sends you back a stage. It never sends you forward.
    Backtest, paper, forward test on small real size, and then — separately — scale. Each rung names both what it proves and what it is structurally unable to see.

    What does paper trading actually prove?

    Paper trading — running the live code against the live feed, but sending orders to a simulator instead of the exchange — is genuinely useful, and it is useful for reasons that have nothing to do with whether the strategy makes money.

    It proves the plumbing. That the system starts on its own before the pre-open, that it survives a full NSE session unattended, that it handles the 15:30 close without crashing, that a corporate action does not blow up the symbol map, that a reconnect after a dropped feed does not double a position. Those are real failures and they are cheaper to find here.

    What it does not prove is anything about execution — and this is where most people lose money later.

    • It cannot reproduce slippage. A paper fill is a decision your simulator made, not a price anyone quoted you.
    • It cannot reproduce queue position. A limit order at the touch is behind everyone who got there first; a simulator that fills you when price merely trades at your level has invented a place in that queue.
    • It cannot produce a reject. Margin shortfalls, frozen quantity limits, price-band hits, order-per-second throttles, instrument-level restrictions — none of them exist in a simulator that always says yes.
    • It cannot show you your own size in the book. On a mid-cap the top of the order book is far thinner than a chart suggests, and your own order is part of what moves it.
    • It cannot show you the square-off. Intraday products get closed by the broker on the broker's schedule, at whatever price is available. A simulator closes at your requested price.
    • It cannot show you what you do when it is real. Nobody has ever overridden a paper trade at 14:55.

    Watch out — The most dangerous paper-trading result is a good one. It tells you the plumbing works and the strategy is fine, when it only ever tested the first half of that sentence.

    Why is forward testing on small real size unskippable?

    There is exactly one way to find out what a real order does: send a real order. Forward testing means running the finished system live, with real capital, at the smallest size the market and your costs allow, for long enough to accumulate a meaningful number of fills.

    Small size here does not mean small enough to ignore. It means small enough that being wrong about everything costs you a fixed, pre-agreed and genuinely tolerable amount — and large enough that every trade goes through the real path: real margin blocked, real charges deducted, real rejects, real partial fills, real square-off.

    The question this stage answers is not 'does it make money'. Over a small number of trades that question has no answer worth reading. The question is: does the live system do what the backtest said it would do, trade by trade, for reasons I can name?

    Forward-test size = the size at which a total failure is an expense you have already agreed to
    • Set the number before the first order, in rupees, in writing.
    • It is a cost of research, not a position you are hoping works out.
    • If losing all of it would change your behaviour, it is too large for a test.
    • If the costs at that size make every trade uneconomic, that itself is a finding about the strategy.

    How do you check the backtest and the live system are running the same thing?

    Before you read a single live fill, prove the two systems are even comparable. Divergence here is not an execution problem — it is a bookkeeping problem that will make every later comparison meaningless.

    Run this list as a hard checklist, and fix anything that fails before the first live order.

    The backtest-to-live divergence checklist

    • Same data source. If the backtest used one vendor's historical bars and the live system reads the broker's feed, differences in tick aggregation alone will move your signals.
    • Same timestamps. Confirm both use the same timezone and the same bar convention — a bar labelled 09:20 may mean the bar starting then or the bar ending then, and the two are a full bar apart.
    • Same bar-close rule. Does the live system act on a closed bar, or on the forming one? A backtest almost always uses the closed bar.
    • Same costs. Brokerage, exchange transaction charges, GST, STT/CTT, SEBI turnover fees and stamp duty, plus an explicit slippage assumption. If the backtest models zero slippage, it is not modelling a market.
    • Same universe. The live universe must be selected by the same rule as the backtest universe — including the delisted and suspended names the backtest saw, or you have quietly introduced survivorship bias.
    • Same corporate-action handling. The live system must adjust for splits, bonuses and dividends the same way the historical series was adjusted, or the same rule fires at different prices.
    • Same rounding, tick size and lot size. A backtest working in decimals and a live system snapping to the tick will not place identical orders.
    • Same holiday and session calendar, including special sessions and truncated days.
    • Same order type. If the backtest assumed a market order and the live system sends a limit, you have changed the strategy, not the implementation.
    • Same state on restart. If the system is restarted mid-session, it must recover exactly the position and pending orders it had, not a fresh empty book.

    How do you reconcile live fills against the backtest, trade by trade?

    This is the actual work of this stage, and it is the step almost everyone replaces with a glance at the P&L.

    For every live trade, write down what the backtest would have assumed and what the broker actually reported, side by side, and then write one sentence explaining the difference. Not a category — a sentence. 'The order left 370ms after the bar closed and the book had moved one tick' is an explanation. 'Slippage' is not.

    One reconciliation record. The last field is the entire point: an explanation you can write is a system you understand, and a blank one is a system you do not.A single row from a reconciliation log with six fields: the timestamp of the bar the rule fired on, the timestamp the order actually left, the price the backtest assumed, the price the broker reported, the quantity sent against the quantity done, and a written explanation of the difference. The last field is the point of the record — an unexplained row is a reason to stop, not a rounding error.ONE TRADE, RECONCILED BEFORE THE NEXTsignal_ts09:19:59.940the bar close the rule fired onorder_ts09:20:00.310when the order actually leftassumed_px100.00what the backtest bookedfill_px100.35what the broker reported backqty_sent / qty_done200 / 160a partial is not a fillexplained_byspread + queueblank here is a stop signalReconcile trade by trade, before you scale. Not weekly, and not in aggregate.
    One reconciliation record. The last field is the entire point: an explanation you can write is a system you understand, and a blank one is a system you do not.

    What are the usual explanations, and which of them are acceptable?

    What you observeUsual causeIs it acceptable?
    Fill a tick or two away from the assumed price, both directionsSpread and normal book movement in the gap between signal and orderYes — but model it in the backtest and re-run before scaling
    Fill consistently worse, never betterYou are always crossing, or your limit sits behind the queueYes, if quantified. It changes the cost assumption, sometimes fatally
    The live system took a trade the backtest did notDifferent bar convention, different universe, or acting on an unclosed barNo. Stop and fix the divergence checklist
    The backtest took a trade the live system missedA reject, a margin block, a throttle, or the symbol was not in the live universeNo, until you can name which one and show it in the logs
    Position after the session does not match the sum of fillsAn intraday square-off, a partial fill counted as full, or a missed order updateNo. This is the most serious of the five — halt
    Charges materially above the modelled figureCosts assumed at the wrong slab, or far more round trips than expectedYes as information, no as a surprise. Re-run the arithmetic before scaling

    Watch out — A divergence you cannot explain is a stop signal, not a rounding error. Not 'monitor it'. Stop, find it, and only then decide whether the rollout continues. The unexplained difference you tolerate at test size is the one that scales with your capital.

    How does the cost gap work in rupees?

    Take an illustrative intraday system that expects to round-trip a ₹100 instrument, 200 shares at a time, twice a day.

    Suppose the backtest assumed the fill landed exactly at the signal price. Live, the average entry lands 35 paise worse and the average exit 25 paise worse. That is 60 paise per share of execution cost the backtest never charged you — ₹120 on a 200-share round trip, before any brokerage, statutory charge or GST.

    Run that against the average move the strategy is trying to capture. If the strategy's typical intended move is a rupee, execution has taken more than half of the thing it was built to collect, and the backtest that looked fine was measuring a market that does not exist.

    Example — Illustrative arithmetic with round numbers on no particular instrument and no particular date. The point is the method — measure your own gap from your own fills, then put that number back into the backtest and re-run it.

    What does the first live session actually look like?

    The first day the system sends real orders is not a trading day. It is an observation exercise, and you should have nothing else scheduled.

    The point is not to see whether it makes money. It is to watch every assumption you have been carrying meet the market for the first time, in order, and to be present when one of them fails.

    1. 1

      Before the pre-open — prove the session is alive

      Authenticate, download the day's instrument master fresh, and confirm the system can read positions and funds. A token that expired overnight is the most common way a first day ends before it starts.

    2. 2

      Through the pre-open — read, do not act

      Prices in the pre-open session behave differently from continuous trading. A system that starts evaluating rules into it is acting on a picture that is not yet a market.

    3. 3

      The first order — watch it end to end

      Follow one order from the log line that decided it, through the payload, the acknowledgement, the state changes and the fill, into the position. If any link in that chain is not visible to you, fix it before the second order.

    4. 4

      Mid-session — check the book against the broker's

      Compare what your code believes it holds with what the broker reports. Do it manually, at least once, on day one. This is the check you are about to make continuous, and you should have seen it agree with your own eyes.

    5. 5

      Into the close — know what your product does

      If the strategy uses an intraday product, be watching when the broker's square-off window arrives. Whether your exit rule or the broker closed the position is a fact you want to observe, not infer.

    6. 6

      After the close — reconcile the same evening

      Every fill, against the broker's trade book and the contract note, while the session is still fresh. A break you find tonight is a bug; the same break found next week is an archaeology project.

    Pro tip — Write down, before the open, what you expect to happen. Then compare. The gap between what you expected and what occurred is the actual output of day one, and it is worth more than the P&L.

    What record should the rollout leave behind?

    A rollout that leaves no record cannot be reviewed, and a rollout you cannot review is one you will repeat the mistakes of. Keep a deployment log alongside the reconciliation — one entry per meaningful event, written the same day.

    • The date the system went live, at what size, and the exact version of the code that was running.
    • Every configuration value in force — the universe, the parameters, the cost assumptions, the limits.
    • Every change made after go-live, with the date, the reason, and what it was expected to affect.
    • Every divergence found, its explanation, and whether it sent the rollout back a stage.
    • Every halt: what triggered it, what state the book was in, and what had to be true before restarting.
    • Every size increase, with the measured fill gap before and after it.
    • The sessions where the system traded nothing, and why. A quiet week is data about the rules, not an absence of data.

    Note — The point of this record is not compliance theatre. It is that six weeks from now you will be asked — by yourself — whether the system is behaving differently, and the only honest way to answer is against a written baseline you cannot retro-fit.

    When is scaling size a separate decision?

    Always. Proving the strategy and proving your capacity are two different questions, and running them together is how people convert a research problem into a capital problem.

    At test size your order is invisible to the book. At ten times that size it is not — you are now part of the price you are trying to trade, and the same logic can produce a materially worse average fill for reasons that have nothing to do with whether the idea was sound. Scaling therefore needs its own evidence: re-measure the fill gap at each new size, and treat a worsening gap as a capacity limit you have found rather than a nuisance to push through.

    1. 1

      Decide the scaling ladder before the first live order

      Write the sizes and the conditions for moving between them while you are calm. Deciding to scale after a good week is not a decision, it is a mood.

    2. 2

      Require a fill-gap measurement at every rung

      The reconciliation does not stop when the strategy is 'proven'. Each new size is a fresh execution question.

    3. 3

      Increase in steps you would accept losing

      Doubling is aggressive; a step you could give back without changing your process is not.

    4. 4

      Hold every other variable still

      Never change size and change a parameter in the same week. If something breaks you will not know which change did it.

    5. 5

      Watch the gap, not the P&L

      The gap between assumed and actual fills is the honest signal at each rung. Profit over a small number of trades is noise wearing a suit.

    6. 6

      Stop at the size where the gap stops being explainable

      That is your capacity. It is a real, discoverable property of the strategy and the instrument, and it is not negotiable by wanting more.

    What about approvals and the regulatory side in India?

    Automated order placement through a broker's API in India sits inside a framework built by SEBI and administered through the exchanges and your broker — covering how retail algorithms are registered and identified, which strategies need approval, and what your broker is required to do before your orders reach NSE or BSE.

    That framework has been revised repeatedly and continues to be. So the only responsible instruction is the shape of the obligation, not its detail: before you send a single automated order, confirm the current requirements with your broker and read the current circulars at sebi.gov.in and on your exchange's site. Do not take the specifics from any article, including this one, and do not take them from a vendor whose product depends on the answer being convenient.

    Note — Nothing on this page states a current regulatory requirement as fact. Verify the position that applies to you, in writing, with your broker and the current SEBI and exchange circulars.

    What stops the rollout?

    Every honest process has to say what would halt it. Here is what halts this one.

    • Any reconciliation row you cannot explain in a sentence. One row is enough.
    • A live trade the backtest would not have taken, or a backtest trade the live system did not take.
    • A position that does not equal the running sum of fills at any point in the session.
    • A measured cost gap that, put back into the backtest, changes the conclusion. That is not a scaling problem; the strategy has been falsified at real costs.
    • Any change to the strategy logic mid-test. The clock restarts — you are now testing a different system with a shorter record.
    • A rejected order whose cause you cannot find in your own logs.
    • You overriding the system manually. The thing under test is the system, and a human hand in the middle of it means there is no record of what the system would have done.
    • Anything in the divergence checklist failing after you thought it passed.

    Key points

    A passing backtest removes strategies. It never approves one.
    Paper trading tests the plumbing, not execution — no order ever reaches the exchange.
    Simulators cannot produce slippage, queue position, rejects, or your own market impact.
    Forward test on real size small enough that total failure is a pre-agreed expense.
    Prove the two systems are comparable first: same data, timestamps, costs, universe.
    Reconcile every live fill against the backtest's assumption, trade by trade, in writing.
    'Slippage' is not an explanation. A sentence naming the cause is.
    A divergence you cannot explain is a stop signal, not a rounding error.
    Scaling is a separate decision and proves nothing about whether the strategy works.
    Re-measure the fill gap at every size — a widening gap is the strategy's capacity limit.
    Verify current Indian algo requirements with your broker, SEBI and your exchange, not an article.

    Pro tip — Put your measured fill gap back into the backtest and re-run it before you scale anything. Most rollouts die honestly at exactly this step, and dying at this step costs a research budget you had already written off — while discovering the same thing at ten times the size costs something you had not.

    Frequently asked questions

    How long should I forward test a strategy before going live with real size?

    Count trades and conditions, not calendar days. The test needs enough fills for the reconciliation to be meaningful, and it needs to have run through the situations that break systems — a trending session and a choppy one, an expiry, a results day in a name you hold, a dropped connection, a restart, and at least one intraday square-off. A month that contained none of those has told you less than a fortnight that contained all of them.

    Is paper trading useless then?

    No — it is essential and it is misunderstood. Paper trading is an infrastructure test: it proves the system starts on time, survives a full session unattended, handles the close and recovers from a reconnect without duplicating a position. It cannot test execution at all, because no order ever reaches the exchange, so a paper fill price is a number your own simulator chose. Use it to find crashes, never to judge the strategy.

    Why do my live results differ from my backtest?

    Before assuming the edge decayed, check the boring causes, because they explain most cases: a different data source, a different bar-close convention, a timezone or timestamp mismatch, costs and slippage not modelled, a universe that quietly excludes delisted names, unhandled corporate actions, or acting on a forming bar in one system and a closed bar in the other. Work through the divergence checklist above before you touch the strategy logic.

    What is slippage and why does the backtest usually miss it?

    Slippage is the difference between the price your rule pointed at and the price you actually got. A backtest misses it because it fills you at a price from the historical series, with no spread to cross, no queue to wait in and no order of your own to move the book. In Indian intraday products there is a further source: positions closed by the broker's square-off happen at whatever the market offers, not at a level you chose.

    Should I increase size after a good week of live trading?

    A good week is not evidence. Scaling is a separate decision from proving the strategy, and it should follow a ladder you wrote down before the first order, with a fresh measurement of the assumed-versus-actual fill gap at every rung. If that gap widens as size grows, you have found the strategy's capacity — which is useful information, and not something to push through.

    Do I need SEBI or exchange approval to run my own algo in India?

    There is a framework covering how automated orders reach NSE and BSE through a broker, and it has been revised more than once, so nothing you read in an article is safe to rely on as current. Ask your broker in writing what applies to your specific setup, and read the current circulars on sebi.gov.in and your exchange's site before you place an automated order.

    Can I skip the forward test if my backtest covered ten years of data?

    No, and a long backtest is not a substitute for a short live one — they answer different questions. Ten years of history says nothing about whether your order gets filled, whether it gets rejected, whether your position tracker survives a partial fill or what your broker's square-off does to an open intraday position. Only real orders reveal real fills.